Package opennlp.tools.formats.masc
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 idallDocumentWords- 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 Summary
FieldsModifier and TypeFieldDescriptionThe field for theallDocumentWordsrecord component.The field for thewordsByIdrecord component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theallDocumentWordsrecord component.final booleanIndicates whether some other object is "equal to" this one.private MascWordget(int key) Extract a quark by its keyfinal inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Returns the value of thewordsByIdrecord component.
-
Field Details
-
wordsById
The field for thewordsByIdrecord component. -
allDocumentWords
The field for theallDocumentWordsrecord component.
-
-
Constructor Details
-
QuarkExtractor
Creates an instance of aQuarkExtractorrecord class.- Parameters:
wordsById- the value for thewordsByIdrecord componentallDocumentWords- the value for theallDocumentWordsrecord component
-
-
Method Details
-
get
Extract a quark by its key- Parameters:
key- The quark's ID- Returns:
- The
quark reference. - Throws:
IOException- Thrown if thekeywas not found in the document.
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
wordsById
Returns the value of thewordsByIdrecord component.- Returns:
- the value of the
wordsByIdrecord component
-
allDocumentWords
Returns the value of theallDocumentWordsrecord component.- Returns:
- the value of the
allDocumentWordsrecord component
-