public final class StandardTokenizer extends Tokenizer
As of Lucene version 3.1, 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.
You must specify the required Version
compatibility when creating StandardTokenizer:
ClassicTokenizer
for backwards compatibility.
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 |
NUM |
static int |
SOUTHEAST_ASIAN |
static String[] |
TOKEN_TYPES
String token types that correspond to token type int constants
|
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
DEFAULT_ATTRIBUTE_FACTORY
Constructor and Description |
---|
StandardTokenizer(AttributeFactory factory,
Reader input)
Creates a new StandardTokenizer with a given
AttributeFactory |
StandardTokenizer(Reader input)
Creates a new instance of the
StandardTokenizer . |
StandardTokenizer(Version matchVersion,
AttributeFactory factory,
Reader input)
Deprecated.
|
StandardTokenizer(Version matchVersion,
Reader input)
Deprecated.
|
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, setReader
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, restoreState, toString
public 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 StandardTokenizer(Reader input)
StandardTokenizer
. Attaches
the input
to the newly created JFlex scanner.input
- The input reader
See http://issues.apache.org/jira/browse/LUCENE-1068@Deprecated public StandardTokenizer(Version matchVersion, Reader input)
StandardTokenizer(Reader)
public StandardTokenizer(AttributeFactory factory, Reader input)
AttributeFactory
@Deprecated public StandardTokenizer(Version matchVersion, AttributeFactory factory, Reader input)
StandardTokenizer(AttributeFactory, Reader)
public void setMaxTokenLength(int length)
public int getMaxTokenLength()
setMaxTokenLength(int)
public final boolean incrementToken() throws IOException
incrementToken
in class TokenStream
IOException
public final void end() throws IOException
end
in class TokenStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Tokenizer
IOException
public void reset() throws IOException
reset
in class Tokenizer
IOException
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.