public final class StandardTokenizer extends Tokenizer
This class implements the Word Break rules from the Unicode Text Segmentation algorithm, as specified in Unicode Standard Annex #29.
Many applications have specific tokenizer needs. If this tokenizer does not suit your application, please consider copying this source code directory to your project and maintaining your own grammar-based tokenizer.
AttributeSource.State| Modifier and Type | Field and Description |
|---|---|
static int |
ACRONYM
Deprecated.
(3.1)
|
static int |
ACRONYM_DEP
Deprecated.
(3.1)
|
static int |
ALPHANUM |
static int |
APOSTROPHE
Deprecated.
(3.1)
|
static int |
CJ
Deprecated.
(3.1)
|
static int |
COMPANY
Deprecated.
(3.1)
|
static int |
EMAIL |
static int |
HANGUL |
static int |
HIRAGANA |
static int |
HOST
Deprecated.
(3.1)
|
static int |
IDEOGRAPHIC |
static int |
KATAKANA |
static int |
MAX_TOKEN_LENGTH_LIMIT |
static int |
NUM |
static int |
SOUTHEAST_ASIAN |
static String[] |
TOKEN_TYPES
String token types that correspond to token type int constants
|
DEFAULT_TOKEN_ATTRIBUTE_FACTORY| Constructor and Description |
|---|
StandardTokenizer()
Creates a new instance of the
StandardTokenizer. |
StandardTokenizer(AttributeFactory factory)
Creates a new StandardTokenizer with a given
AttributeFactory |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
end() |
int |
getMaxTokenLength() |
boolean |
incrementToken() |
void |
reset() |
void |
setMaxTokenLength(int length)
Set the max allowed token length.
|
correctOffset, setReaderaddAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toStringpublic static final int ALPHANUM
@Deprecated public static final int APOSTROPHE
@Deprecated public static final int ACRONYM
@Deprecated public static final int COMPANY
public static final int EMAIL
@Deprecated public static final int HOST
public static final int NUM
@Deprecated public static final int CJ
@Deprecated public static final int ACRONYM_DEP
public static final int SOUTHEAST_ASIAN
public static final int IDEOGRAPHIC
public static final int HIRAGANA
public static final int KATAKANA
public static final int HANGUL
public static final String[] TOKEN_TYPES
public static final int MAX_TOKEN_LENGTH_LIMIT
public StandardTokenizer()
StandardTokenizer. Attaches
the input to the newly created JFlex scanner.
See http://issues.apache.org/jira/browse/LUCENE-1068public StandardTokenizer(AttributeFactory factory)
AttributeFactorypublic void setMaxTokenLength(int length)
IllegalArgumentException - if the given length is outside of the
range [1, 1048576].public int getMaxTokenLength()
setMaxTokenLength(int)public final boolean incrementToken()
throws IOException
incrementToken in class TokenStreamIOExceptionpublic final void end()
throws IOException
end in class TokenStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class TokenizerIOExceptionpublic void reset()
throws IOException
reset in class TokenizerIOExceptionCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.