How can I make meaningful English sentences from given set of words? I have a set of topics and each topic consists of a set of words. I want to make meaningful English sentences from these words. Each topic consist of 5 to 10 words and these words are relevant to each other, like {code, language, test, write and function} and {class, public, method, string, int} are two sets. I want to generate a sentence from these set of words using API.
Two Approaches:


Naive Bayes
LSTM


Train Naive Bayes on a whole dataset learning the probability of the next word given a word.

You can even go with any LSTM approaches, but I'd bet on Naive Bayes.

Eg:

text: hello how are you hello how are you hello No how

to get the suggestion of next word depending on current word - hello

p(how | hello) = 3/4

p(No | hello) = 1/4

take argmax of probabilities.

Also remember to smooth, and train on huge dataset. Training is just finding the probabilities before hand.

Hope it helps ;)