Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Oct 12, 2021
Embed
What would you like to do?
nltk.download('vader_lexicon')
sentiments = SentimentIntensityAnalyzer()
data["Positive"] = [sentiments.polarity_scores(i)["pos"] for i in data["text"]]
data["Negative"] = [sentiments.polarity_scores(i)["neg"] for i in data["text"]]
data["Neutral"] = [sentiments.polarity_scores(i)["neu"] for i in data["text"]]
data = data[["text", "Positive", "Negative", "Neutral"]]
print(data.head())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment