java.lang.Object
org.miaixz.bus.extra.nlp.provider.word.WordWord
- All Implemented Interfaces:
Serializable,NLPWord
Wrapper class for a single word from the Word word segmentation library. 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
ConstructorsConstructorDescriptionWordWord(org.apdplat.word.segmentation.Word word) Constructs aWordWordinstance by wrapping a Word library'sWordobject. -
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 Word library'sWord.toString()Returns the textual representation of this word, which is the same asgetText().
-
Constructor Details
-
WordWord
public WordWord(org.apdplat.word.segmentation.Word word) Constructs aWordWordinstance by wrapping a Word library'sWordobject.- Parameters:
word- TheWordobject from Word word segmentation.
-
-
Method Details
-
getText
Retrieves the text of the word from the wrapped Word library'sWord. -
getStartOffset
public int getStartOffset()Retrieves the starting character offset of this word within the original text. Note: The Word library'sWorddoes not directly provide offset information, so this method returns -1.- Specified by:
getStartOffsetin interfaceNLPWord- Returns:
- The starting position (inclusive) of the word, or -1 if not available.
-
getEndOffset
public int getEndOffset()Retrieves the ending character offset of this word within the original text. Note: The Word library'sWorddoes not directly provide offset information, so this method returns -1.- Specified by:
getEndOffsetin interfaceNLPWord- Returns:
- The ending position (exclusive) of the word, or -1 if not available.
-
toString
Returns the textual representation of this word, which is the same asgetText().
-