I have set of topics generated using LDA and like {code, language, test , write, function}, {class, public, method, string, int} etc and I want to make meaningful sentence/sentences from these words using api or libraries. How do I implement this with NLTK and(or) Machine Learning? Any suggestions as to how I should go about this?
1 Answer
How do you define "meaningful"? Generally, you would start from concepts and meanings, and then realise them in syntactic structures using lexical items (words). You seem to want to start in the middle somehow.
For turning a semantic representation into a valid sentence, you would use a generator; these are often based on grammars. Examples exist which take a grammar, fill in random words, and create a syntactically well-formed sentence; often they will, however, be rather non-sensical or meaningless. Have a look at this site which describes the Syntax Construction Kit. The author, Mark Rosenfelder, links to a number of toy programs which do exactly that. Just substitute his lexicon with the list of words created by your LDA process. See for example this generator based on generative grammar.
-
$\begingroup$ Really appreciate your valuable suggestion it really helped me. The link of the API tool which you shared is a paid tool. I cannot pay for that as I am a student. Is there any free link or any student version? Regards, $\endgroup$– shaniCommented Apr 23, 2019 at 9:02
-
$\begingroup$ @shani Sorry, no idea! Might be an idea to contact the author? $\endgroup$ Commented Apr 23, 2019 at 12:47