From d6257352c2f8d56ab1052cf6321bafc06ecdac3f Mon Sep 17 00:00:00 2001 From: "fbe2@kth.se" Date: Fri, 29 Oct 2021 18:40:18 +0200 Subject: [PATCH] Fixed handling of capitalized words for negation check --- VaderSharp/VaderSharp/SentimentIntensityAnalyzer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VaderSharp/VaderSharp/SentimentIntensityAnalyzer.cs b/VaderSharp/VaderSharp/SentimentIntensityAnalyzer.cs index 5348976..c9f9aa8 100644 --- a/VaderSharp/VaderSharp/SentimentIntensityAnalyzer.cs +++ b/VaderSharp/VaderSharp/SentimentIntensityAnalyzer.cs @@ -175,7 +175,7 @@ private double NeverCheck(double valence, IList wordsAndEmoticons, int s { if (startI == 0) { - if (SentimentUtils.Negated(new List {wordsAndEmoticons[i - 1]})) + if (SentimentUtils.Negated(new List {wordsAndEmoticons[i - 1].ToLower()})) valence = valence * SentimentUtils.NScalar; } if (startI == 1) @@ -185,7 +185,7 @@ private double NeverCheck(double valence, IList wordsAndEmoticons, int s { valence = valence * 1.5; } - else if (SentimentUtils.Negated(new List {wordsAndEmoticons[i - (startI + 1)]})) + else if (SentimentUtils.Negated(new List {wordsAndEmoticons[i - (startI + 1)].ToLower()})) { valence = valence * SentimentUtils.NScalar; } @@ -198,7 +198,7 @@ private double NeverCheck(double valence, IList wordsAndEmoticons, int s { valence = valence * 1.25; } - else if (SentimentUtils.Negated(new List { wordsAndEmoticons[i - (startI + 1)] })) + else if (SentimentUtils.Negated(new List { wordsAndEmoticons[i - (startI + 1)].ToLower() })) { valence = valence * SentimentUtils.NScalar; }