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
14 changes: 4 additions & 10 deletions vaderSentiment/vaderSentiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
N_SCALAR = -0.74

NEGATE = \
["aint", "arent", "cannot", "cant", "couldnt", "darent", "didnt", "doesnt",
{"aint", "arent", "cannot", "cant", "couldnt", "darent", "didnt", "doesnt",
"ain't", "aren't", "can't", "couldn't", "daren't", "didn't", "doesn't",
"dont", "hadnt", "hasnt", "havent", "isnt", "mightnt", "mustnt", "neither",
"don't", "hadn't", "hasn't", "haven't", "isn't", "mightn't", "mustn't",
"neednt", "needn't", "never", "none", "nope", "nor", "not", "nothing", "nowhere",
"oughtnt", "shant", "shouldnt", "uhuh", "wasnt", "werent",
"oughtn't", "shan't", "shouldn't", "uh-uh", "wasn't", "weren't",
"without", "wont", "wouldnt", "won't", "wouldn't", "rarely", "seldom", "despite"]
"without", "wont", "wouldnt", "won't", "wouldn't", "rarely", "seldom", "despite"}

# booster/dampener 'intensifiers' or 'degree adverbs'
# http://en.wiktionary.org/wiki/Category:English_degree_adverbs
Expand Down Expand Up @@ -87,15 +87,9 @@ def negated(input_words, include_nt=True):
Determine if input contains negation words
"""
input_words = [str(w).lower() for w in input_words]
neg_words = []
neg_words.extend(NEGATE)
for word in neg_words:
if word in input_words:
for word in input_words:
if word in NEGATE or (include_nt and "n't" in word):
return True
if include_nt:
for word in input_words:
if "n't" in word:
return True
'''if "least" in input_words:
i = input_words.index("least")
if i > 0 and input_words[i - 1] != "at":
Expand Down