NLTK 对实体的情绪

NLTK sentiment towards entity

我刚开始使用 NLTK,我想我需要完成的任务非常简单。 我需要解析大量文档并提取对某些实体的情绪。例如下面这句话的整体情绪:

Tea is great. However, I hate coffee.

是否定的,但我想提取对单个预定义实体的情绪。特别是,在前面的示例中,我想将我的实体 ('tea', 'coffee') 提供给 NLTK,并能够分别提取 sentiment('tea')sentiment('coffee')。 我通读了 this 文档,但找不到完成这个简单任务的方法。

您需要一个 classifier, and you need an annotated sentiment corpus to train it with. The nltk offers the movie_review corpus, but of course you'll get best results if you train with something similar to your own data. See also the nltk's nltk.sentiment 包。