Aan de slagGa gratis aan de slag

Loading VADER

Sentiment analysis provides us a small glimpse of the meaning of texts with a rather directly interpretable method. While it has its limitations, it's a good place to begin working with textual data. There's a number of out-of-the-box tools in Python we can use for sentiment analysis.

ds_tweets with the datetime index has been loaded for you.

Deze oefening maakt deel uit van de cursus

Analyzing Social Media Data in Python

Cursus bekijken

Oefeninstructies

  • Load SentimentIntensityAnalyzer from nltk.sentiment.vader.
  • Instantiate a new SentimentIntensityAnalyzer object.
  • Generate sentiment scores with the .apply() method and the analyzer's polarity_scores() function.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Load SentimentIntensityAnalyzer
____

# Instantiate new SentimentIntensityAnalyzer
sid = ____

# Generate sentiment scores
sentiment_scores = ds_tweets['text'].____(____)
Code bewerken en uitvoeren