The following SimpleNLG code which specifies the subject, verb and object using "monkeys", "eat", "bananas", respectively produces the sentence "monkey eats bananas". Thus, you see that it converted the plural nouns into singular ones (and ensured the verb agrees accordingly). Is there a way to ensure that SimpleNLG detects they're plurals and keeps them as such? I've seen documentation mention that certain Lexicon files may do this, but I tried the NIH Lexicon and that didn't help. Is this simply not supported by SimpleNLG? Or is there a way to do it using SimpleNLG or otherwise?
Lexicon = new Lexicon.getDefaultLexicon()
nlgFactory = new NLGFactory(lexicon);
Realiser realiser = new Realiser(lexicon);
NPPhraseSpec subject = nlgFactory.createNounPhrase("monkeys");
VPPhraseSpec verb = nlgFactory.createVerbPhrase("eat");
NPPhraseSpec object = nlgFactory.createNounPhrase("bananas");
SPhraseSpec clause = nlgFactory.createClause();
clause.setSubject(subject);
clause.setVerbPhrase(verb);
clause.setObject(object);
System.out.print(realiser.realiseSentence(clause));
The issue with SimpleNLG is it's not meant to be smart. Anything you need, you have to declare it. If you need a plural noun, you need to declare it instead of just passing "monkeys" as argument.
By default SimpleNLG will convert words to base form (for nouns -> singular). It won't work if the noun isn't in the lexicon and it's irregular.
Underlying SimpleNLG does POS tagging. But you won't be able to access it unless you hack the code. What I did before is I combined SimpleNLG with external preprocessing pipeline (I needed other tasks like dependency parsing (using Stanford CoreNLP) anyway, which SimpleNLG doesn't provide). The code looks something like: