Пример #1
0
        public List <ITFIDFWord> GetTFIDFWords(List <IToken> tokens, int countSentences)
        {
            var words = this.GetWords(tokens);

            return(words.Select(w =>
                                TFIDFWord.CreateFromWord(w, countSentences) as ITFIDFWord)
                   .ToList());
        }
Пример #2
0
        public void CreateFromWordCtor()
        {
            string value          = "слово";
            int    position       = 22;
            int    orderNumber    = 3;
            Word   word           = new Word(value, position, orderNumber);
            int    countSentences = 33;

            ITFIDFWord tFIDFWord = TFIDFWord.CreateFromWord(word, countSentences);

            Assert.IsInstanceOfType(tFIDFWord, typeof(TFIDFWord));
            Assert.IsTrue(tFIDFWord.TermFrequency > 0);
            Assert.IsTrue(tFIDFWord.InverseDocumentFrequency > 0);
            Assert.IsTrue(tFIDFWord.TFIDF > 0);
        }