FileDocCategorySizeDatePackage
BrazilianStemFilter.javaAPI DocApache Lucene 1.92314Mon Feb 20 09:18:50 GMT 2006org.apache.lucene.analysis.br

BrazilianStemFilter

public final class BrazilianStemFilter extends TokenFilter
Based on GermanStemFilter
author
João Kramer

Fields Summary
private Token
token
The actual token in the input stream.
private BrazilianStemmer
stemmer
private Set
exclusions
Constructors Summary
public BrazilianStemFilter(TokenStream in)


     
    super(in);
    stemmer = new BrazilianStemmer();
  
public BrazilianStemFilter(TokenStream in, Hashtable exclusiontable)
Builds a BrazilianStemFilter that uses an exclusiontable.

deprecated

    this(in);
    this.exclusions = new HashSet(exclusiontable.keySet());
  
public BrazilianStemFilter(TokenStream in, Set exclusiontable)

    this(in);
    this.exclusions = exclusiontable;
  
Methods Summary
public final org.apache.lucene.analysis.Tokennext()

return
Returns the next token in the stream, or null at EOS.

    if ((token = input.next()) == null) {
      return null;
    }
    // Check the exclusiontable.
    else if (exclusions != null && exclusions.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 != null) && !s.equals(token.termText())) {
        return new Token(s, token.startOffset(), token.endOffset(), token.type());
      }
      return token;
    }