Skip to content

Text germansnowballstemmer stem

github-actions[bot] edited this page Aug 26, 2026 · 24 revisions

Development build. This page describes main, not a released package. The latest published Lodestar.Text is 0.4.0 — read its documentation.

GermanSnowballStemmer.Stem

The Snowball stem of one German word.

public static string Stem(string word)

Parametersword is a single German word. It is lowercased and NFC-normalised before the rules run, which matters more here than elsewhere: German nouns are capitalised in ordinary text, so most input arrives needing it.

Returnsstring, the stem, always lowercase; the final step folds umlauts to their base vowel.

ExceptionsArgumentNullException when word is null. An empty string, or a word of one character, is returned lowercased and otherwise untouched.

Example — the two spellings of ß meeting, and an umlaut removed on the way out.

using Lodestar.Text.Stemming;

string sharp = GermanSnowballStemmer.Stem("straße");  // => strass
string spelled = GermanSnowballStemmer.Stem("strasse");  // => strass
string umlaut = GermanSnowballStemmer.Stem("größe");  // => gross

Remarksgrößegross is the result most likely to look like a bug. It is two substitutions, both deliberate: ßss before the rules, öo after them. The stem is a key, and it is the same key grosse produces, which is the whole intent.

Because umlauts are stripped last rather than first, a word whose suffix rule depends on ä or ü still sees it while the decision is being made. Folding them up front would change which suffixes match, and give different stems.

Applies to — net10.0, netstandard2.0.

See alsoGermanSnowballStemmer, the stemming index.

Lodestar

Project

Clone this wiki locally