public IEnumerable<HunspellStem> Stem(String word) { if (word == null) throw new ArgumentNullException("word"); var stems = new List<HunspellStem>(); if (_dictionary.LookupWord(word) != null) stems.Add(new HunspellStem(word)); stems.AddRange(Stem(word, null, 0)); return stems; }
public void TestStem_fietsenFiets_NlNL() { var dictionary = HunspellDictionaryLoader.Dictionary("nl_NL"); var stemmer = new HunspellStemmer(dictionary); var stems = stemmer.Stem("fietsen").ToList(); Assert.AreEqual(2, stems.Count); Assert.AreEqual("fietsen", stems[0].Stem); Assert.AreEqual("fiets", stems[1].Stem); stems = stemmer.Stem("fiets").ToList(); Assert.AreEqual(1, stems.Count); Assert.AreEqual("fiets", stems[0].Stem); }