public final class EdgeNGramTokenFilter extends TokenFilter
This TokenFilter create n-grams from the beginning edge of a input token.
As of Lucene 4.4, this filter handles correctly supplementary characters.
AttributeSource.State| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_PRESERVE_ORIGINAL |
inputDEFAULT_TOKEN_ATTRIBUTE_FACTORY| Constructor and Description |
|---|
EdgeNGramTokenFilter(TokenStream input,
int gramSize)
Creates an EdgeNGramTokenFilter that produces edge n-grams of the given
size.
|
EdgeNGramTokenFilter(TokenStream input,
int minGram,
int maxGram,
boolean preserveOriginal)
Creates an EdgeNGramTokenFilter that, for a given input term, produces all
edge n-grams with lengths >= minGram and <= maxGram.
|
| Modifier and Type | Method and Description |
|---|---|
void |
end() |
boolean |
incrementToken() |
void |
reset() |
closeaddAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toStringpublic static final boolean DEFAULT_PRESERVE_ORIGINAL
public EdgeNGramTokenFilter(TokenStream input, int minGram, int maxGram, boolean preserveOriginal)
input - TokenStream holding the input to be tokenizedminGram - the minimum length of the generated n-gramsmaxGram - the maximum length of the generated n-gramspreserveOriginal - Whether or not to keep the original term when it
is outside the min/max size range.public EdgeNGramTokenFilter(TokenStream input, int gramSize)
input - TokenStream holding the input to be tokenizedgramSize - the n-gram size to generate.public final boolean incrementToken()
throws IOException
incrementToken in class TokenStreamIOExceptionpublic void reset()
throws IOException
reset in class TokenFilterIOExceptionpublic void end()
throws IOException
end in class TokenFilterIOExceptionCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.