def polarity_scores(self, text):
<EOL>text_token_list = text.split()<EOL>text_no_emoji_lst = []<EOL>for token in text_token_list:<EOL><INDENT>if token in self.emojis:<EOL><INDENT>description = self.emojis[token]<EOL>text_no_emoji_lst.append(description)<EOL><DEDENT>else:<EOL><INDENT>text_no_emoji_lst.append(token)<EOL><DEDENT><DEDENT>text = "<STR_LIT:U+0020>".join(x for x in text_no_emoji_lst)<EOL>sentitext = SentiText(text)<EOL>sentiments = []<EOL>words_and_emoticons = sentitext.words_and_emoticons<EOL>for item in words_and_emoticons:<EOL><INDENT>valence = <NUM_LIT:0><EOL>i = words_and_emoticons.index(item)<EOL>if item.lower() in BOOSTER_DICT:<EOL><INDENT>sentiments.append(valence)<EOL>continue<EOL><DEDENT>if (i < len(words_and_emoticons) - <NUM_LIT:1> and item.lower() == "<STR_LIT>" and<EOL>words_and_emoticons[i + <NUM_LIT:1>].lower() == "<STR_LIT>"):<EOL><INDENT>sentiments.append(valence)<EOL>continue<EOL><DEDENT>sentiments = self.sentiment_valence(valence, sentitext, item, i, sentiments)<EOL><DEDENT>sentiments = self._but_check(words_and_emoticons, sentiments)<EOL>valence_dict = self.score_valence(sentiments, text)<EOL>return valence_dict<EOL>
Return a float for sentiment strength based on the input text.
Positive values are positive valence, negative value are negative
valence.