统计情感得分
from cnsenti import Emotion
def emotion_score(s):
senti = Sentiment()
r = senti.sentiment_count(str(s))
if r['pos']>r['neg']:
score = 1
elif r['pos'] < r['neg']:
score = -1
else :
score = 0
return score
all_df['情感得分'] = all_df['文本'].progress_apply(emotion_score)
错误提示:name “Sentiment” is not defined