0f36f4aae8fbdd387a34a88d5e270716d987559e,nltk/sentiment/vader.py,SentimentIntensityAnalyzer,_in_spite_of_check,#SentimentIntensityAnalyzer#Any#Any#,508

Before Change


        return sentiments

    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):

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
                    elif sidx < idx+1:
                        sentiments[sidx] = sentiment * 1.5
                    elif sidx > idx+1:
                        sentiments[sidx] = 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])
Italian Trulli
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: 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


Project Name: lingpy/lingpy
Commit Name: 4560e7769fc21e04c5f673f0549de6601d43de45
Time: 2013-09-09
Author: mattis.list@posteo.de
File Name: setup.py
Class Name:
Method Name: