LoginSignup
1
1

More than 1 year has passed since last update.

Vtuberの名前をキーワードにtweetの感情分析してみた

Last updated at Posted at 2021-06-04

概要

TweetをAPIで取得し、感情分析をしています。
sentimentjaという日本語対応のパッケージもありますが、
日本語を英語に翻訳のうえ、英語対応のパッケージを利用しています。

参照元

下記のコードを一部変更して実装しています。
https://github.com/DarekarA/TwitterSentimentAnalysis_Public

変更前

# Funciton to analyze Sentiment

from textblob import TextBlob
def analyze_sentiment(tweet):
    analysis = TextBlob(tweet)
    if analysis.sentiment.polarity > 0:
        return 'Positive'
    elif analysis.sentiment.polarity == 0:
        return 'Neutral'
    else:
        return 'Negative'

変更後

# Funciton to analyze Sentiment

from textblob import TextBlob
def analyze_sentiment(tweet):
    analysis = TextBlob(tweet)
    #日本語(各種言語)→英語に翻訳
    analysis = analysis.translate(to='en')
    #print(analysis)
    if analysis.sentiment.polarity > 0:
        return 'Positive'
    elif analysis.sentiment.polarity == 0:
        return 'Neutral'
    else:
        return 'Negative'

テスト1 (2021/6/4)

兎田ぺこらさん

image.png

Neutralが少なく、Positiveが多いようです。

月ノ美兎さん

image.png

兎田ぺこらさんと比較して、Neutralが非常に多いようです。

名取さなさん

image.png

月ノ美兎さんと同じような比率でした。

さくらみこさん

image.png

兎田ぺこらさんに比較的近い比率でした。
もしかすると、ホロライブ所属のvTuberさんは、Positiveが多いと思い

ときのそらさん

image.png

やっぱり、ホロライブのホロライブ所属のvTuberさんは、Positiveが多いようです。

テスト2 (2021/6/18)

ホロライブがいろいろとあったので、変化を見てみました。

兎田ぺこらさん

image.png
さらに、positiveの比率増えています。

月ノ美兎さん

image.png

さくらみこさん

image.png
Negativeが増えている

赤井はあとさん

image.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1