Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed handling of capitalized words for negation check #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions VaderSharp/VaderSharp/SentimentIntensityAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private double NeverCheck(double valence, IList<string> wordsAndEmoticons, int s
{
if (startI == 0)
{
if (SentimentUtils.Negated(new List<string> {wordsAndEmoticons[i - 1]}))
if (SentimentUtils.Negated(new List<string> {wordsAndEmoticons[i - 1].ToLower()}))
valence = valence * SentimentUtils.NScalar;
}
if (startI == 1)
Expand All @@ -185,7 +185,7 @@ private double NeverCheck(double valence, IList<string> wordsAndEmoticons, int s
{
valence = valence * 1.5;
}
else if (SentimentUtils.Negated(new List<string> {wordsAndEmoticons[i - (startI + 1)]}))
else if (SentimentUtils.Negated(new List<string> {wordsAndEmoticons[i - (startI + 1)].ToLower()}))
{
valence = valence * SentimentUtils.NScalar;
}
Expand All @@ -198,7 +198,7 @@ private double NeverCheck(double valence, IList<string> wordsAndEmoticons, int s
{
valence = valence * 1.25;
}
else if (SentimentUtils.Negated(new List<string> { wordsAndEmoticons[i - (startI + 1)] }))
else if (SentimentUtils.Negated(new List<string> { wordsAndEmoticons[i - (startI + 1)].ToLower() }))
{
valence = valence * SentimentUtils.NScalar;
}
Expand Down