Module bus.extra

Class AnsjWord

java.lang.Object
org.miaixz.bus.extra.nlp.provider.ansj.AnsjWord
All Implemented Interfaces:
Serializable, NLPWord

public class AnsjWord extends Object implements NLPWord
Wrapper for a word in Ansj segmentation.
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Constructor Details

    • AnsjWord

      public AnsjWord(org.ansj.domain.Term term)
      Constructor.
      Parameters:
      term - The Term object.
  • Method Details

    • getText

      public String getText()
      Gets the text of the word.
      Specified by:
      getText in interface NLPWord
      Returns:
      The text of the word.
    • getStartOffset

      public int getStartOffset()
      Gets the start offset of the word in the original text.
      Specified by:
      getStartOffset in interface NLPWord
      Returns:
      The start offset.
    • getEndOffset

      public int getEndOffset()
      Gets the end offset of the word in the original text.
      Specified by:
      getEndOffset in interface NLPWord
      Returns:
      The end offset.
    • toString

      public String toString()
      Returns the text of the word.
      Overrides:
      toString in class Object
      Returns:
      The text of the word.