Class Token

java.lang.Object
org.apache.lucene.analysis.morph.Token

public abstract class Token extends Object
Analyzed token with morphological data.
  • Field Details

    • surfaceForm

      protected final char[] surfaceForm
    • offset

      protected final int offset
    • length

      protected final int length
    • startOffset

      protected final int startOffset
    • endOffset

      protected final int endOffset
    • posIncr

      protected int posIncr
    • posLen

      protected int posLen
    • type

      protected final TokenType type
  • Constructor Details

    • Token

      protected Token(char[] surfaceForm, int offset, int length, int startOffset, int endOffset, TokenType type)
  • Method Details

    • getSurfaceForm

      public char[] getSurfaceForm()
      Returns:
      surfaceForm
    • getOffset

      public int getOffset()
      Returns:
      offset into surfaceForm
    • getLength

      public int getLength()
      Returns:
      length of surfaceForm
    • getSurfaceFormString

      public String getSurfaceFormString()
      Returns:
      surfaceForm as a String
    • getStartOffset

      public int getStartOffset()
      Get the start offset of the term in the analyzed text.
    • getEndOffset

      public int getEndOffset()
      Get the end offset of the term in the analyzed text.
    • setPositionIncrement

      public void setPositionIncrement(int posIncr)
    • getPositionIncrement

      public int getPositionIncrement()
    • setPositionLength

      public void setPositionLength(int posLen)
      Set the position length (in tokens) of this token. For normal tokens this is 1; for compound tokens it's > 1.
    • getPositionLength

      public int getPositionLength()
      Get the length (in tokens) of this token. For normal tokens this is 1; for compound tokens it's > 1.
    • getType

      public TokenType getType()
      Returns the type of this token