/// <summary> /// Analyzes the specified phrase. /// </summary> /// <param name="phrase">The phrase.</param> /// <returns></returns> public SentimentalInfo Analyze(string phrase) { string str = Util.ToUnicode(phrase); SentenceInfo pos = this.Positivity(str); SentenceInfo neg = this.Negativity(str); SentimentalInfo result = new SentimentalInfo(); result.Positives = pos; result.Negatives = neg; result.Score = decimal.Divide((pos.Score - neg.Score), 10); result.Comparative = decimal.Divide(pos.Comparative - neg.Comparative, 10); result.Comparative = Math.Round(result.Comparative, 2, MidpointRounding.ToEven); return result; }
/// <summary> /// Analyzes the specified phrase. /// </summary> /// <param name="phrase">The phrase.</param> /// <returns></returns> public SentimentalInfo Analyze(string phrase) { string str = Util.ToUnicode(phrase); SentenceInfo pos = this.Positivity(str); SentenceInfo neg = this.Negativity(str); SentimentalInfo result = new SentimentalInfo(); result.Positives = pos; result.Negatives = neg; result.Score = decimal.Divide((pos.Score - neg.Score), 10); result.Comparative = decimal.Divide(pos.Comparative - neg.Comparative, 10); result.Comparative = Math.Round(result.Comparative, 2, MidpointRounding.ToEven); return(result); }