FileDocCategorySizeDatePackage
GermanAnalyzer.javaAPI DocApache Lucene 2.1.04488Wed Feb 14 10:46:28 GMT 2007org.apache.lucene.analysis.de

GermanAnalyzer

public class GermanAnalyzer extends Analyzer
Analyzer for German language. Supports an external list of stopwords (words that will not be indexed at all) and an external list of exclusions (word that will not be stemmed, but indexed). A default set of stopwords is used unless an alternative list is specified, the exclusion list is empty by default.
author
Gerhard Schwarz
version
$Id: GermanAnalyzer.java 472959 2006-11-09 16:21:50Z yonik $

Fields Summary
public static final String[]
GERMAN_STOP_WORDS
List of typical german stopwords.
private Set
stopSet
Contains the stopwords used with the StopFilter.
private Set
exclusionSet
Contains words that should be indexed but not stemmed.
Constructors Summary
public GermanAnalyzer()
Builds an analyzer with the default stop words (GERMAN_STOP_WORDS).


              
    
    stopSet = StopFilter.makeStopSet(GERMAN_STOP_WORDS);
  
public GermanAnalyzer(String[] stopwords)
Builds an analyzer with the given stop words.

    stopSet = StopFilter.makeStopSet(stopwords);
  
public GermanAnalyzer(Hashtable stopwords)
Builds an analyzer with the given stop words.

    stopSet = new HashSet(stopwords.keySet());
  
public GermanAnalyzer(File stopwords)
Builds an analyzer with the given stop words.

    stopSet = WordlistLoader.getWordSet(stopwords);
  
Methods Summary
public voidsetStemExclusionTable(java.lang.String[] exclusionlist)
Builds an exclusionlist from an array of Strings.

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

    exclusionSet = new HashSet(exclusionlist.keySet());
  
public voidsetStemExclusionTable(java.io.File exclusionlist)
Builds an exclusionlist from the words contained in the given file.

    exclusionSet = WordlistLoader.getWordSet(exclusionlist);
  
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 Reader.

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

    TokenStream result = new StandardTokenizer(reader);
    result = new StandardFilter(result);
    result = new LowerCaseFilter(result);
    result = new StopFilter(result, stopSet);
    result = new GermanStemFilter(result, exclusionSet);
    return result;