5

I'm using SimpleNLG 4.4.2 to get plural form for a noun:

final XMLLexicon xmlLexicon = new XMLLexicon();
final WordElement word = xmlLexicon.getWord("apple", LexicalCategory.NOUN);
System.out.println(word);
System.out.println(word.getFeature(LexicalFeature.PLURAL));

However even for this simple example, getFeature returns null instead of apples. What am I doing wrong?

Jakob
  • 3,570
  • 3
  • 36
  • 49
Fluffy
  • 27,504
  • 41
  • 151
  • 234
  • 2
    Does it return `null` for a noun with irregular plural, like `ox` or `automaton`? Also, have you seen [the caveat at the bottom of this page](https://code.google.com/p/simplenlg/wiki/Section4)? – biziclop Oct 28 '15 at 16:55

1 Answers1

7

Thanks for making me aware of this library! Based on the comment from biziclop, I came up with this solution:

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));

which outputs:

apples
Ken Geis
  • 904
  • 6
  • 17