有没有办法使用 OpenNLP 获取句子的主语?
有没有办法使用 OpenNLP 获取句子的主语? 我试图确定用户句子中最重要的部分。一般来说,用户会向我们的“引擎”提交句子,我们想确切地知道该句子的核心主题是什么。
目前我们正在使用 openNlp 来:
- 对句子进行分块
- 识别句子的名词短语、动词等
- 识别句子的所有“主题”
- (尚未完成!) 识别句子的“核心主题”
请告诉我如果你有什么好主意..
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:
- Chunk the sentence
- Identify the noun-phrase, verbs, etc of the sentence
- Identify all "topics" of the sentence
- (NOT YET DONE!) Identify the "core topic" of the sentence
Please let me know if you have any bright ideas..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
依存解析器
如果您有兴趣提取语法关系,例如哪个单词或短语是句子的主语,那么您确实应该使用 依赖解析器。虽然 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).
对于语法主题,您需要依赖树中的配置信息。如果解析看起来像 (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.