Given a few specific words, which techniques of Natural Language Processing can I use to achieve creating a meaningful sentence from those words?


Words: jackets, highest sale, sweaters, lowest sale

Sentence: Jackets exhibited the highest sales while sweaters sold the least.

If my question is too broad, let me know so I can ask more specific questions.


1 Answer 1


I resolved the issue by making use of the Natural Language Generation, Python Library , nlglib

The solution I came up with is depicted through the Python Code below.

import nlglib
realise_en = Realiser(host='nlg.kutlak.info', port=40000)

p = Clause(NP('jackets'), VP('achieve','highest sales'))
p['TENSE'] = 'PAST'
q = Clause(NP('sweaters'), VP('exhibit','lowest sales'))
q['TENSE'] = 'PAST'

This prints the statements

Jackets achieved highest sales.
Sweaters exhibited lowest sales.
Jackets achieved highest sales while Sweaters exhibited lowest sales.

This is the best solution I found so far.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.