java.lang.Object
org.miaixz.bus.extra.nlp.provider.jieba.JiebaWord
- All Implemented Interfaces:
Serializable,NLPWord
Wrapper class for a single word (SegToken) from Jieba word segmentation. This class adapts the Jieba
SegToken
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
ConstructorsConstructorDescriptionJiebaWord(com.huaban.analysis.jieba.SegToken segToken) Constructs aJiebaWordinstance by wrapping a JiebaSegToken. -
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 JiebaSegToken.toString()Returns the textual representation of this word, which is the same asgetText().
-
Constructor Details
-
JiebaWord
public JiebaWord(com.huaban.analysis.jieba.SegToken segToken) Constructs aJiebaWordinstance by wrapping a JiebaSegToken.- Parameters:
segToken- TheSegTokenobject from Jieba word segmentation.
-
-
Method Details
-
getText
Retrieves the text of the word from the wrapped JiebaSegToken. -
getStartOffset
public int getStartOffset()Retrieves the starting character offset of this word within the original text. This delegates to thestartOffsetfield of the JiebaSegToken.- 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 theendOffsetfield of the JiebaSegToken.- 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().
-