有没有办法使用 OpenNLP 获取句子的主语?

发布于 2024-10-30 04:46:54 字数 246 浏览 1 评论 0原文

有没有办法使用 OpenNLP 获取句子的主语? 我试图确定用户句子中最重要的部分。一般来说,用户会向我们的“引擎”提交句子,我们想确切地知道该句子的核心主题是什么。

目前我们正在使用 openNlp 来:

  1. 对句子进行分块
  2. 识别句子的名词短语、动词等
  3. 识别句子的所有“主题”
  4. (尚未完成!) 识别句子的“核心主题”

请告诉我如果你有什么好主意..

Is there a way to get the subject of a sentence using OpenNLP?
I'm trying to identify the most important part of a users sentence. Generally, users will be submitting sentences to our "engine" and we want to know exactly what the core topic is of that sentence.

Currently we are using openNlp to:

  1. Chunk the sentence
  2. Identify the noun-phrase, verbs, etc of the sentence
  3. Identify all "topics" of the sentence
  4. (NOT YET DONE!) Identify the "core topic" of the sentence

Please let me know if you have any bright ideas..

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

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

发布评论

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

评论(2

梦在夏天 2024-11-06 04:46:54

依存解析器

如果您有兴趣提取语法关系,例如哪个单词或短语是句子的主语,那么您确实应该使用 依赖解析器。虽然 OpenNLP 确实支持短语结构解析,但我认为它还没有支持依存解析。

开源软件

用Java编写的支持依赖关系解析的软件包包括:

,斯坦福解析器是最准确的。然而,MaltParser 的某些配置可能非常快 (Cer et al. 2010 )。

Dependency Parser

If you're interested in extracting grammatical relations such as what word or phrase is the subject of a sentence, you should really use a dependency parser. While OpenNLP does support phrase structure parsing, I don't think it does dependency parsing yet.

Opensource Software

Packages written in Java that support dependency parsing include:

Of these, the Stanford Parser is the most accurate. However, some configurations of the MaltParser can be insanely fast (Cer et al. 2010).

静水深流 2024-11-06 04:46:54

对于语法主题,您需要依赖树中的配置信息。如果解析看起来像 (TOP (S (NP ----) (VP ----))) ,那么你可以将 NP 作为主语;情况经常如此,尽管并非总是如此。但只有部分句子会有这种配置;人们可以很容易地想象出主体不处于该位置的结构——例如被动结构。

不过,使用 MaltParser 可能会更好。

For the grammatical subject you'd need to rely on configurational information in the tree. If the parse looks something like (TOP (S (NP ----) (VP ----))) then you can take the NP as the subject; often, though not at all always, that will be the case. However only some sentences will have this configuration; one can easily imagine structures with subjects that are not in that position -- passive constructions, for example.

You're probably better off using MaltParser though.

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