コード例 #1
0
        private SentimentValue ResolveSentiment()
        {
            var sentimentValue = handler?.MeasureSentiment(Owner);

            if (Owner.IsInvertor &&
                !Owner.IsUsedInSentiment())
            {
                if (handler?.Context.DisableFeatureSentiment == true)
                {
                    return(null);
                }

                // is something inverted, but unknown to us
                if (sentimentValue != null)
                {
                    return(sentimentValue);
                }

                return(SentimentValue.CreateInvertor(Owner));
            }

            if (sentimentValue == null)
            {
                return(null);
            }

            sentimentValue = new SentimentCalculator(sentimentValue).Calculate();
            return(sentimentValue);
        }
コード例 #2
0
        public static bool IsSentiment(this IContextWordsHandler instance, IWordItem word)
        {
            SentimentValue sentiment = instance.MeasureSentiment(word);

            return(sentiment != null);
        }