Пример #1
0
        public void TestExtract()
        {
            var kp = new KeywordProcessor();

            kp.AddKeywords(new [] { "Big Apple", "Bay Area" });
            var keywords = kp.ExtractKeywords("I love Big Apple and Bay Area.");
            var expected = new List <string> {
                "Big Apple", "Bay Area"
            };

            CollectionAssert.AreEqual(expected, keywords);
        }
Пример #2
0
        public void TestRemoveKeyword()
        {
            var kp = new KeywordProcessor();

            kp.AddKeyword(".net core");
            kp.AddKeyword("C# 8.0");
            kp.AddKeywords(new [] { "C# 7.0", "C# 8.0" });

            var keywords = kp.ExtractKeywords("I am learning .net core and c# 8.0");
            var expected = new List <string> {
                ".net core", "C# 8.0"
            };

            CollectionAssert.AreEqual(expected, keywords);

            Assert.That(kp.Contains("C# 8.0"), Is.True);
            kp.RemoveKeyword("C# 8.0");
            Assert.That(kp.Contains("C# 8.0"), Is.False);
            keywords = kp.ExtractKeywords("I am learning .net core and c# 8.0");
            expected = new List <string> {
                ".net core"
            };
            CollectionAssert.AreEqual(expected, keywords);
        }