org.apache.lucene.index.memory
Class SynonymTokenFilter
public class SynonymTokenFilter
Injects additional tokens for synonyms of token terms fetched from the
underlying child stream; the child stream must deliver lowercase tokens
for synonyms to be found.
static String | SYNONYM_TOKEN_TYPE- The Token.type used to indicate a synonym to higher level filters.
|
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.
|
SYNONYM_TOKEN_TYPE
public static final String SYNONYM_TOKEN_TYPE
The Token.type used to indicate a synonym to higher level filters.
SynonymTokenFilter
public SynonymTokenFilter(TokenStream input,
SynonymMap synonyms,
int maxSynonyms) Creates an instance for the given underlying stream and synonym table.
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)
createToken
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.
synonym - a synonym for the current token's termcurrent - the current token from the underlying child stream
- a new token, or null to indicate that the given synonym should be
ignored
next
public Token next()
throws IOExceptionReturns the next token in the stream, or null at EOS.
- next in interface TokenStream
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.