Example #1
0
        public Dictionary <string, double> CalculateAverageSentiments(Dictionary <string, List <Tweet> > tweetsByState)
        {
            Dictionary <string, double> averageSetntiments = new Dictionary <string, double>();

            foreach (KeyValuePair <string, List <Tweet> > tweetsState in tweetsByState)
            {
                double averageSentimentWeight = 0;
                Dictionary <string, double> tweetSentiment = tweetService.AnalizeTweetSentiment(tweetsState.Value);
                foreach (KeyValuePair <string, double> valuePair in tweetSentiment)
                {
                    averageSentimentWeight += valuePair.Value / tweetSentiment.Count;
                }
                averageSetntiments.Add(tweetsState.Key, averageSentimentWeight);
            }
            return(averageSetntiments);
        }