public class SynonymTokenFilter extends TokenFilter
Modifier and Type | Field and Description |
---|---|
static java.lang.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(java.lang.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 java.lang.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 java.io.IOException
next
in class TokenStream
reusableToken
- a Token that may or may not be used to
return; this parameter should never be null (the callee
is not required to check for null before using it, but it is a
good idea to assert that it is not null.)java.io.IOException
protected Token createToken(java.lang.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-2014 Apache Software Foundation. All Rights Reserved.