Text 0.5.0 italiansnowballstemmer stem - CyrilB1531/lodestar GitHub Wiki

Lodestar.Text 0.5.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

ItalianSnowballStemmer.Stem

The Snowball stem of one Italian word.

public static string Stem(string word)

Parameters β€” word is a single Italian word. It is lowercased and NFC-normalised before the rules run.

Returns β€” string, the stem, always lowercase.

Exceptions β€” ArgumentNullException when word is null. An empty string, or a word of one character, is returned lowercased and otherwise untouched.

Example β€” a stressed final vowel written both ways, and the divergence worth knowing about.

using Lodestar.Text.Stemming;

string accented = ItalianSnowballStemmer.Stem("attivitΓ ");  // => attiv
string plain = ItalianSnowballStemmer.Stem("attivita");  // => attiv
string diverging = ItalianSnowballStemmer.Stem("esistenza");  // => esistt

Remarks β€” esistt is not a typo and not a bug. It is what nltk returns, and matching nltk is what this package is checked against; the published algorithm would give esistent. The reasoning is in decisions/0008, and the practical consequence is that the stem is still a usable key β€” every enza/enze word the rule reaches is transformed the same way β€” while being unreadable.

The rule only fires inside R2. pazienza keeps its suffix and stems to pazienz, which is why the two words with the same ending come out looking unrelated.

Applies to β€” net10.0, netstandard2.0.

See also β€” ItalianSnowballStemmer, the stemming index.