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})
and a few default entries for the stem exclusion table.
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.
try {
stoptable = org.apache.lucene.analysis.WordlistLoader.getWordSet(stopwords);
} catch (IOException e) {
// TODO: throw IOException
throw new RuntimeException(e);
}
|
Methods Summary |
---|
public void | setStemDictionary(java.io.File stemdictFile)Reads a stemdictionary file , that overrules the stemming algorithm
This is a textfile that contains per line
word\tstem, i.e: two tab seperated words
try {
stemdict = org.apache.lucene.analysis.WordlistLoader.getStemDict(stemdictFile);
} catch (IOException e) {
// TODO: throw IOException
throw new RuntimeException(e);
}
| 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.
try {
excltable = org.apache.lucene.analysis.WordlistLoader.getWordSet(exclusionlist);
} catch (IOException e) {
// TODO: throw IOException
throw new RuntimeException(e);
}
| 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;
|
|