FileDocCategorySizeDatePackage
DutchAnalyzer.javaAPI DocApache Lucene 2.1.05816Wed Feb 14 10:46:32 GMT 2007org.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}) 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.

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

    try {
      stoptable = org.apache.lucene.analysis.WordlistLoader.getWordSet(stopwords);
    } catch (IOException e) {
      // TODO: throw IOException
      throw new RuntimeException(e);
    }
  
Methods Summary
public voidsetStemDictionary(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 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.

    try {
      excltable = org.apache.lucene.analysis.WordlistLoader.getWordSet(exclusionlist);
    } catch (IOException e) {
      // TODO: throw IOException
      throw new RuntimeException(e);
    }
  
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;