Esempio n. 1
0
        public void TestExtractMultipleVariants()
        {
            var nounPhrases = nounPhraseExtractor.Extract("Dogs are looking at dogs but not at a dog.");

            Comparators.PrintDictionaryOfSets(nounPhrases);
            Dictionary <string, ISet <string> > expectedNounPhrases = new Dictionary <string, ISet <string> >();
            ISet <string> variants = new HashSet <string>();

            variants.Add("Dogs");
            variants.Add("dogs");
            variants.Add("dog");
            expectedNounPhrases.Add("dog", variants);
            Assert.IsTrue(Comparators.DictionariesOfSetsAreEqual(expectedNounPhrases, nounPhrases));
        }
Esempio n. 2
0
        public void TestExtractMultipleVariantsNumber()
        {
            var nounPhrases = nounPhraseExtractor.Extract("There are 12 dogs. A dog can't be seen.");

            Comparators.PrintDictionaryOfSets(nounPhrases);
            Dictionary <string, ISet <string> > expectedNounPhrases = new Dictionary <string, ISet <string> >();
            ISet <string> variants = new HashSet <string>();

            // NOTE there is a TODO in the code to fix this problem
            //variants.Add("dogs");
            variants.Add("dog");
            expectedNounPhrases.Add("dog", variants);
            Assert.IsTrue(Comparators.DictionariesOfSetsAreEqual(expectedNounPhrases, nounPhrases));
        }
Esempio n. 3
0
        public void TestExtractMultipleVariantsIrregular()
        {
            var nounPhrases = nounPhraseExtractor.Extract("Wolves are looking at wolves but not at a wolf.");

            Comparators.PrintDictionaryOfSets(nounPhrases);
            Dictionary <string, ISet <string> > expectedNounPhrases = new Dictionary <string, ISet <string> >();
            ISet <string> variants = new HashSet <string>();

            // NOTE there is a TODO in the code to fix this problem
            //variants.Add("Wolves");
            //variants.Add("wolves");
            variants.Add("wolf");
            expectedNounPhrases.Add("wolf", variants);
            Assert.IsTrue(Comparators.DictionariesOfSetsAreEqual(expectedNounPhrases, nounPhrases));
        }
Esempio n. 4
0
        public void TestExtractWithConjunction()
        {
            var nounPhrases = nounPhraseExtractor.Extract("The red and flat flag.");

            Comparators.PrintDictionaryOfSets(nounPhrases);
            Dictionary <string, ISet <string> > expectedNounPhrases = new Dictionary <string, ISet <string> >();

            ISet <string> variants = new HashSet <string>();

            variants.Add("red");
            expectedNounPhrases.Add("red", variants);

            ISet <string> variants2 = new HashSet <string>();

            variants2.Add("flat flag");
            expectedNounPhrases.Add("flat flag", variants2);

            ISet <string> variants3 = new HashSet <string>();

            variants3.Add("red and flat flag");
            expectedNounPhrases.Add("red and flat flag", variants3);

            Assert.IsTrue(Comparators.DictionariesOfSetsAreEqual(expectedNounPhrases, nounPhrases));
        }