Пример #1
0
        public void TestInvertFragment()
        {
            InvertFragment fragment = new InvertFragment();

            fragment.AddDocument("http://www.iveely.com/1", "iveely,你最想知道什么?");
            fragment.AddDocument("http://www.iveely.com/2", "我可以告诉你互联网上的一切");
            fragment.AddDocument("http://www.iveely.com/3", "真的那么准么?");
            fragment.AddDocument("http://www.iveely.com/4", "那是当然的!");
            List <string> commonDocs = new List <string>(fragment.FindCommonDocumentByKeys(new[] { "的" }, 10));

            Assert.IsTrue(commonDocs.Any());
        }
Пример #2
0
        public void Test_FindDocumentByKey()
        {
            var invert = new InvertFragment();

            invert.AddDocument(1, "今天天气真好");
            invert.AddDocument(2, "今天天气虽然很好,但是风大");
            invert.AddDocument(3, "天天就知道吃");
            invert.AddDocument(4, "爱是粉红的羽毛");
            invert.AddDocument(5, "雪白的羽毛");
            invert.AddDocument(6, "生活天很好");
            IList <string> result = invert.FindCommonDocumentByKeys(new[] { "爱", "风", "好" }, 10);

            Assert.IsTrue(result.Any());
        }