1
$\begingroup$

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?

$\endgroup$
0
$\begingroup$

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.

$\endgroup$
  • $\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$ – shani Apr 23 at 9:02
  • $\begingroup$ @shani Sorry, no idea! Might be an idea to contact the author? $\endgroup$ – Oliver Mason Apr 23 at 12:47

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.