Java 动名词

Java 动名词,java,nlp,nlg,Java,Nlp,Nlg,我是简单NLG的新手,我想知道我输入的动词的动名词。 下面是一个示例代码,但我尝试输入动名词表示时态,但没有成功 XMLLexicon lexicon = new XMLLexicon("path\\to\\default-lexicon.xml"); WordElement word = lexicon.getWord("live", LexicalCategory.VERB); InflectedWordElement infl = new InflectedWordElement(word

我是简单NLG的新手,我想知道我输入的动词的动名词。 下面是一个示例代码,但我尝试输入动名词表示时态,但没有成功

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); //I want the verb to be in gerund not past
Realiser realiser = new Realiser(lexicon);
String gerund = realiser.realise(infl).getRealisation();
System.out.println(gerund);

我不知道API,但从我能拼凑的东西来看,它看起来像是一种类似于

XMLLexicon lexicon = ...
NLGFactory phraseFactory = new NLGFactory(lexicon);
VPPhraseSpec live = phraseFactory.createVerbPhrase("live");
SPhraseSpec clause = phraseFactory.createClause();
clause.setVerbPhrase(live);
clause.setFeature(Feature.FORM, Form.GERUND);
Realizer realizer = new Realizer(lexicon);
String gerund = realizer.realize(clause).getRealisation();
也许对你更好


如果找不到更好的资源,请查看有关如何使用API的提示。

但它不起作用。。。什么不起作用,或者你得到了什么输出?输出是动词的过去式。因为在第4行中,你可以看到,Tense.pass,我想把输出改为动名词,只是没有语法Tense.gerund,所以这是我的问题。如何在我的代码中更改这一行或几行,使输出为动名词。您可以查看文档吗?谢谢!这帮助我找到了正确的代码词典Lexicon=new-nihdblexcon(“C:\\Users\\BlackRain\\Desktop\\lexAccess2016(1)\\lexAccess2016\\data\\HSqlDb\\lexAccess2016.data”);NLGFactory phraseFactory=新NLGFactory(词典);VPPhraseSpec live=phraseFactory.createVerbPhrase(“skim”);sphraspect子句=phraseFactory.createClause();第2.2条(现场);子句.setFeature(Feature.FORM,FORM.GERUND);实现者实现者=新实现者(词典);字符串gerund=realizer.realize(子句).getrealization()@杰里米很高兴你能拼凑出最后的部分。很高兴听到它起作用了。@JeremyHunts在原始问题中添加了
功能.FORM
参数;因为,在评论中很难读到。