Package opennlp.tools.tokenize.lattice
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(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
-
Field Summary
Fields -
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.
-
Field Details
-
Constructor Details
-
Morpheme
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
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
span
Returns the value of thespanrecord component.- Returns:
- the value of the
spanrecord component
-
surface
Returns the value of thesurfacerecord component.- Returns:
- the value of the
surfacerecord component
-
features
Returns the value of thefeaturesrecord component.- Returns:
- the value of the
featuresrecord component
-
unknown
public boolean unknown()Returns the value of theunknownrecord component.- Returns:
- the value of the
unknownrecord component
-