Record Class MascSentence.QuarkExtractor

java.lang.Object
java.lang.Record
opennlp.tools.formats.masc.MascSentence.QuarkExtractor
Record Components:
wordsById - Quarks of the sentence organized by their id
allDocumentWords - Quarks of the document organized by their id
Enclosing class:
MascSentence

private static record MascSentence.QuarkExtractor(Map<Integer,MascWord> wordsById, List<MascWord> allDocumentWords) extends Record
A helper class to extract the extract a quark from the corpus file even if it is beyond the bounds of the sentence.
  • Field Details

  • Constructor Details

    • QuarkExtractor

      private QuarkExtractor(Map<Integer,MascWord> wordsById, List<MascWord> allDocumentWords)
      Creates an instance of a QuarkExtractor record class.
      Parameters:
      wordsById - the value for the wordsById record component
      allDocumentWords - the value for the allDocumentWords record component
  • Method Details

    • get

      private MascWord get(int key) throws IOException
      Extract a quark by its key
      Parameters:
      key - The quark's ID
      Returns:
      The quark reference.
      Throws:
      IOException - Thrown if the key was not found in the document.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • wordsById

      public Map<Integer,MascWord> wordsById()
      Returns the value of the wordsById record component.
      Returns:
      the value of the wordsById record component
    • allDocumentWords

      public List<MascWord> allDocumentWords()
      Returns the value of the allDocumentWords record component.
      Returns:
      the value of the allDocumentWords record component