public class RelationTriple extends java.lang.Object implements java.lang.Comparable<RelationTriple>, java.lang.Iterable<CoreLabel>, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
RelationTriple.WithLink
A
RelationTriple , but with both the tree and the entity
links saved as well. |
static class |
RelationTriple.WithTree
A
RelationTriple , but with the tree saved as well. |
Modifier and Type | Field and Description |
---|---|
java.util.List<CoreLabel> |
canonicalObject
The object (third argument) of this triple, in its canonical mention (i.e., coref resolved).
|
java.util.List<CoreLabel> |
canonicalSubject
The subject (first argument) of this triple, in its canonical mention (i.e., coref resolved)
|
double |
confidence
An optional score (confidence) for this triple
|
java.util.List<CoreLabel> |
object
The object (third argument) of this triple
|
java.util.List<CoreLabel> |
relation
The relation (second argument) of this triple.
|
java.util.List<CoreLabel> |
subject
The subject (first argument) of this triple
|
Constructor and Description |
---|
RelationTriple(java.util.List<CoreLabel> subject,
java.util.List<CoreLabel> relation,
java.util.List<CoreLabel> object) |
RelationTriple(java.util.List<CoreLabel> subject,
java.util.List<CoreLabel> relation,
java.util.List<CoreLabel> object,
double confidence)
Create a new triple with known values for the subject, relation, and object.
|
RelationTriple(java.util.List<CoreLabel> subject,
java.util.List<CoreLabel> canonicalSubject,
java.util.List<CoreLabel> relation,
java.util.List<CoreLabel> canonicalObject,
java.util.List<CoreLabel> object) |
RelationTriple(java.util.List<CoreLabel> subject,
java.util.List<CoreLabel> canonicalSubject,
java.util.List<CoreLabel> relation,
java.util.List<CoreLabel> object,
java.util.List<CoreLabel> canonicalObject,
double confidence)
Create a new triple with known values for the subject, relation, and object.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<CoreLabel> |
allTokens()
Returns all the tokens in the extraction, in the order subject then relation then object.
|
java.util.Optional<SemanticGraph> |
asDependencyTree()
An optional method, returning the dependency tree this triple was extracted from
|
java.util.List<CoreLabel> |
asSentence()
Return the given relation triple as a flat sentence
|
int |
compareTo(RelationTriple o) |
java.lang.String |
confidenceGloss()
A textual representation of the confidence.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
isPrefixBe()
If true, this relation expresses a "to be" relation.
|
boolean |
isPrefixBe(boolean newValue)
Set the value of this relation triple expressing a "to be" relation.
|
boolean |
isSuffixBe()
If true, this relation expresses a "to be" relation (with the be at the end of the sentence).
|
boolean |
isSuffixBe(boolean newValue)
Set the value of this relation triple expressing a "to be" relation (suffix).
|
boolean |
isSuffixOf()
If true, this relation has an ungrounded "of" at the end of the relation.
|
boolean |
isSuffixOf(boolean newValue)
Set the value of this triple missing an ungrounded "of" in the relation string.
|
boolean |
istmod()
If true, this relation expresses a tmod (temporal modifier) relation that is not grounded in
the sentence.
|
boolean |
istmod(boolean newValue)
Set the value of this relation triple expressing a tmod (temporal modifier) relation.
|
java.util.Iterator<CoreLabel> |
iterator() |
java.lang.String |
objectGloss()
The object of this relation triple, as a String
|
CoreLabel |
objectHead()
The head of the object of this relation triple.
|
java.lang.String |
objectLemmaGloss()
The object of this relation triple, as a String of the object's lemmas.
|
java.lang.String |
objectLink()
The entity link of the subject
|
Pair<java.lang.Integer,java.lang.Integer> |
objectTokenSpan()
Gets the span of the NON-CANONICAL object.
|
java.lang.String |
relationGloss()
The relation of this relation triple, as a String
|
CoreLabel |
relationHead()
The head of the relation of this relation triple.
|
java.lang.String |
relationLemmaGloss()
The relation of this relation triple, as a String of the relation's lemmas.
|
Pair<java.lang.Integer,java.lang.Integer> |
relationTokenSpan()
Get a representative span for the relation expressed by this triple.
|
java.lang.String |
subjectGloss()
The subject of this relation triple, as a String
|
CoreLabel |
subjectHead()
The head of the subject of this relation triple.
|
java.lang.String |
subjectLemmaGloss()
The subject of this relation triple, as a String of the subject's lemmas.
|
java.lang.String |
subjectLink()
The entity link of the subject
|
Pair<java.lang.Integer,java.lang.Integer> |
subjectTokenSpan()
Gets the span of the NON-CANONICAL subject.
|
java.lang.String |
toQaSrlString(CoreMap sentence)
Print in the format expected by Gabriel Stanovsky and Ido Dagan, Creating a Large Benchmark for Open
Information Extraction, EMNLP 2016.
|
java.lang.String |
toReverbString(java.lang.String docid,
CoreMap sentence)
Print a description of this triple, formatted like the ReVerb outputs.
|
java.lang.String |
toString()
Print a human-readable description of this relation triple, as a tab-separated line.
|
public final java.util.List<CoreLabel> subject
public final java.util.List<CoreLabel> canonicalSubject
public final java.util.List<CoreLabel> relation
relationGloss()
or relationLemmaGloss()
.public final java.util.List<CoreLabel> object
public final java.util.List<CoreLabel> canonicalObject
public final double confidence
public RelationTriple(java.util.List<CoreLabel> subject, java.util.List<CoreLabel> relation, java.util.List<CoreLabel> object, double confidence)
subject
- The subject of this triple; e.g., "cats".relation
- The relation of this triple; e.g., "play with".object
- The object of this triple; e.g., "yarn".public RelationTriple(java.util.List<CoreLabel> subject, java.util.List<CoreLabel> relation, java.util.List<CoreLabel> object)
public RelationTriple(java.util.List<CoreLabel> subject, java.util.List<CoreLabel> canonicalSubject, java.util.List<CoreLabel> relation, java.util.List<CoreLabel> object, java.util.List<CoreLabel> canonicalObject, double confidence)
subject
- The subject of this triple; e.g., "cats".relation
- The relation of this triple; e.g., "play with".object
- The object of this triple; e.g., "yarn".public java.util.List<CoreLabel> allTokens()
public java.lang.String subjectGloss()
public CoreLabel subjectHead()
public java.lang.String subjectLink()
public java.lang.String subjectLemmaGloss()
public java.lang.String objectGloss()
public CoreLabel objectHead()
public java.lang.String objectLink()
public java.lang.String objectLemmaGloss()
public java.lang.String relationGloss()
public java.lang.String relationLemmaGloss()
public CoreLabel relationHead()
public java.lang.String confidenceGloss()
public Pair<java.lang.Integer,java.lang.Integer> subjectTokenSpan()
public Pair<java.lang.Integer,java.lang.Integer> relationTokenSpan()
public Pair<java.lang.Integer,java.lang.Integer> objectTokenSpan()
public boolean isPrefixBe()
public boolean isPrefixBe(boolean newValue)
newValue
- The new value of this relation being a "to be" relation.public boolean isSuffixBe()
public boolean isSuffixBe(boolean newValue)
newValue
- The new value of this relation being a "to be" relation.public boolean isSuffixOf()
public boolean isSuffixOf(boolean newValue)
newValue
- The new value of this relation missing an "of".public boolean istmod()
public boolean istmod(boolean newValue)
newValue
- The new value of this relation being a tmod relation.public java.util.Optional<SemanticGraph> asDependencyTree()
public java.util.List<CoreLabel> asSentence()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toQaSrlString(CoreMap sentence)
public java.lang.String toReverbString(java.lang.String docid, CoreMap sentence)
public int compareTo(RelationTriple o)
compareTo
in interface java.lang.Comparable<RelationTriple>