Package org.tribuo.util.tokens.universal
Class Range
java.lang.Object
org.tribuo.util.tokens.universal.Range
- All Implemented Interfaces:
CharSequence
A range currently being segmented.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionchar
charAt
(int index) int
length()
void
punct
(char p, int start) Sets this range to represent a punctuation character.void
set
(char[] buff, int len, int start) Sets the character range.void
set
(char c1, char c2, int start) Sets the first two characters in the range, and the type to NGRAM.void
set
(char c, int start) Sets the first character in the range.void
setType
(Token.TokenType type) Sets the token type.subSequence
(int start, int end) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Field Details
-
buff
public char[] buffThe character buffer. -
len
public int lenThe token length. -
start
public int startThe start index. -
end
public int endThe end index. -
incr
public int incrThe value to increment by. -
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
Sets the token type.- Parameters:
type
- The token type.
-
length
public int length()- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int index) - Specified by:
charAt
in interfaceCharSequence
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
-
toString
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-