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

问题描述

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

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

例如

  • 住到:住过
  • 尝试:尝试过
  • 点击:点击
  • 煮沸:煮沸
  • 卖给:出售

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

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: 感谢大家的回复,好像没有字典是因为动词不规则的原因.

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.

I found that the most efficient library was 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);

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

09-12 16:15