public void TestAddMatch()
        {
            wordsDataSource = new SimpleWordsDataSource();
            wordsDataSource.AddMatch("myWord");
            WordProbability wp = wordsDataSource.GetWordProbability("myWord");
            Assert.IsNotNull(wp);
            Assert.AreEqual(1, wp.MatchingCount);
            Assert.AreEqual(0, wp.NonMatchingCount);

            wordsDataSource.AddMatch("myWord");

            Assert.AreEqual(2, wp.MatchingCount);
            Assert.AreEqual(0, wp.NonMatchingCount);
        }
Пример #2
0
        public void TestAddMatch()
        {
            wordsDataSource = new SimpleWordsDataSource();
            wordsDataSource.AddMatch("myWord");
            WordProbability wp = wordsDataSource.GetWordProbability("myWord");

            Assert.IsNotNull(wp);
            Assert.AreEqual(1, wp.MatchingCount);
            Assert.AreEqual(0, wp.NonMatchingCount);

            wordsDataSource.AddMatch("myWord");

            Assert.AreEqual(2, wp.MatchingCount);
            Assert.AreEqual(0, wp.NonMatchingCount);
        }
 public void TestAddMultipleMatches()
 {
     wordsDataSource = new SimpleWordsDataSource();
     string word = "myWord";
     int count = 10;
     for (int i = 0; i < count; i++)
         wordsDataSource.AddMatch(word);
     WordProbability wp = wordsDataSource.GetWordProbability(word);
     Assert.IsNotNull(wp);
     Assert.AreEqual(count, wp.MatchingCount);
 }
Пример #4
0
        public void TestAddMultipleMatches()
        {
            wordsDataSource = new SimpleWordsDataSource();
            string word  = "myWord";
            int    count = 10;

            for (int i = 0; i < count; i++)
            {
                wordsDataSource.AddMatch(word);
            }
            WordProbability wp = wordsDataSource.GetWordProbability(word);

            Assert.IsNotNull(wp);
            Assert.AreEqual(count, wp.MatchingCount);
        }
Пример #5
0
        public void TeachMatch(string category, string[] words)
        {
            var categorizedWordsDataSource = _wordsData as ICategorizedWordsDataSource;

            for (var i = 0; i < words.Length; i++)
            {
                if (IsClassifiableWord(words[i]))
                {
                    if (categorizedWordsDataSource == null)
                    {
                        _wordsData.AddMatch(TransformWord(words[i]));
                    }
                    else
                    {
                        categorizedWordsDataSource.AddMatch(category, TransformWord(words[i]));
                    }
                }
            }
        }
Пример #6
0
        public void TeachMatch(string category, string[] words)
        {
            bool categorize = false;

            if (_wordsData is ICategorizedWordsDataSource)
            {
                categorize = true;
            }
            for (int i = 0; i <= words.Length - 1; i++)
            {
                if (IsClassifiableWord(words[i]))
                {
                    if (categorize)
                    {
                        ((ICategorizedWordsDataSource)_wordsData).AddMatch(category, TransformWord(words[i]));
                    }
                    else
                    {
                        _wordsData.AddMatch(TransformWord(words[i]));
                    }
                }
            }
        }