Beispiel #1
0
        public void TestSentimentAbsoluteLabelMaxNegative()
        {
            var processor = new MockSentimentProcessorPredefinedScore
            {
                scores = new[]
                {
                    new SentimentScore {
                        Positive = 0, Negative = 1, Neutral = 0
                    },
                    new SentimentScore {
                        Positive = 0, Negative = 1, Neutral = 0
                    },
                    new SentimentScore {
                        Positive = 0, Negative = 1, Neutral = 0
                    },
                    new SentimentScore {
                        Positive = 0, Negative = 1, Neutral = 0
                    },
                    new SentimentScore {
                        Positive = 0, Negative = 1, Neutral = 0
                    }
                }
            };

            var sentiment = new SonequaBot.Sentiment.Sentiment(processor);

            for (var x = 0; x < 5; x++)
            {
                sentiment.AddMessage(new Lorem("it").Sentence(3));
            }

            Assert.Equal("Abysmal", sentiment.GetSentimentAbsoluteLabel());
        }
Beispiel #2
0
        public void TestSentimentAverageValue()
        {
            var processor = new MockSentimentProcessorPredefinedScore
            {
                scores = new[]
                {
                    new SentimentScore
                    {
                        Positive = 1,
                        Negative = 0,
                        Neutral  = 0
                    },
                    new SentimentScore
                    {
                        Positive = 0,
                        Negative = 0,
                        Neutral  = 0
                    },
                    new SentimentScore
                    {
                        Positive = 0,
                        Negative = 0,
                        Neutral  = 0
                    },
                    new SentimentScore
                    {
                        Positive = 1,
                        Negative = 0,
                        Neutral  = 0
                    }
                }
            };

            var sentiment = new SonequaBot.Sentiment.Sentiment(processor);

            for (var x = 0; x < 4; x++)
            {
                sentiment.AddMessage(new Lorem("it").Sentence(3));
            }

            Assert.Equal(.5, sentiment.GetSentimentAverage().Positive);
            Assert.Equal(0, sentiment.GetSentimentAverage().Negative);
            Assert.Equal(0, sentiment.GetSentimentAverage().Neutral);
        }