Samy,
Yes, but not in the ‘proper’ way AFAIK.
My (very!) hacky solution:
p.setFeature(Feature.INTERROGATIVE_TYPE, true);
String verb = "eat";
p.setVerb(verb);
String object = "chocolate";
p.setObject(object);
p.addPreModifier("should I”);
Why is this a hack?
A) TRUE is not the expected value of InterrogativeType, as you’d normally provide things like HOW or WHO. But it gives you the question mark in the end.
B) Not the proper linguistic parse.
What should be done to achieve what you want in the proper way?
A) AFAIK, interrogatives are restricted to a WH type of interrogative, such as HOW or WHO. One would need to modify the VerbPhraseHelper algorithm (and relevant Enums) to allow non-WH interrogative types other than with do and be. When you set InterrogativeType to YES_NO (which I think was the right interpretation), SimpleNLG will place a form of do (do, does, did) or be (am, is, are, were, was) at the beginning of the sentence. What you need at the start of the sentence is none, but the modal verb “should”. And you surely don’t want “who”, “how”, “how many” there either.
B) Provide the proper linguistic specification. Since you need the modal “should”, you cannot pass a single verb to the sentence. Instead you’ll need to pass a VerbPhrase, whose head is the verb you want and set the modal of the verb phrase to be “should”. Once all the is done, your linguistically valid code would look like:
p.setFeature(Feature.INTERROGATIVE_TYPE, true);
String verb = "eat";
VPPhraseSpec vp = nlgFactory.createVerbPhrase(verb);
vp.setFeature(Feature.MODAL, "should");
p.setVerb(vp);
String object = "chocolate";
p.setObject(object);
Hope this helps.