java.lang.Object
org.miaixz.bus.extra.nlp.provider.jcseg.JcsegWord
- All Implemented Interfaces:
Serializable,NLPWord
Wrapper class for a single word (IWord) from Jcseg word segmentation. This class adapts the Jcseg
IWord
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
ConstructorsConstructorDescriptionJcsegWord(org.lionsoul.jcseg.IWord word) Constructs aJcsegWordinstance by wrapping a JcsegIWord. -
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 JcsegIWord.toString()Returns the textual representation of this word, which is the same asgetText().
-
Constructor Details
-
JcsegWord
public JcsegWord(org.lionsoul.jcseg.IWord word) Constructs aJcsegWordinstance by wrapping a JcsegIWord.- Parameters:
word- TheIWordobject from Jcseg word segmentation.
-
-
Method Details
-
getText
Retrieves the text of the word from the wrapped JcsegIWord. -
getStartOffset
public int getStartOffset()Retrieves the starting character offset of this word within the original text. This delegates to thegetPosition()method of the JcsegIWord.- 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 is calculated based on the starting offset and the length of the word.- 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().
-