public void TestSentimentExceptionGetScoreOrLabelOnNotProcessed()
        {
            var message = new SentimentMessage(new Lorem("it").Sentence(3));

            Assert.Throws <Exception>(() => { message.GetScore(); });
            Assert.Throws <Exception>(() => { message.GetSentimentLabel(); });
        }
 public void AddMessage(SentimentMessage message)
 {
     _historyMessage.Add(message);
     if (_historyMessage.Count > _historyLimit)
     {
         _historyMessage.RemoveAt(0);
     }
 }
Пример #3
0
        private void Thischannel_OnChannelChatMessage(RTChatMessage chat)
        {
            chat.CalulateSentiment();
            // chat.Sentiment
            var message = new SentimentMessage()
            {
                sentimentvalue = (float)chat.Sentiment
            };

            if (overlayModule != null)
            {
                overlayModule.SendModuleMessage("sentimenticon", "currentsentiment", JsonConvert.SerializeObject(message));
            }
        }
Пример #4
0
        /// <summary>
        /// Add a new message to history.
        /// </summary>
        public bool AddMessage(string message)
        {
            if (message.Length < _discardLowerThanChar)
            {
                return(false);
            }

            try
            {
                var processedMessage = new SentimentMessage(message);
                processedMessage.Process(_processor);

                _history.AddMessage(processedMessage);

                return(true);
            } catch (Exception e)
            {
                // rethrow exception up
                throw new Exception("Error during message processing", e);
            }
        }
Пример #5
0
 /// <summary>
 /// Return TextSentiment representation of averaged SentimentScore calculated against Current History.
 /// </summary>
 public TextSentiment GetSentimentAverageLabel()
 {
     return(SentimentMessage.GetRankedLabel(GetSentimentAverage()));
 }