I am trying to use SimpleNLG (using python and simplenlg) to generate phrases using the word "because". The wiki (https://github.com/simplenlg/simplenlg/wiki/Section-XIII-%E2%80%93-Generating-a-sentence-with-multiple-clauses) offer the following solution:
a = nlgFactory.createClause("I", "be", "happy")
b = nlgFactory.createClause("I", "eat", "fish")
b.setFeature(Feature.COMPLEMENTISER, "because")
b.setFeature(Feature.TENSE, Tense.PAST)
a.addComplement(b)
realiser.realiseSentence(a)
But when i want to add more causes using "and",
a = nlgFactory.createClause("I", "be", "happy")
b = nlgFactory.createClause("I", "eat", "fish")
c = nlgFactory.createClause("I","eat","salad")
d = nlgFactory.createCoordinatedPhrase()
d.addCoordinate(b)
d.addCoordinate(c)
print(realiser.realiseSentence(d)) #I eat fish and I eat salad.
d.setFeature(Feature.COMPLEMENTISER, "because")
d.setFeature(Feature.TENSE, Tense.PAST)
a.addComplement(d)
realiser.realiseSentence(a)
i get the following result:
I am happy that I ate fish and that I ate salad.
"because" has disappeared, replaced by "that".
I suppose that the use of "that" is intended behavior in this case, however it also happen when it make the generated phrase incorrect:
r = nlgFactory.createCoordinatedPhrase()
r.setConjunction("and")
a = nlgFactory.createClause("Monash","invite","Lewis")
b = nlgFactory.createClause("Lewis","feel","happy")
r.addCoordinate(a)
r.addCoordinate(b)
#phrase = nlgFactory.createCoordinatedPhrase()
#phrase.setConjunction("because")
#phrase.addCoordinate(G_nlg[i])
#phrase.addCoordinate(reason)
phrase = nlgFactory.createClause("Lewis","go to", "Monash")
r.setFeature(Feature.COMPLEMENTISER, "because")
r.setFeature(Feature.TENSE, Tense.PAST)
phrase.addComplement(r)
realiser.realiseSentence(phrase)
returns Lewis goes to Monash that Monash invited Lewis and that Lewis felt happy.
when i would want it to return "Lewis goes to Monash because Monash invited Lewis and Lewis felt happy"
Why is "that" used there, and how could i get SimpleNLG to generate the sentence that i want?
I tried changing verbs and time with no result. Using a coordinated sentence with setConjunction("because") sometime gave me the correct sentence, but i don't think this is the intended use.