public final class ClassicTokenizer extends Tokenizer
This should be a good tokenizer for most European-language documents:
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.
ClassicTokenizer was named StandardTokenizer in Lucene versions prior to 3.1.
As of 3.1, StandardTokenizer
implements Unicode text segmentation,
as specified by UAX#29.
AttributeSource.State
Modifier and Type | Field and Description |
---|---|
static int |
ACRONYM |
static int |
ACRONYM_DEP |
static int |
ALPHANUM |
static int |
APOSTROPHE |
static int |
CJ |
static int |
COMPANY |
static int |
EMAIL |
static int |
HOST |
static int |
NUM |
static String[] |
TOKEN_TYPES
String token types that correspond to token type int constants
|
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
Constructor and Description |
---|
ClassicTokenizer()
Creates a new instance of the
ClassicTokenizer . |
ClassicTokenizer(AttributeFactory factory)
Creates a new ClassicTokenizer 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, setReader
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
public static final int ALPHANUM
public static final int APOSTROPHE
public static final int ACRONYM
public static final int COMPANY
public static final int EMAIL
public static final int HOST
public static final int NUM
public static final int CJ
public static final int ACRONYM_DEP
public static final String[] TOKEN_TYPES
public ClassicTokenizer()
ClassicTokenizer
. Attaches
the input
to the newly created JFlex scanner.
See http://issues.apache.org/jira/browse/LUCENE-1068public ClassicTokenizer(AttributeFactory factory)
AttributeFactory
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-2017 Apache Software Foundation. All Rights Reserved.