如何识别句子的主语? [英] How to identify the subject of a sentence?

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

问题描述

可以使用Python + NLTK来识别句子的主语吗?从我到目前为止所学到的是,一个句子可以分解为一个头部及其从属.例如我射了大象".在这句话中,我和大象是相依相依的人.但是我如何辨别这句话的主题是我.

Can Python + NLTK be used to identify the subject of a sentence? From what I have learned till now is that a sentence can be broken into a head and its dependents. For e.g. "I shot an elephant". In this sentence, I and elephant are dependents to shot. But How do I discern that the subject in this sentence is I.

推荐答案

作为 NLTK书(练习29)说:用英语定义句子S的主语的一种常见方式是作为S的子代和VP的同胞的名词短语."

As NLTK book (exercise 29) says, "One common way of defining the subject of a sentence S in English is as the noun phrase that is the child of S and the sibling of VP."

看看树示例:的确,"I"是名词短语, S的子级是VP的兄弟,而"elephant"则不是.

Look at tree example: indeed, "I" is the noun phrase that is the child of S that is the sibling of VP, while "elephant" is not.

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

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