Package opennlp.tools.depparse
Record Class DependencyArc
java.lang.Object
java.lang.Record
opennlp.tools.depparse.DependencyArc
- Record Components:
head- The zero-based index of the governing token, orROOT_HEADwhen the dependent is the sentence root.dependent- The zero-based index of the governed token.relation- The dependency relation label, for examplensubj.
One labeled edge of a
DependencyTree: the token at dependent is governed
by the token at head under the given relation.
Indices are zero-based positions in the token array the tree was built over. A
head of ROOT_HEAD marks the dependent as the sentence root, which is
attached to the artificial root node rather than to another token.
- Since:
- 3.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe field for thedependentrecord component.private final intThe field for theheadrecord component.private final StringThe field for therelationrecord component.static final intTheheadvalue marking an arc from the artificial root node. -
Constructor Summary
ConstructorsConstructorDescriptionDependencyArc(int head, int dependent, String relation) Validates the arc invariants. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thedependentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.inthead()Returns the value of theheadrecord component.relation()Returns the value of therelationrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
head
private final int headThe field for theheadrecord component. -
dependent
private final int dependentThe field for thedependentrecord component. -
relation
The field for therelationrecord component. -
ROOT_HEAD
public static final int ROOT_HEADTheheadvalue marking an arc from the artificial root node.- See Also:
-
-
Constructor Details
-
DependencyArc
Validates the arc invariants.- Throws:
IllegalArgumentException- Thrown ifdependentis negative,headis less thanROOT_HEAD, the arc is a self-loop, orrelationisnullor blank.
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
head
public int head()Returns the value of theheadrecord component.- Returns:
- the value of the
headrecord component
-
dependent
public int dependent()Returns the value of thedependentrecord component.- Returns:
- the value of the
dependentrecord component
-
relation
Returns the value of therelationrecord component.- Returns:
- the value of the
relationrecord component
-