private static void GradeSentences(Article article) { foreach (Sentence sentence in article.Sentences) { foreach (Word word in sentence.Words) { string wordstem = Stemmer.StemStrip(word.Value, article.Rules); Word importantWord = article.ImportantWords.Find(match => match.Stem == wordstem); if (importantWord != null) { sentence.Score++; } } } }
private void AddWordCount(string word) { Word stemmedWord = Stemmer.StemWord(word, Rules); if (string.IsNullOrEmpty(word) || word == " " || word == "\n" || word == "\t") { return; } Word foundWord = WordCounts.Find(match => match.Stem == stemmedWord.Stem); if (foundWord == null) { WordCounts.Add(stemmedWord); } else { foundWord.TermFrequency++; } }
private void AddWordCount(string word) { Word stemmedWord = Stemmer.StemWord(word, this.Rules); if (word == null || word == string.Empty || word == " " || word == "\n" || word == "\t") { return; } Word foundWord = WordCounts.Find(delegate(Word match) { return(match.Stem == stemmedWord.Stem); }); if (foundWord == null) { WordCounts.Add(stemmedWord); } else { foundWord.TermFrequency++; } }