在python中识别动词时态 [英] Identifying verb tenses in python

查看:444
本文介绍了在python中识别动词时态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用Python + NLTK来识别句子是否涉及过去/现在/未来?

How can I use Python + NLTK to identify whether a sentence refers to the past/present/future ?

我只能使用POS标记执行此操作吗?这似乎有点不准确,在我看来,我需要考虑句子上下文,而不仅是单词本身.

Can I do this only using POS tagging? This seems a bit inaccurate, seems to me that I need to consider the sentence context and not only the words alone.

对另一个可以做到这一点的图书馆有何建议?

Any suggestion for another library that can do that?

推荐答案

亲自完成这项工作并不难. 此表应可帮助您识别不同的动词时态,处理它们只是一个问题nltk.pos_tag(string)的结果解析

It won't be too hard to do this yourself. This table should help you identify the different verb tenses and handling them will just be a matter of parsing the result of nltk.pos_tag(string)

我不确定是否要进入所有可能的不规则动词时态,例如可能已经来了"等,但是如果您只想现在/过去/将来,这是一个非常容易的解析任务.

Im not sure if you want to get into all of the irregular verb tenses like 'could have been' etc... but if you only want present/past/future this is a very easy parsing task.

我不知道有哪个库会自行执行此操作,而且我一直想过训练某种模型来为我自己决定,但从未尝试过.

I dont know of any library that will do this on its own, and I've always thought of training some model to decide this for me but never got around to it.

会有一定程度的错误,但是不会很大.我建议解析所有动词,以便决定您想如何处理时态,因为在诸如此类的句子中: 我很高兴他能见到她. 时态已经存在,但是还有一个将来时态子句([他将见她]),所以这进入了您问题的语言学中,您没有详细说明,但是您明白了.

There will be some degree of error but it wont be large. I recommend parsing all verbs in order to decide how you want to handle the tense, because in sentences like: I am happy he will see her. The tense is present, but there is a future tense clause ( [that] he will see her ) So this gets into the linguistics of your problem which you didn't elaborate but you get the idea.

这篇关于在python中识别动词时态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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