FileDocCategorySizeDatePackage
DutchAnalyzer.javaAPI DocApache Lucene 1.95122Mon Feb 20 09:19:02 GMT 2006org.apache.lucene.analysis.nl

DutchAnalyzer

public 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.
author
Edwin de Jonge

Fields Summary
public static final String[]
DUTCH_STOP_WORDS
List of typical Dutch stopwords.
private Set
stoptable
Contains the stopwords used with the StopFilter.
private Set
excltable
Contains 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.

param
stopwords

    stoptable = StopFilter.makeStopSet(stopwords);
  
public DutchAnalyzer(HashSet stopwords)
Builds an analyzer with the given stop words.

param
stopwords

    stoptable = stopwords;
  
public DutchAnalyzer(File stopwords)
Builds an analyzer with the given stop words.

param
stopwords

    stoptable = new HashSet(WordlistLoader.getWordtable(stopwords).keySet());
  
Methods Summary
public voidsetStemDictionary(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 voidsetStemExclusionTable(java.lang.String[] exclusionlist)
Builds an exclusionlist from an array of Strings.

param
exclusionlist

    excltable = StopFilter.makeStopSet(exclusionlist);
  
public voidsetStemExclusionTable(java.util.HashSet exclusionlist)
Builds an exclusionlist from a Hashtable.

    excltable = exclusionlist;
  
public voidsetStemExclusionTable(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.TokenStreamtokenStream(java.lang.String fieldName, java.io.Reader reader)
Creates a TokenStream which tokenizes all the text in the provided TextReader.

return
A TokenStream build from a StandardTokenizer filtered with StandardFilter, StopFilter, DutchStemFilter

    TokenStream result = new StandardTokenizer(reader);
    result = new StandardFilter(result);
    result = new StopFilter(result, stoptable);
    result = new DutchStemFilter(result, excltable, _stemdict);
    return result;