使用NLTK检测英语动词时态 [英] Detect English verb tenses using NLTK

查看:125
本文介绍了使用NLTK检测英语动词时态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种在过去,现在和将来时态中给英语文本计数动词短语的方法.现在,我正在使用 NLTK ,进行POS(词性)标记,然后算上'VBD以获取过去时态.不过,这还不够准确,因此我想我需要走得更远并使用分块,然后分析VP分块以获取特定的时态模式.有什么可以做的吗?任何进一步的阅读可能会有所帮助? NLTK书主要针对NP块,而我几乎找不到有关VP块的信息.

I am looking for a way given an English text count verb phrases in it in past, present and future tenses. For now I am using NLTK, do a POS (Part-Of-Speech) tagging, and then count say 'VBD' to get past tenses. This is not accurate enough though, so I guess I need to go further and use chunking, then analyze VP-chunks for specific tense patterns. Is there anything existing that does that? Any further reading that might be helpful? The NLTK book is focused mostly on NP-chunks, and I can find quite few info on VP-chunks.

推荐答案

确切的答案取决于您打算使用哪个分块器,但是列表理解将使您走很长一段路.使用不存在的分块器,可以获取动词短语的数量.

Thee exact answer depends on which chunker you intend to use, but list comprehensions will take you a long way. This gets you the number of verb phrases using a non-existent chunker.

len([phrase for phrase in nltk.Chunker(sentence) if phrase[1] == 'VP'])

您可以采用更细粒度的方法来检测时态数.

You can take a more fine-grained approach to detect numbers of tenses.

这篇关于使用NLTK检测英语动词时态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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