Framing Sentences based on keywords

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

eg.

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.

Topic nlg nlp

Category Data Science


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'
print(realise_en(p))
print(realise_en(q))
r=Clause(realise_en(p)[:-1],'while',realise_en(q))
print(r)

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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.