GermanStemFilterpublic final class GermanStemFilter extends TokenFilter A filter that stems German words. It supports a table of words that should
not be stemmed at all. The stemmer used can be changed at runtime after the
filter object is created (as long as it is a GermanStemmer). |
Fields Summary |
---|
private Token | tokenThe actual token in the input stream. | private GermanStemmer | stemmer | private Set | exclusionSet |
Constructors Summary |
---|
public GermanStemFilter(TokenStream in)
super(in);
stemmer = new GermanStemmer();
| public GermanStemFilter(TokenStream in, Hashtable exclusiontable)Builds a GermanStemFilter that uses an exclusiontable.
this( in );
exclusionSet = new HashSet(exclusiontable.keySet());
| public GermanStemFilter(TokenStream in, Set exclusionSet)Builds a GermanStemFilter that uses an exclusiontable.
this( in );
this.exclusionSet = exclusionSet;
|
Methods Summary |
---|
public final org.apache.lucene.analysis.Token | next()
if ( ( token = input.next() ) == null ) {
return null;
}
// Check the exclusiontable
else if ( exclusionSet != null && exclusionSet.contains( token.termText() ) ) {
return token;
}
else {
String s = stemmer.stem( token.termText() );
// If not stemmed, dont waste the time creating a new token
if ( !s.equals( token.termText() ) ) {
return new Token( s, token.startOffset(),
token.endOffset(), token.type() );
}
return token;
}
| public void | setExclusionSet(java.util.Set exclusionSet)Set an alternative exclusion list for this filter.
this.exclusionSet = exclusionSet;
| public void | setExclusionTable(java.util.Hashtable exclusiontable)Set an alternative exclusion list for this filter.
exclusionSet = new HashSet(exclusiontable.keySet());
| public void | setStemmer(GermanStemmer stemmer)Set a alternative/custom GermanStemmer for this filter.
if ( stemmer != null ) {
this.stemmer = stemmer;
}
|
|