BaşlayınÜcretsiz Başlayın

Calculating sentiment scores

A rough measure of sentiment towards a particular hashtag is to measure average sentiment for tweets mentioning a particular hashtag. It's also possible that other things are happening in that tweet, so it's important to inspect both text as well as metrics generated by automated text methods.

Bu egzersiz

Analyzing Social Media Data in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Print out the first example of a positive tweet. Select the DataFrame with sentiment > 0.6 and use .values to get the full text of the tweet.
  • Do the same for negative tweets with the index sentiment < -0.6.
  • Generate average sentiment score per day for #python with the index check_word_in_tweet. Use .resample() with argument '1 d'. Then take the mean.
  • Do the same with #rstats.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Print out the text of a positive tweet
print(ds_tweets[____]['text'].____[____])

# Print out the text of a negative tweet
print(____[____]['text'].____[____])

# Generate average sentiment scores for #python
sentiment_py = sentiment[____(____, ____)].____(____).____()

# Generate average sentiment scores for #rstats
sentiment_r = ____[____].____(____).____()
Kodu Düzenle ve Çalıştır