java.lang.Object | ||||
↳ | org.apache.lucene.util.AttributeSource | |||
↳ | org.apache.lucene.analysis.TokenStream | |||
↳ | org.apache.lucene.analysis.Tokenizer | |||
↳ | org.apache.lucene.analysis.standard.StandardTokenizer |
A grammar-based tokenizer constructed with JFlex
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.
You must specify the required Version
compatibility when creating StandardAnalyzer:
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ACRONYM | ||||||||||
int | ACRONYM_DEP | This constant is deprecated. this solves a bug where HOSTs that end with '.' are identified as ACRONYMs. | |||||||||
int | ALPHANUM | ||||||||||
int | APOSTROPHE | ||||||||||
int | CJ | ||||||||||
int | COMPANY | ||||||||||
int | |||||||||||
int | HOST | ||||||||||
int | NUM |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
TOKEN_TYPES | String token types that correspond to token type int constants |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.analysis.Tokenizer
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new instance of the
StandardTokenizer . | |||||||||||
Creates a new StandardTokenizer with a given
AttributeSource . | |||||||||||
Creates a new StandardTokenizer with a given
AttributeSource.AttributeFactory
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is called by the consumer after the last token has been
consumed, after
incrementToken() returned false
(using the new TokenStream API). | |||||||||||
Consumers (i.e.,
IndexWriter ) use this method to advance the stream to
the next token. | |||||||||||
This method is deprecated.
Remove in 3.X and make true the only valid value
| |||||||||||
Expert: Reset the tokenizer to a new reader.
| |||||||||||
Set the max allowed token length.
| |||||||||||
This method is deprecated.
Remove in 3.X and make true the only valid value
See https://issues.apache.org/jira/browse/LUCENE-1068
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.analysis.Tokenizer
| |||||||||||
From class
org.apache.lucene.analysis.TokenStream
| |||||||||||
From class
org.apache.lucene.util.AttributeSource
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.io.Closeable
|
This constant is deprecated.
this solves a bug where HOSTs that end with '.' are identified
as ACRONYMs.
String token types that correspond to token type int constants
Creates a new instance of the StandardTokenizer
. Attaches
the input
to the newly created JFlex scanner.
input | The input reader See http://issues.apache.org/jira/browse/LUCENE-1068 |
---|
Creates a new StandardTokenizer with a given AttributeSource
.
Creates a new StandardTokenizer with a given AttributeSource.AttributeFactory
This method is called by the consumer after the last token has been
consumed, after incrementToken()
returned false
(using the new TokenStream
API). Streams implementing the old API
should upgrade to use this feature.
WhitespaceTokenizer
was used.Consumers (i.e., IndexWriter
) use this method to advance the stream to
the next token. Implementing classes must implement this method and update
the appropriate AttributeImpl
s with the attributes of the next
token.
The producer must make no assumptions about the attributes after the method
has been returned: the caller may arbitrarily change it. If the producer
needs to preserve the state for subsequent calls, it can use
captureState()
to create a copy of the current attribute state.
This method is called for every token of a document, so an efficient
implementation is crucial for good performance. To avoid calls to
addAttribute(Class)
and getAttribute(Class)
,
references to all AttributeImpl
s that this stream uses should be
retrieved during instantiation.
To ensure that filters and consumers know which attributes are available,
the attributes must be added during instantiation. Filters and consumers
are not required to check for availability of attributes in
incrementToken()
.
IOException |
---|
This method is deprecated.
Remove in 3.X and make true the only valid value
Prior to https://issues.apache.org/jira/browse/LUCENE-1068, StandardTokenizer mischaracterized as acronyms tokens like www.abc.com when they should have been labeled as hosts instead.
Expert: Reset the tokenizer to a new reader. Typically, an analyzer (in its reusableTokenStream method) will use this to re-use a previously created tokenizer.
IOException |
---|
Set the max allowed token length. Any token longer than this is skipped.
This method is deprecated.
Remove in 3.X and make true the only valid value
See https://issues.apache.org/jira/browse/LUCENE-1068
replaceInvalidAcronym | Set to true to replace mischaracterized acronyms as HOST. |
---|