虽然我想通过算法来执行此 *** 作而不使用字典,但我不得不诉诸于使用字典。
我发现最高效的库是SimpleNLG。
由于他们的文档与当前API不同步,因此以下是实现此目的的方法:
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);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)