您如何获得动词的过去式? [英] How do you get the past tense of a verb?

查看:115
本文介绍了您如何获得动词的过去式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取动词过去式的最有效方法是什么,最好是不使用占用大量内存的NLP框架?

What is the most efficient way to get the past tense of a verb, preferably without using memory heavy NLP frameworks?

例如

  • 居住于:居住
  • 尝试:尝试过
  • 点击以:点击
  • 煮沸:煮
  • 出售给:出售

我自己写了一些快速的东西(堆栈溢出不会让我自己回答),这似乎适用于常规动词(例如该列表的前4个),但不适用于不规则动词:

I wrote something quick myself (stack overflow won't let me self answer) which seems to work for regular verbs (e.g. the first 4 of that list), but not irregular verbs: http://pastebin.com/Txh76Dnb

感谢所有答复,由于动词不规则,似乎没有字典就无法正确完成.

edit: Thanks for all the responses, it looks like it can't be done properly without a dictionary due to irregular verbs.

推荐答案

虽然我想通过算法来执行此操作而不使用字典,但我不得不求助于使用字典.

While I wanted to do this algorithmically without using dictionaries, I had to resort to using one.

我发现最高效的库是 SimpleNLG .

由于他们的文档与当前的API不同步,因此以下是实现这一目标的方法:

Since their docs are out of sync with the current API, here is how to achieve this:

XMLLexicon lexicon = new XMLLexicon("path\\to\\default-lexicon.xml");
WordElement word = lexicon.getWord("live", LexicalCategory.VERB);
InflectedWordElement infl = new InflectedWordElement(word);
infl.setFeature(Feature.TENSE, Tense.PAST);
Realiser realiser = new Realiser(lexicon);
String past = realiser.realise(infl).getRealisation();
System.out.println(past);

这篇关于您如何获得动词的过去式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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