FileDocCategorySizeDatePackage
BrazilianStemFilter.javaAPI DocApache Lucene 2.0.02065Fri May 26 09:53:58 BST 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, 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;
    }