DutchAnalyzerpublic class DutchAnalyzer extends Analyzer Analyzer for Dutch language. Supports an external list of stopwords (words that
will not be indexed at all), an external list of exclusions (word that will
not be stemmed, but indexed) and an external list of word-stem pairs that overrule
the algorithm (dictionary stemming).
A default set of stopwords is used unless an alternative list is specified, the
exclusion list is empty by default. |
Fields Summary |
---|
public static final String[] | DUTCH_STOP_WORDSList of typical Dutch stopwords. | private Set | stoptableContains the stopwords used with the StopFilter. | private Set | excltableContains words that should be indexed but not stemmed. | private Map | _stemdict |
Constructors Summary |
---|
public DutchAnalyzer()Builds an analyzer with the default stop words ({@link #DUTCH_STOP_WORDS}).
stoptable = StopFilter.makeStopSet(DUTCH_STOP_WORDS);
_stemdict.put("fiets", "fiets"); //otherwise fiet
_stemdict.put("bromfiets", "bromfiets"); //otherwise bromfiet
_stemdict.put("ei", "eier");
_stemdict.put("kind", "kinder");
| public DutchAnalyzer(String[] stopwords)Builds an analyzer with the given stop words.
stoptable = StopFilter.makeStopSet(stopwords);
| public DutchAnalyzer(HashSet stopwords)Builds an analyzer with the given stop words.
stoptable = stopwords;
| public DutchAnalyzer(File stopwords)Builds an analyzer with the given stop words.
stoptable = new HashSet(WordlistLoader.getWordtable(stopwords).keySet());
|
Methods Summary |
---|
public void | setStemDictionary(java.io.File stemdict)Reads a stemdictionary file , that overrules the stemming algorithm
This is a textfile that contains per line
word\tstem
i.e: tabseperated
_stemdict = WordlistLoader.getStemDict(stemdict);
| public void | setStemExclusionTable(java.lang.String[] exclusionlist)Builds an exclusionlist from an array of Strings.
excltable = StopFilter.makeStopSet(exclusionlist);
| public void | setStemExclusionTable(java.util.HashSet exclusionlist)Builds an exclusionlist from a Hashtable.
excltable = exclusionlist;
| public void | setStemExclusionTable(java.io.File exclusionlist)Builds an exclusionlist from the words contained in the given file.
excltable = new HashSet(WordlistLoader.getWordtable(exclusionlist).keySet());
| public org.apache.lucene.analysis.TokenStream | tokenStream(java.lang.String fieldName, java.io.Reader reader)Creates a TokenStream which tokenizes all the text in the provided TextReader.
TokenStream result = new StandardTokenizer(reader);
result = new StandardFilter(result);
result = new StopFilter(result, stoptable);
result = new DutchStemFilter(result, excltable, _stemdict);
return result;
|
|