|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.util.AttributeSource org.apache.lucene.analysis.TokenStream org.apache.lucene.analysis.TokenFilter org.apache.lucene.wordnet.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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource |
---|
org.apache.lucene.util.AttributeSource.AttributeFactory, org.apache.lucene.util.AttributeSource.State |
Field Summary | |
---|---|
static String |
SYNONYM_TOKEN_TYPE
The Token.type used to indicate a synonym to higher level filters. |
Fields inherited from class org.apache.lucene.analysis.TokenFilter |
---|
input |
Constructor Summary | |
---|---|
SynonymTokenFilter(org.apache.lucene.analysis.TokenStream input,
SynonymMap synonyms,
int maxSynonyms)
Creates an instance for the given underlying stream and synonym table. |
Method Summary | |
---|---|
protected boolean |
createToken(String synonym,
org.apache.lucene.util.AttributeSource.State current)
Creates and returns a token for the given synonym of the current input token; Override for custom (stateless or stateful) behavior, if desired. |
boolean |
incrementToken()
Returns the next token in the stream, or null at EOS. |
void |
reset()
|
Methods inherited from class org.apache.lucene.analysis.TokenFilter |
---|
close, end |
Methods inherited from class org.apache.lucene.util.AttributeSource |
---|
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, restoreState, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String SYNONYM_TOKEN_TYPE
Constructor Detail |
---|
public SynonymTokenFilter(org.apache.lucene.analysis.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)Method Detail |
---|
public final boolean incrementToken() throws IOException
incrementToken
in class org.apache.lucene.analysis.TokenStream
IOException
protected boolean createToken(String synonym, org.apache.lucene.util.AttributeSource.State current)
synonym
- a synonym for the current token's termcurrent
- the current token from the underlying child stream
public void reset() throws IOException
reset
in class org.apache.lucene.analysis.TokenFilter
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |