org.apache.lucene.index.memory
public class SynonymTokenFilter extends TokenFilter
Field Summary | |
---|---|
static String | SYNONYM_TOKEN_TYPE The Token.type used to indicate a synonym to higher level filters. |
Constructor Summary | |
---|---|
SynonymTokenFilter(TokenStream input, SynonymMap synonyms, int maxSynonyms)
Creates an instance for the given underlying stream and synonym table.
|
Method Summary | |
---|---|
protected Token | createToken(String synonym, Token current)
Creates and returns a token for the given synonym of the current input
token; Override for custom (stateless or stateful) behaviour, if desired.
|
Token | next() Returns the next token in the stream, or null at EOS. |
Parameters: input the underlying child token stream synonyms the map used to extract synonyms for terms maxSynonyms the maximum number of synonym tokens to return per underlying token word (a value of Integer.MAX_VALUE indicates unlimited)
Parameters: synonym a synonym for the current token's term current the current token from the underlying child stream
Returns: a new token, or null to indicate that the given synonym should be ignored