Class Range

java.lang.Object
org.tribuo.util.tokens.universal.Range
All Implemented Interfaces:
CharSequence

public final class Range extends Object implements CharSequence
A range currently being segmented.
  • Field Details

    • buff

      public char[] buff
      The character buffer.
    • len

      public int len
      The token length.
    • start

      public int start
      The start index.
    • end

      public int end
      The end index.
    • incr

      public int incr
      The value to increment by.
    • type

      public Token.TokenType type
      The current token type.
  • Method Details

    • set

      public void set(char c1, char c2, int start)
      Sets the first two characters in the range, and the type to NGRAM.
      Parameters:
      c1 - The first character.
      c2 - The second character.
      start - The start value.
    • set

      public void set(char c, int start)
      Sets the first character in the range.
      Parameters:
      c - The first character.
      start - The start value.
    • set

      public void set(char[] buff, int len, int start)
      Sets the character range.
      Parameters:
      buff - The characters.
      len - The length of the character buffer.
      start - The start index.
    • punct

      public void punct(char p, int start)
      Sets this range to represent a punctuation character.
      Parameters:
      p - The punctuation character.
      start - The start index.
    • setType

      public void setType(Token.TokenType type)
      Sets the token type.
      Parameters:
      type - The token type.
    • length

      public int length()
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int index)
      Specified by:
      charAt in interface CharSequence
    • subSequence

      public CharSequence subSequence(int start, int end)
      Specified by:
      subSequence in interface CharSequence
    • toString

      public String toString()
      Specified by:
      toString in interface CharSequence
      Overrides:
      toString in class Object