当前位置:网站首页>Snownlp emotion analysis
Snownlp emotion analysis
2022-07-03 10:51:00 【Bai Yanling】
I wrote a blog before , Analysis of Douban short review , At that time, it was a classification problem , The prediction is that the user will give the movie a star rating , In fact, it can also be used snownlp Make emotional analysis of the essay .
Emotion analysis is to use some methods and techniques to identify and extract the emotional color in the original material , This blog post mainly introduces how to use snownlp Do emotional analysis .
data Some screenshots of are as follows :
from snownlp import SnowNLP
import matplotlib.pyplot as plt
import numpy as np
#snownlp in sentiments It means that this sentence represents the probability of positive emotion .
sentimentslist = []
for i in data["short"]:
s = SnowNLP(i)
sentimentslist.append(s.sentiments)
plt.hist(sentimentslist, bins = np.arange(0, 1, 0.01), facecolor = 'g')
plt.xlabel('Sentiments Probability')
plt.ylabel('Quantity')
plt.title('Analysis of Sentiments')
plt.show()
The following figure is a histogram of the frequency of each emotion score segment :
We can pick some short reviews to see their scores :


Feeling snownlp The bag is quite accurate , Interested friends can learn .
边栏推荐
- Type de contenu « Application / X - www - form - urlencoded; Charset = utf - 8 'not supported
- Unity learning notes: personal learning project "crazy genius Edgar" error correction document
- 【吐槽&脑洞】关于逛B站时偶然体验的弹幕互动游戏魏蜀吴三国争霸游戏的一些思考
- Leetcode skimming ---35
- Praise syllogism
- Day 7 small exercise
- MySql 怎么查出符合条件的最新的数据行?
- Unity小组工程实践项目《最强外卖员》策划案&纠错文档
- [roast & brain hole] Some Thoughts on the bullet screen interactive game of Wei Shu Wu Three Kingdoms when visiting station B
- Promoted, colleagues become subordinates and don't cooperate with work
猜你喜欢

Matrix calculation of Neural Network Introduction (pytoch)

帶你走進雲原生數據庫界扛把子Amazon Aurora

Day 7 small exercise

QT:QSS自定义 QScrollBar实例

Interviewer: what is the internal implementation of the list in redis?

Classification (data consolidation and grouping aggregation)

Linear regression of introduction to deep learning (pytorch)

Is it OK to test the zero basis software?

Unity learning notes: online game pixel Adventure 1 learning process & error correction experience

Pour vous amener dans le monde des bases de données natives du cloud
随机推荐
Nuget add reference error while installing packages
How does MySQL find the latest data row that meets the conditions?
How to make a blood bar in the game
[combinatorial mathematics] pigeon's nest principle (simple form of pigeon's nest principle | simple form examples of pigeon's nest principle 1, 2, 3)
Leetcode skimming ---1385
面试官:Redis中列表的内部实现方式是什么?
QT:QSS自定义 QStatusBar实例
Softmax regression (pytorch)
QT:QSS自定义QLineEdit实例
Content type ‘application/x-www-form-urlencoded; charset=UTF-8‘ not supported
[combinatorial mathematics] pigeon nest principle (simple form examples of pigeon nest Principle 4 and 5)
Flink -- built in function (all)
测试Leader应该做哪些事
Flink-- custom function
QT:QSS自定义QToolButton实例
Traversal of map set
Promoted, colleagues become subordinates and don't cooperate with work
硬 货 | 一改测试步骤代码就全写?为什么不试试用 Yaml实现数据驱动?
If you always feel that you need to persist in learning English
小文件专项