1
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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