我们如何从句子中提取主要动词? [英] How can we extract the main verb from a sentence?

查看:464
本文介绍了我们如何从句子中提取主要动词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,鹦鹉不游泳".这里的主要动词是游泳".我们如何通过语言处理来提取呢?为此有任何已知的算法吗?

For example, "parrots do not swim." Here the main verb is "swim". How can we extract that by language processing? Are there any known algorithms for this purpose?

推荐答案

您可以运行依赖性解析算法对句子进行查找,并找到root关系的依存关系.例如,通过 Stanford Parser在线演示运行句子鹦鹉不游泳" ,我得到以下依赖项:

You can run a dependency parsing algorithm on the sentence and the find the dependent of the root relation. For example, running the sentence "Parrots do not swim" through the Stanford Parser online demo, I get the following dependencies:

nsubj(swim-4, Parrots-1)
aux(swim-4, do-2)
neg(swim-4, not-3)
root(ROOT-0, swim-4)

每行内容都提供有关句子中两个单词之间语法关系不同的信息(请参见下文).您需要最后一行,它说swim是句子的根,即主要动词.因此,要提取主要动词,请先执行依赖项解析,然后找到读取root(ROOT-0, X)的依赖项. X将是主要动词.

Each of these lines provides information about a different grammatical relation between two words in the sentence (see below). You need the last line, which says that swim is the root of the sentence, i.e. the main verb. So to extract the main verb, perform dependency parsing first and find the dependency that reads root(ROOT-0, X). X will be the main verb.

有几个易于使用的依赖解析器,例如与 Stanford CoreNLP 或 Malt解析器.我更喜欢斯坦福大学,因为它的准确性可比,但是具有更好的文档并支持多线程分析(如果您有很多文本). Stanford解析器输出XML,因此您必须对其进行解析以获取上面的依赖项信息.

There are several readily available dependency parsers, such as the one available with Stanford CoreNLP or Malt parser. I prefer Stanford because it is comparable in accuracy, but has better documentation and supports multithreaded parsing (if you have lots of text). The Stanford parser outputs XML, so you will have to parse that to get the dependency information above.

为完整起见,对其余输出内容进行简要说明.第一行说parrots(句子中的第一个单词)是swim(第四个单词)的主题.第二行说do是与swim相关的助动词,第三行说not否定swim.有关每个依赖项含义的更详细说明,请参见斯坦福类型依赖项手册

For the sake of completeness, a brief explanation of the rest of the output. The first line says that parrots, the first word in the sentence, is the subject of swim, the 4th word. The second line says that do is an auxiliary verb related to swim, and the third says that not negates swim. For a more detailed explanation of the meaning of each dependency, see the Stanford typed dependency manual.

根据您定义main verb的方式,某些句子可能具有多个主要动词,例如I like cats and hate snakes.为此的依赖项解析包含依赖项:

Depending on how you define main verb, some sentences may have more than one main verb, e.g. I like cats and hate snakes. The dependency parse for this contain the dependencies:

root(ROOT-0, like-2)
conj(like-2, hate-5)

共同表示,根据解析器,主要动词为like,但hate与它相连.为了您的目的,您可能要同时考虑likehate为主.

which together say that according to the parser the main verb is like, but hate is conjoined to it. For your purposes you might want to consider both like and hate to be main.

这篇关于我们如何从句子中提取主要动词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆