public bool HasSameStem(StemInSentence o) { if (this.Stem == null || o?.Stem == null) { return(false); } return(this.Stem.Equals(o.Stem, StringComparison.InvariantCultureIgnoreCase)); }
public List <StemInSentence> GetStems(string text) { List <StemInSentence> result = new List <StemInSentence>(); if (string.IsNullOrEmpty(text)) { return(result); } text = text.Trim().ToLower(); //check if its multiwords string[] words = text.Split(Separators, StringSplitOptions.RemoveEmptyEntries); //List<string> stems = hunspellStem(text); for (int i = 0; i < words.Count(); i++) { string word = words[i]; if (Stemmer.StopWords.Contains(word) //|| word.Length < 2 ) { continue; } string sstem = Stemmer.Stem(word); StemInSentence s = null; if (!string.IsNullOrEmpty(sstem)) { s = new StemInSentence(sstem, i); } else { s = new StemInSentence(word, i); } result.Add(s); } return(result); }