Closed haroonkn closed 4 years ago
Shall I create a branch to add a new line to check if its the last word?
(great find, thanks) updated line 287 to address this... does this close the issue you were having?
Thank you for the fixing, It works great now.
Hi! I think I´m having the same or related issue as haroonkn . I´m running the last version of vaderSentiment
~\anaconda3\lib\site-packages\vaderSentiment\vaderSentiment.py in sentiment_valence(self, valence, sentitext, item, i, sentiments) 288 valence = 0.0 289 if (i > 0 and words_and_emoticons[i - 1].lower() == "no") \ --> 290 or (i > 1 and words_and_emoticons[i - 2].lower() == "no") \ 291 or (i > 2 and words_and_emoticons[i - 3].lower() == "no" and words_and_emoticons[i - 1].lower() in ["or", "nor"] ): 292 valence = self.lexicon[item_lowercase] * N_SCALAR
IndexError: list index out of range
In vaderSentiment.py, line 287:
if item_lowercase == "no" and words_and_emoticons[i + 1].lower() in self.lexicon: valence = 0.0
This errors out on the edge case where the last word is no. Like in the following example:
Overall Food: 1-5 Drink: 3-5 (beer) Service: 1-5 Come back: no
Would probably need to update the line to check if its the last word.