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, and its length must equal the span length.features- The dictionary feature columns. Must not benulland must not containnull.unknown- Whether the morpheme came from unknown-word handling rather than a lexicon entry.
public record Morpheme(opennlp.tools.util.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.opennlp.tools.util.Spanspan()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
public Morpheme(opennlp.tools.util.Span span, String surface, List<String> features, boolean unknown) Validates the morpheme.- Throws:
IllegalArgumentException- Thrown ifspan,surface,features, or a feature isnull;surfaceis empty; or the surface and span lengths differ.
-
-
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
-