I am learning SimpleNLG (python version) and am using the approach mentioned in this post to start with the Stanford parser and translate.
So I tried translating "Your walk is faster than your average walk" and came up with the below code, which generates "Your walk is fast than your average walk.". To make it say "faster", I uncomment the line below to set Feature.IS_COMPARATIVE.
My question is: Is there a way to get SimpleNLG to set that automatically? Doesn't it have the information that "faster" is comparative in the lexicon?
factory = NLGFactory(newLexicon=lexicon)
# (NP (PRP$ Your) (NN walk))
nounPhrase = NPPhraseSpec(factory)
nounPhrase.setNoun("walk")
nounPhrase.setDeterminer("your")
# (NP (PRP$ your) (JJ average) (NN walk)))))))
adjPhrase = AdjPhraseSpec(factory)
adjPhrase.setAdjective("average")
nounPhrase2 = NPPhraseSpec(factory)
nounPhrase2.setDeterminer("your")
nounPhrase2.setPreModifier(adjPhrase)
nounPhrase2.setNoun("walk")
# (PP (IN than) nounPhrase2)
prepPhrase = PPPhraseSpec(factory)
prepPhrase.setPreposition("than")
prepPhrase.setObject(nounPhrase2)
# (ADJP (JJR faster))
adjPhrase2 = AdjPhraseSpec(factory)
adjPhrase2.setAdjective("faster")
# adjPhrase2.setFeature(Feature.IS_COMPARATIVE, True)
adjPhrase3 = AdjPhraseSpec(factory)
adjPhrase3.setPreModifier(adjPhrase2)
adjPhrase3.setAdjective(prepPhrase)
# (S nounPhrase
verbPhrase = SPhraseSpec(factory)
verbPhrase.setSubject(nounPhrase)
verbPhrase.setVerb("is")
verbPhrase.setObject(adjPhrase3)
r = realiser.Realiser(lexicon=lexicon)
sentence = r.realiseSentence(verbPhrase)
print(sentence)
> Your walk is faster than your average walk