Class SnowballStemmer
A IStemmer backed by one of the Snowball stemming algorithms.
public class SnowballStemmer : IStemmer
- Inheritance
-
SnowballStemmer
- Implements
- Inherited Members
Remarks
The stemmers behind this class are generated by the Snowball compiler from the same algorithm sources Apache OpenNLP generates its Java ones from, pinned to Snowball 2.0.0. Seventeen of the twenty-one produce output identical to OpenNLP 1.9.4 over the full Snowball vocabularies.
FINNISH, HUNGARIAN, FRENCH and INDONESIAN differ, on 0.4% to 6% of words, because OpenNLP ships generated code predating several upstream Snowball fixes and the sources behind it survive at no revision that can be pinned. In each case the difference is the fix: OpenNLP's Finnish gives one noun four different stems, its Hungarian leaves the ablative and delative case suffixes unstripped, and its Indonesian strips a final -i that belongs to the root of loanwords such asdemokrasi. See
build/generate-snowball-stemmers.ps1 for the measurements and the reasoning.
Constructors
SnowballStemmer(ALGORITHM)
Creates a stemmer for the given algorithm, applying it once.
public SnowballStemmer(ALGORITHM algorithm)
Parameters
algorithmALGORITHM
SnowballStemmer(ALGORITHM, int)
Creates a stemmer for the given algorithm, applying it repeat times.
public SnowballStemmer(ALGORITHM algorithm, int repeat)
Parameters
Exceptions
- ArgumentException
Thrown when
algorithmis not a known algorithm.
Methods
Stem(string)
public string Stem(string word)
Parameters
wordstring