org.apache.lucene.analysis.standard
public class StandardTokenizer 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.
Constructor and Description |
---|
StandardTokenizer(Reader input)
Creates a new instance of the
StandardTokenizer . |
StandardTokenizer(Reader input,
boolean replaceInvalidAcronym)
Creates a new instance of the
StandardTokenizer . |
Modifier and Type | Method and Description |
---|---|
int |
getMaxTokenLength() |
boolean |
isReplaceInvalidAcronym()
Deprecated.
Remove in 3.X and make true the only valid value
|
Token |
next(Token result)
Returns the next token in the stream, or null at EOS.
|
void |
reset()
Resets this stream to the beginning.
|
void |
reset(Reader reader)
Expert: Reset the tokenizer to a new reader.
|
void |
setMaxTokenLength(int length)
Set the max allowed token length.
|
void |
setReplaceInvalidAcronym(boolean replaceInvalidAcronym)
Deprecated.
Remove in 3.X and make true the only valid value
See https://issues.apache.org/jira/browse/LUCENE-1068
|
next
public StandardTokenizer(Reader input)
StandardTokenizer
. Attaches the
input
to a newly created JFlex scanner.public StandardTokenizer(Reader input, boolean replaceInvalidAcronym)
StandardTokenizer
. Attaches
the input
to the newly created JFlex scanner.input
- The input readerreplaceInvalidAcronym
- Set to true to replace mischaracterized acronyms with HOST.
See http://issues.apache.org/jira/browse/LUCENE-1068public void setMaxTokenLength(int length)
public int getMaxTokenLength()
setMaxTokenLength(int)
public Token next(Token result) throws IOException
TokenStream
This implicitly defines a "contract" between consumers (callers of this method) and producers (implementations of this method that are the source for tokens):
Token.clear()
before setting the fields in it & returning itTokenFilter
is considered a consumer.next
in class TokenStream
result
- a Token that may or may not be used to returnIOException
public void reset() throws IOException
TokenStream
reset
in class TokenStream
IOException
public void reset(Reader reader) throws IOException
Tokenizer
reset
in class Tokenizer
IOException
public boolean isReplaceInvalidAcronym()
public void setReplaceInvalidAcronym(boolean replaceInvalidAcronym)
replaceInvalidAcronym
- Set to true to replace mischaracterized acronyms as HOST.Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.