java.lang.Object
org.apache.lucene.analysis.de.GermanStemmer

public class GermanStemmer extends Object
A stemmer for German words.

The algorithm is based on the report "A Fast and Simple Stemming Algorithm for German Words" by Jörg Caumanns (joerg.caumanns at isst.fhg.de).

  • Field Details

    • sb

      private StringBuilder sb
      Buffer for the terms while stemming them.
    • substCount

      private int substCount
      Amount of characters that are removed with substitute() while stemming.
    • locale

      private static final Locale locale
  • Constructor Details

    • GermanStemmer

      public GermanStemmer()
  • Method Details

    • stem

      protected String stem(String term)
      Stemms the given term to an unique discriminator.
      Parameters:
      term - The term that should be stemmed.
      Returns:
      Discriminator for term
    • isStemmable

      private boolean isStemmable(String term)
      Checks if a term could be stemmed.
      Returns:
      true if, and only if, the given term consists in letters.
    • strip

      private void strip(StringBuilder buffer)
      suffix stripping (stemming) on the current term. The stripping is reduced to the seven "base" suffixes "e", "s", "n", "t", "em", "er" and * "nd", from which all regular suffixes are build of. The simplification causes some overstemming, and way more irregular stems, but still provides unique. discriminators in the most of those cases. The algorithm is context free, except of the length restrictions.
    • optimize

      private void optimize(StringBuilder buffer)
      Does some optimizations on the term. This optimisations are contextual.
    • removeParticleDenotion

      private void removeParticleDenotion(StringBuilder buffer)
      Removes a particle denotion ("ge") from a term.
    • substitute

      private void substitute(StringBuilder buffer)
      Do some substitutions for the term to reduce overstemming:

      - Substitute Umlauts with their corresponding vowel:äöü -> aou, "ß" is substituted by "ss" - Substitute a second char of a pair of equal characters with an asterisk: ?? -> ?* - Substitute some common character combinations with a token: sch/ch/ei/ie/ig/st -> $/§/%/&/#/!

    • resubstitute

      private void resubstitute(StringBuilder buffer)
      Undoes the changes made by substitute(). That are character pairs and character combinations. Umlauts will remain as their corresponding vowel, as "ß" remains as "ss".