public class RelationTriple extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
RelationTriple.WithTree
A
RelationTriple, but with the tree saved as well. |
| Modifier and Type | Field and Description |
|---|---|
List<CoreLabel> |
object
The object (third argument) of this triple
|
List<CoreLabel> |
relation
The relation (second argument) of this triple
|
List<CoreLabel> |
subject
The subject (first argument) of this triple
|
| Constructor and Description |
|---|
RelationTriple(List<CoreLabel> subject,
List<CoreLabel> relation,
List<CoreLabel> object)
Create a new triple with known values for the subject, relation, and object.
|
| Modifier and Type | Method and Description |
|---|---|
Optional<SemanticGraph> |
asDependencyTree()
An optional method, returning the dependency tree this triple was extracted from
|
List<CoreLabel> |
asSentence()
Return the given relation triple as a flat sentence
|
boolean |
equals(Object o) |
int |
hashCode() |
String |
objectGloss()
The object of this relation triple, as a String
|
String |
relationGloss()
The relation of this relation triple, as a String
|
static Optional<RelationTriple> |
segment(SemanticGraph parse)
Try to segment this sentence as a relation triple.
|
String |
subjectGloss()
The subject of this relation triple, as a String
|
String |
toString()
Print a human-readable description of this relation triple, as a tab-separated line
|
public RelationTriple(List<CoreLabel> subject, List<CoreLabel> relation, List<CoreLabel> object)
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 String subjectGloss()
public String objectGloss()
public String relationGloss()
public Optional<SemanticGraph> asDependencyTree()
public String toString()
public static Optional<RelationTriple> segment(SemanticGraph parse)
Try to segment this sentence as a relation triple. This sentence must already match one of a few strict patterns for a valid OpenIE extraction. If it does not, then no relation triple is created. That is, this is not a relation extractor; it is just a utility to segment what is already a (subject, relation, object) triple into these three parts.
parse - The sentence to process, as a dependency tree.