public class SynonymTokenFilter extends TokenFilter
Modifier and Type | Field and Description |
---|---|
static String |
SYNONYM_TOKEN_TYPE
The Token.type used to indicate a synonym to higher level filters.
|
input
Constructor and Description |
---|
SynonymTokenFilter(TokenStream input,
SynonymMap synonyms,
int maxSynonyms)
Creates an instance for the given underlying stream and synonym table.
|
Modifier and Type | Method and Description |
---|---|
protected Token |
createToken(String synonym,
Token current,
Token reusableToken)
Creates and returns a token for the given synonym of the current input
token; Override for custom (stateless or stateful) behavior, if desired.
|
Token |
next(Token reusableToken)
Returns the next token in the stream, or null at EOS.
|
close, reset
next
public static final String SYNONYM_TOKEN_TYPE
public SynonymTokenFilter(TokenStream input, SynonymMap synonyms, int maxSynonyms)
input
- the underlying child token streamsynonyms
- the map used to extract synonyms for termsmaxSynonyms
- the maximum number of synonym tokens to return per underlying
token word (a value of Integer.MAX_VALUE indicates unlimited)public Token next(Token reusableToken) throws IOException
next
in class TokenStream
IOException
protected Token createToken(String synonym, Token current, Token reusableToken)
synonym
- a synonym for the current token's termcurrent
- the current token from the underlying child streamreusableToken
- the token to reuseCopyright © 2000-2013 Apache Software Foundation. All Rights Reserved.