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

Before Change


        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

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

Non-data size: 6

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: explosion/spaCy
Commit Name: 6c221d4841126ae6e923b02df28c303bba5d3bd6
Time: 2020-12-08
Author: adrianeboyd@gmail.com
File Name: spacy/pipeline/entityruler.py
Class Name: EntityRuler
Method Name: add_patterns


Project Name: mindsdb/mindsdb
Commit Name: 7e0ec8394f8cf3faaf490a5c54816c945dcd067c
Time: 2018-08-31
Author: jorge.torres.maldonado@gmail.com
File Name: libs/helpers/norm_denorm_helpers.py
Class Name:
Method Name: denorm


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