我用SimpleNLG 4.4.2来获得名词的复数形式:
final XMLLexicon xmlLexicon = new XMLLexicon();
final WordElement word = xmlLexicon.getWord("apple", LexicalCategory.NOUN);
System.out.println(word);
System.out.println(word.getFeature(LexicalFeature.PLURAL));但是,即使对于这个简单的示例,getFeature也返回null而不是apples。我做错了什么?
发布于 2015-10-30 17:42:05
谢谢你让我意识到这个图书馆!基于biziclop的评论,我想出了一个解决方案:
final XMLLexicon xmlLexicon = new XMLLexicon();
final WordElement word = xmlLexicon.getWord("apple", LexicalCategory.NOUN);
final InflectedWordElement pluralWord = new InflectedWordElement(word);
pluralWord.setPlural(true);
final Realiser realiser = new Realiser(xmlLexicon);
System.out.println(realiser.realise(pluralWord));其中产出:
appleshttps://stackoverflow.com/questions/33389184
复制相似问题