Text frenchsnowballstemmer stem - CyrilB1531/lodestar GitHub Wiki

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

HomeTextStemming

FrenchSnowballStemmer.Stem

The Snowball stem of one French word.

public static string Stem(string word)

Parametersword is a single French word. It is lowercased and NFC-normalised before the rules run. A leading elision is removed, so l'avion stems like avion.

Returnsstring, the stem, always lowercase. Accented characters survive when the stem keeps them. The last step un-accents an é or è only when a non-vowel follows it, so thé stays thé while père becomes per. A first letter is un-accented too, so ès becomes es, where nltk keeps ès.

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

Example — an adverb reduced to its root, and two forms of one verb meeting.

using Lodestar.Text.Stemming;

string adverb = FrenchSnowballStemmer.Stem("amoureusement");  // => amour
string infinitive = FrenchSnowballStemmer.Stem("finir");  // => fin
string participle = FrenchSnowballStemmer.Stem("finissant");  // => fin

Remarksamoureusement losing both -ement and -eux in one pass shows the step ordering doing its work: the adverbial suffix goes first, and what it uncovers is then eligible for the next rule. This is why the steps are conditional on each other rather than independent.

Aggressive is the right word for the result. continuellement reduces to continuel, and verbs of the second group lose most of their length. That is appropriate for an index and wrong for anything shown to a reader.

Applies to — net10.0, netstandard2.0.

See alsoFrenchSnowballStemmer, the stemming index.