Record Class Morpheme
java.lang.Object
java.lang.Record
opennlp.tools.tokenize.lattice.Morpheme
- Record Components:
span- The location of the morpheme in the original text. Must not benull.surface- The covered text. Must not benullor empty.features- The dictionary feature columns. Must not benull.unknown- Whether the morpheme came from unknown-word handling rather than a lexicon entry.
public record Morpheme(Span span, String surface, List<String> features, boolean unknown)
extends Record
One morpheme from lattice segmentation: the
Span it covers in the original
text, its surface form, and the feature columns its dictionary entry carries.
The features are the entry's columns exactly as listed in the dictionary, since different dictionaries carry different schemas: part of speech first by convention, then dictionary-specific columns such as conjugation, base form, or reading. A morpheme produced by unknown-word handling has the unknown entry's features and is marked as such.
- Since:
- 3.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.features()Returns the value of thefeaturesrecord component.final inthashCode()Returns a hash code value for this object.span()Returns the value of thespanrecord component.surface()Returns the value of thesurfacerecord component.final StringtoString()Returns a string representation of this record class.booleanunknown()Returns the value of theunknownrecord component.
-
Constructor Details
-
Morpheme
Validates the morpheme.- Throws:
IllegalArgumentException- Thrown ifspan,surface, orfeaturesisnull, orsurfaceis empty.
-
-
Method Details
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
span
-
surface
-
features
-
unknown
-