SnowballAnalyzerpublic class SnowballAnalyzer extends Analyzer Filters {@link StandardTokenizer} with {@link StandardFilter}, {@link
LowerCaseFilter}, {@link StopFilter} and {@link SnowballFilter}.
Available stemmers are listed in {@link net.sf.snowball.ext}. The name of a
stemmer is the part of the class name before "Stemmer", e.g., the stemmer in
{@link EnglishStemmer} is named "English". |
Fields Summary |
---|
private String | name | private Set | stopSet |
Constructors Summary |
---|
public SnowballAnalyzer(String name)Builds the named analyzer with no stop words.
this.name = name;
| public SnowballAnalyzer(String name, String[] stopWords)Builds the named analyzer with the given stop words.
this(name);
stopSet = StopFilter.makeStopSet(stopWords);
|
Methods Summary |
---|
public org.apache.lucene.analysis.TokenStream | tokenStream(java.lang.String fieldName, java.io.Reader reader)Constructs a {@link StandardTokenizer} filtered by a {@link
StandardFilter}, a {@link LowerCaseFilter} and a {@link StopFilter}.
TokenStream result = new StandardTokenizer(reader);
result = new StandardFilter(result);
result = new LowerCaseFilter(result);
if (stopSet != null)
result = new StopFilter(result, stopSet);
result = new SnowballFilter(result, name);
return result;
|
|