Skip to content
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
2 changes: 1 addition & 1 deletion vaderSentiment/vaderSentiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def sentiment_valence(self, valence, sentitext, item, i, sentiments):
valence = self.lexicon[item_lowercase]

# check for "no" as negation for an adjacent lexicon item vs "no" as its own stand-alone lexicon item
if item_lowercase == "no" and words_and_emoticons[i + 1].lower() in self.lexicon:
if item_lowercase == "no" and i != len(words_and_emoticons)-1 and words_and_emoticons[i + 1].lower() in self.lexicon:
# don't use valence of "no" as a lexicon item. Instead set it's valence to 0.0 and negate the next item
valence = 0.0
if (i > 0 and words_and_emoticons[i - 1].lower() == "no") \
Expand Down