Record Class DependencyArc

java.lang.Object
java.lang.Record
opennlp.tools.depparse.DependencyArc
Record Components:
head - The zero-based index of the governing token, or ROOT_HEAD when the dependent is the sentence root.
dependent - The zero-based index of the governed token.
relation - The dependency relation label, for example nsubj.

public record DependencyArc(int head, int dependent, String relation) extends Record
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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The head value marking an arc from the artificial root node.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DependencyArc(int head, int dependent, String relation)
    Validates the arc invariants.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the dependent record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the head record component.
    Returns the value of the relation record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ROOT_HEAD

      public static final int ROOT_HEAD
      The head value marking an arc from the artificial root node.
      See Also:
  • Constructor Details

    • DependencyArc

      public DependencyArc(int head, int dependent, String relation)
      Validates the arc invariants.
      Throws:
      IllegalArgumentException - Thrown if dependent is negative, head is less than ROOT_HEAD, the arc is a self-loop, or relation is null or blank.
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • head

      public int head()
      Returns the value of the head record component.
      Returns:
      the value of the head record component
    • dependent

      public int dependent()
      Returns the value of the dependent record component.
      Returns:
      the value of the dependent record component
    • relation

      public String relation()
      Returns the value of the relation record component.
      Returns:
      the value of the relation record component