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 int |
DEFAULT_MAX_GRAM_SIZE
Deprecated.
since 7.4 - this value will be required.
|
static int |
DEFAULT_MIN_GRAM_SIZE
Deprecated.
since 7.4 - this value will be required.
|
static boolean |
DEFAULT_PRESERVE_ORIGINAL |
input
DEFAULT_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)
Deprecated.
since 7.4. Use
EdgeNGramTokenFilter(TokenStream, int, int, boolean) instead. |
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() |
close
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
@Deprecated public static final int DEFAULT_MAX_GRAM_SIZE
@Deprecated public static final int DEFAULT_MIN_GRAM_SIZE
public 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.@Deprecated public EdgeNGramTokenFilter(TokenStream input, int minGram, int maxGram)
EdgeNGramTokenFilter(TokenStream, int, int, boolean)
instead.
Behaves the same as
NGramTokenFilter(input, minGram, maxGram, false)
input
- TokenStream
holding the input to be tokenizedminGram
- the minimum length of the generated n-gramsmaxGram
- the maximum length of the generated n-gramspublic final boolean incrementToken() throws IOException
incrementToken
in class TokenStream
IOException
public void reset() throws IOException
reset
in class TokenFilter
IOException
public void end() throws IOException
end
in class TokenFilter
IOException
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.