我正在使用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
。我做错了什么?
答案 0 :(得分:5)
感谢您让我了解这个图书馆!根据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));
输出:
apples