python中基于方面的情感分析

2024-06-16 09:08:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我对Liu Bing的《情感分析和观点挖掘》一书很感兴趣,我已经实现了一个小程序来获取文本的各个方面。在

我用Hu在我的文本中搜索了一系列积极和消极的单词,并在感慨词旁边找到了最近的名词或人称代词nltk.tokenizer. 结果很有趣,但我很难发现否定和上下文。在

来自亚马逊的例子:

"I love spicy ramen, but for whatever reasons this thing burns my stomach badly and the burning sensation doesn't go away for like 3 hours! Not sure if that is healthy or not .... and you can buy this at Walmart for $0.28, way cheaper than Amazon."

我的程序返回元组列表(“情感词”,“方面”,“情感”)。1表示积极情绪,0表示消极情绪。在

[(u'love', u'i', 1),
(u'love', u'spicy', 1),
(u'burns', u'thing', 0),
(u'badly', u'stomach', 0),
(u'burning', u'stomach', 0),
(u'sensation', u'stomach', 1),
(u'healthy', u'healthy', 1),
(u'cheaper', u'way', 1)]

这种方法似乎可以捕捉到某些方面,但还远远不够。此外,我还远没有刘的例子(第23页):

I bought a Samsung camera and my friends brought a Canon camera yesterday. (2) In the past week, we both used the cameras a lot. (3) The photos from my Samy are not that great, and the battery life is short too. (4) My friend was very happy with his camera and loves its picture quality. (5) I want a camera that can take good photos. (6) I am going to return it tomorrow

我真的很想改进,这样我才能正确地捕捉到这些方面和情感。我知道这是一个很普遍的问题,但你能给我推荐一些套餐和读物吗?在

最好的,非常感谢 亚历克斯


Tags: andthe文本程序forthatmythis