java.lang.Object
org.miaixz.bus.extra.nlp.provider.mmseg.MmsegWord
- All Implemented Interfaces:
Serializable,NLPWord
Wrapper class for a single word from mmseg4j word segmentation. This class adapts the
Word
object to the common NLPWord interface, providing a unified way to access segmented word information.- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMmsegWord(com.chenlb.mmseg4j.Word word) Constructs aMmsegWordinstance by wrapping an mmseg4jWord. -
Method Summary
Modifier and TypeMethodDescriptionintRetrieves the ending character offset of this word within the original text.intRetrieves the starting character offset of this word within the original text.getText()Retrieves the text of the word from the wrapped mmseg4jWord.toString()Returns the textual representation of this word, which is the same asgetText().
-
Constructor Details
-
MmsegWord
public MmsegWord(com.chenlb.mmseg4j.Word word) Constructs aMmsegWordinstance by wrapping an mmseg4jWord.- Parameters:
word- TheWordobject from mmseg4j word segmentation.
-
-
Method Details
-
getText
Retrieves the text of the word from the wrapped mmseg4jWord. -
getStartOffset
public int getStartOffset()Retrieves the starting character offset of this word within the original text. This delegates to thegetStartOffset()method of the mmseg4jWord.- Specified by:
getStartOffsetin interfaceNLPWord- Returns:
- The starting position (inclusive) of the word.
-
getEndOffset
public int getEndOffset()Retrieves the ending character offset of this word within the original text. This delegates to thegetEndOffset()method of the mmseg4jWord.- Specified by:
getEndOffsetin interfaceNLPWord- Returns:
- The ending position (exclusive) of the word.
-
toString
Returns the textual representation of this word, which is the same asgetText().
-