0f36f4aae8fbdd387a34a88d5e270716d987559e,nltk/sentiment/vader.py,SentimentIntensityAnalyzer,_in_spite_of_check,#SentimentIntensityAnalyzer#Any#Any#,508
Before Change
def _in_spite_of_check(self, words_and_emoticons, sentiments):
words_and_emoticons_lower = [str(w).lower() for w in words_and_emoticons]
check = "in"
if check in words_and_emoticons_lower:
i = words_and_emoticons_lower.index(check)
if len(words_and_emoticons)>i+2 and "spite" == words_and_emoticons_lower[i+1] and "of" == words_and_emoticons_lower[i+2]:
for si, sentiment in enumerate(sentiments):
if si == i+1:
sentiments[si] = 0
elif si < i+1:
sentiments[si] = sentiment * 1.5
elif si > i+1:
sentiments[si] = sentiment * 0.5
return sentiments
def _idioms_check(self, valence, words_and_emoticons, i):
onezero = "{0} {1}".format(words_and_emoticons[i - 1], words_and_emoticons[i])
After Change
Not used in default VADER algorithm.
Extension from https://github.com/nltk/nltk/pull/2307
for idx, ng in enumerate(ngrams(words_and_emoticons, 3)) :
if ng == ("in", "spite", "of") :
for sidx, sentiment in enumerate(sentiments):
if sidx == idx+1:
sentiments[sidx] = 0
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances Project Name: nltk/nltk
Commit Name: 0f36f4aae8fbdd387a34a88d5e270716d987559e
Time: 2019-09-02
Author: alvations@gmail.com
File Name: nltk/sentiment/vader.py
Class Name: SentimentIntensityAnalyzer
Method Name: _in_spite_of_check
Project Name: RasaHQ/rasa
Commit Name: 02d4785a9a4f96ee5a93a0426a4fcfeba22ae8de
Time: 2018-09-12
Author: mr.voov@gmail.com
File Name: rasa_core/policies/ensemble.py
Class Name: SimplePolicyEnsemble
Method Name: probabilities_using_best_policy
Project Name: nltk/nltk
Commit Name: 0f36f4aae8fbdd387a34a88d5e270716d987559e
Time: 2019-09-02
Author: alvations@gmail.com
File Name: nltk/sentiment/vader.py
Class Name: SentimentIntensityAnalyzer
Method Name: _only_if_check