Пример #1
0
        public void TestExtractSingleLongTerm()
        {
            var nounPhrases = nounPhraseExtractor.Extract("The lovely red ironed rectangular Swiss flag.");
            Dictionary <string, ISet <string> > expectedNounPhrases = new Dictionary <string, ISet <string> >();

            Assert.IsTrue(Comparators.DictionariesOfSetsAreEqual(expectedNounPhrases, nounPhrases));
        }
Пример #2
0
        public void TestExtractSingleShortWord()
        {
            var nounPhrases = nounPhraseExtractor.Extract("There is a P.");
            Dictionary <string, ISet <string> > expectedNounPhrases = new Dictionary <string, ISet <string> >();

            Assert.IsTrue(Comparators.DictionariesOfSetsAreEqual(expectedNounPhrases, nounPhrases));
        }
Пример #3
0
        public void TestExtractSingle()
        {
            var nounPhrases = nounPhraseExtractor.Extract("A large red flag fluttered.");
            Dictionary <string, ISet <string> > expectedNounPhrases = new Dictionary <string, ISet <string> >();
            ISet <string> variants = new HashSet <string>();

            variants.Add("large red flag");
            expectedNounPhrases.Add("large red flag", variants);
            Assert.IsTrue(Comparators.DictionariesOfSetsAreEqual(expectedNounPhrases, nounPhrases));
        }
Пример #4
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));
        }
Пример #5
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));
        }
Пример #6
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));
        }
Пример #7
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));
        }