예제 #1
0
        private static void TestFeeds(FeedService feedService)
        {
            List <Feed> feeds = feedService.GetFeeds();

            BagOfWords bag1 = feedService.AnalyzeFeed(feeds[0]);
            BagOfWords bag2 = feedService.AnalyzeFeed(feeds[1]);
            BagOfWords bag3 = feedService.AnalyzeFeed(feeds[2]);
            BagOfWords bag4 = feedService.AnalyzeFeed(feeds[3]);

            List <string> commonLabels = feedService.CompareBags(bag1, bag2);

            OutputCommonLabels(bag1, bag2, commonLabels);

            commonLabels = feedService.CompareBags(bag1, bag3);
            OutputCommonLabels(bag1, bag3, commonLabels);

            commonLabels = feedService.CompareBags(bag1, bag4);
            OutputCommonLabels(bag1, bag4, commonLabels);

            commonLabels = feedService.CompareBags(bag2, bag3);
            OutputCommonLabels(bag2, bag3, commonLabels);

            commonLabels = feedService.CompareBags(bag2, bag4);
            OutputCommonLabels(bag2, bag4, commonLabels);

            commonLabels = feedService.CompareBags(bag3, bag4);
            OutputCommonLabels(bag3, bag4, commonLabels);

            double similarity = feedService.CalculateSimilarity(bag1, bag2, true);

            OutputSimilarity(bag1, bag2, similarity);

            similarity = feedService.CalculateSimilarity(bag1, bag3, true);
            OutputSimilarity(bag1, bag3, similarity);

            similarity = feedService.CalculateSimilarity(bag1, bag4, true);
            OutputSimilarity(bag1, bag4, similarity);

            similarity = feedService.CalculateSimilarity(bag2, bag3, true);
            OutputSimilarity(bag2, bag3, similarity);

            similarity = feedService.CalculateSimilarity(bag2, bag4, true);
            OutputSimilarity(bag2, bag4, similarity);

            similarity = feedService.CalculateSimilarity(bag3, bag4, true);
            OutputSimilarity(bag3, bag4, similarity);

            //Clustering cluster = new Clustering();
            //cluster.Clusterize(items);
        }