使用 Lingpipe 识别情感分析中的实体

发布于 2024-12-07 07:23:36 字数 146 浏览 2 评论 0 原文

我使用Lingpipe的情感分析模块实现了情感分析。我知道他们为此使用动态 LR 模型。它只是告诉我测试字符串是积极情绪还是消极情绪。我可以用什么想法来确定表达情感的对象?

如果文本被归类为积极情绪,我想获取表达情绪的对象 - 这可以是电影名称、产品名称或其他。

I have implemented sentiment analysis using the sentiment analysis module of Lingpipe. I know that they use a Dynamic LR model for this. It just tells me if the test string is a positive sentiment or negative sentiment. What ideas could I use to determine the object for which the sentiment has been expressed?

If the text is categorized as positive sentiment, I would like to get the object for which the sentiment has been expressed - this could be a movie name, product name or others.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风蛊 2024-12-14 07:23:36

虽然这个问题确实很老了,但我想回答一下,以造福他人。

这里您想要的是概念级别的情感分析。对于非常基本的版本,我建议遵循以下步骤:

  1. 应用句子拆分器。您可以使用 Lingpipe 的句子拆分器或 OpenNLP 句子检测器。

  2. 应用部分规范标记。同样,您可以使用 Lingpipe 的 POS 标记器或 OpenNLP POS Tagger。

  3. 然后,您需要识别词性标注器识别为“名词”的标记。这些标记有可能成为句子中的目标实体。

  4. 然后你需要在句子中找到情感词。最简单的方法是使用带有情感的单词词典。你可以在网上找到很多这样的词典。

  5. 下一步将找出句子中的依存关系。这可以通过使用 Stanford Dependency Parser 来实现。例如,如果您在其 Thisphone is good.” ="nofollow">在线演示,您可以看到以下“类型化依赖项”:

    det(phone-2, This-1),
    nsubj(good-4, 电话-2),
    警察(好-4,是-3),
    根(ROOT-0,好-4)

    此处的依赖项nsubj(good-4,phone-2)表示phone是令牌标称主语 good,暗示单词good表示phone。我确信您的情感词典将包含单词 good,并且 phone 会被词性标注器识别为名词。因此,您可以得出结论,实体phone表达了情感good

这是一个非常基本的例子。您可以更进一步,围绕依赖关系创建规则,以提取更复杂的情感实体对。您还可以为情感术语分配分数,并根据该句子中情感词出现的次数得出该句子的总分。

Although this question is really old but I would like to answer it for others' benefit.

What you want here is concept level sentiment analysis. For a very basic version, I would recommend following these steps:

  1. Apply sentence splitter. You can either use Lingpipe's Sentence Splitter or the OpenNLP Sentence Detector.

  2. Apply part-of-spech tagging. Again you can either use Lingpipe's POS tagger or OpenNLP POS Tagger.

  3. You then need to identify tokens(s) identified as 'Nouns' by the POS tagger. These token(s) have the potential of being the targeted entity in the sentence.

  4. Then you need to find sentiment words in the sentence. The easiest way to do this is by using a dictionary of sentiment bearing words. You can find many such dictionaries online.

  5. The next step will be find out dependency relations in sentences. This can be achieved by using the Stanford Dependency Parser. For example, if you try out the sentence - "This phone is good." in their online demo, you can see the following 'Typed Dependencies':

    det(phone-2, This-1),
    nsubj(good-4, phone-2),
    cop(good-4, is-3),
    root(ROOT-0, good-4)

    The dependency nsubj(good-4, phone-2) here indicates that phone is the nominal subject of the token good, implying that the word good is expressed for phone. I am sure that your sentiment dictionary will contain the word good and phone would have been identified as a noun by the POS tagger. Thus, you can conclude that the sentiment good was expressed for the entity phone.

This was a very basic example. You can go a step further and create rules around the dependency relations to extract more complex sentiment-entity pairs. You can also assign scores to your sentiment terms and come up with a total score for the sentence depending upon the number of occurrences of sentiment words in that sentence.

囍笑 2024-12-14 07:23:36

通常情感句是指该句子的主要实体是该情感的对象。所以基本的启发式方法是 NER 并获得第一个对象。否则,您应该使用深度解析 NLP 工具包并编写一些规则将情感与对象联系起来。

Usually sentiment sentence means that the main entity of such sentence is the object of that sentiment. So basic heuristic is to NER and get first object. Otherwise you should use deep parsing NLP toolkits and write some rules to link sentiment to object.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文