【问题标题】:SimpleNLG - How to get the plural of a noun?SimpleNLG - 如何获得名词的复数形式?
【发布时间】:2015-10-28 10:56:29
【问题描述】:

我正在使用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。我做错了什么?

【问题讨论】:

标签: java nlp nlg simplenlg


【解决方案1】:

感谢您让我了解这个库!根据 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-30
    • 1970-01-01
    • 2013-09-25
    • 2020-12-08
    • 2011-03-18
    • 1970-01-01
    相关资源
    最近更新 更多