Textblob 过度概括文本并将其归类为中性

问题描述

我正在使用 textblob 来确定 Twitter 文本的情绪,但有些结果没有极性和主观性(使它们成为中性情绪 - tweets cleaned and placed in pd.dataframe)

This is a chart of the overall contrasts between sentiment (showing way more neutral)

我的代码在下面

# Create a function to get the subjectivity
def getSubjectivity(text):
   return TextBlob(text).sentiment.subjectivity

# Create a function to get the polarity
def getPolarity(text):
   return  TextBlob(text).sentiment.polarity


# Create two new columns 'Subjectivity' & 'Polarity'
df['Subjectivity'] = df['Tweets'].apply(getSubjectivity)
df['Polarity'] = df['Tweets'].apply(getPolarity)

# Show the new dataframe with columns 'Subjectivity' & 'Polarity'
df

# Subjectivity < 1  but > 0 is more factual,> 1 is very opinionated (0 and +1 are min/max)
# Polarity < 0 is more negative,> 0 is more positive (-1 and +1 are the min/max)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)