I have some idea that I would like to test and I think the ML would be great solution. But I'm a little bit lost how it could be implemented.

The input is just a text, could be anything (but providing some information), for example "Cat has fur".

The output is an object. If it's presented in Json, could be for example the following:

{a: 'cat', b:'fur', c: {d: 'has'}}

This is only for example and doesn't have any sense. But the algorithm should be able to get set of training data (pairs text-object) and then generate new objects for the next text data (and ideally do the opposite task - to generate text based on objects).

How would you implement this one? Which algorithm/approaches could be used? Thanks!


If I interpreted the question right, it sounds like you are looking for an algorithm that generates sentences from training data. This would be a supervised learning algorithm that uses the training data to learn the necessary relationships. There are a variety of algorithms you could use for this. Here are a few suggestions.

You could try an n-gram sentence generator. This is a method used in natural language processing (nlp).

Neural networks are another machine learning algorithm that have been used to generate sentences.

I would code this in python, because python handles json format data, and has many useful nlp libraries such as nltk or spacy. These libraries probably have algorithms built in for just this task.

Hope this helps.

  • $\begingroup$ Thanks for your comment. No, I'm looking for an algorithm that generates multiple labels (organized in object) from the text training data (sequences). I found a lot of theoretical papers and even implementation PyStruct but still don't know how to implement what I want. $\endgroup$ – mimic Mar 30 '17 at 22:41

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.