コード例 #1
0
ファイル: Grader.cs プロジェクト: Sojaner/OpenTextSummarizer
        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++;
                    }
                }
            }
        }
コード例 #2
0
ファイル: Article.cs プロジェクト: Sojaner/OpenTextSummarizer
        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++;
            }
        }
コード例 #3
0
ファイル: Article.cs プロジェクト: cosmin19/text-classifier
        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++;
            }
        }