pip install snownlp#中文文本的情感分析
from snownlp import SnowNLP
s = SnowNLP(u'这个东西真心很赞')
s.words # [u'这个', u'东西', u'真心',
# u'很', u'赞']
s.tags # [(u'这个', u'r'), (u'东西', u'n'),
# (u'真心', u'd'), (u'很', u'd'),
# (u'赞', u'Vg')]
s.sentiments # 0.9769663402895832 positive的概率
s.pinyin # [u'zhe', u'ge', u'dong', u'xi',
# u'zhen', u'xin', u'hen', u'zan']
s = SnowNLP(u'「繁体字」「繁体中文」的叫法在台湾亦很常见。')
s.han # u'「繁体字」「繁体中文」的叫法
# 在台湾亦很常见。'