public SentimentPredictions() { sc = new SpectralClustering(); List <List <int> > rawCommunities = sc.FindCommunities(); SentimentModel model = new SentimentModel(File.ReadAllText("brain.json")); reviews = ReadFriendshipReviewData.readFileAsReview("friendships.reviews.txt");//.Where(r => r != null).ToList(); for (int i = 0; i < reviews.Count; i++) { reviews[i] = model.AnalyseReview(reviews[i]); } int communityIndex = 0; foreach (List <int> community in rawCommunities) { foreach (int user in community) { reviews[user].community = communityIndex; } communityIndex++; } foreach (Review user in reviews.Where(u => u.sentiment == Review.Sentiment.blank)) { PredictSentiment(user); } }
private static void FindCommunities() { SpectralClustering sc = new SpectralClustering(); foreach (List <int> community in sc.FindCommunities()) { Console.WriteLine(community.Count); } }