-
Notifications
You must be signed in to change notification settings - Fork 1
13 – Interrogative Sentences
Daniel Braun edited this page Mar 4, 2021
·
1 revision
In addition to declarative sentences, SimpleNLG-DE can also generate six types of interrogative sentences:
- Yes/No questions
- How questions
- Questions about the subject of a sentence (who or what)
- Questions about the object of a sentence (who or what)
To generate interrogative sentences, simply proceed as you would with a declarative sentence, e.g.:
SPhraseSpec sentence = nlgFactory.createClause();
NPPhraseSpec subject = nlgFactory.createNounPhrase("Klaus");
sentence.setSubject(subject);
VPPhraseSpec verb = nlgFactory.createVerbPhrase("verlieren");
sentence.setVerb(verb);
NPPhraseSpec object = nlgFactory.createNounPhrase("das Spiel");
sentence.setObject(object);
String output = realiser.realiseSentence(sentence);
This code generates the sentence "Klaus verliert das Spiel.". By setting the INTERROGATIVE_TYPE
of the sentence, it can be transformed into different interrogative sentences.
-
sentence.setFeature(Feature.INTERROGATIVE_TYPE, InterrogativeType.YES_NO);
=> Verliert Klaus das Spiel? -
sentence.setFeature(Feature.INTERROGATIVE_TYPE, InterrogativeType.HOW);
=> Wie verliert Klaus das Spiel? -
sentence.setFeature(Feature.INTERROGATIVE_TYPE, InterrogativeType.WHO_SUBJECT);
=> Wer verliert das Spiel? -
sentence.setFeature(Feature.INTERROGATIVE_TYPE, InterrogativeType.WHAT_OBJECT);
=> Was verliert Klaus?