Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        private static void Analyse()
        {
            SentimentModel model   = new SentimentModel(File.ReadAllText("brain.json"));
            List <Review>  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]);
            }
            reviews = reviews.Where(r => r.sentiment != Review.Sentiment.blank).ToList();
        }