Raj Raj - 10 months ago 44
Python Question

How to parse string and get some information out of whole string in python

I am trying to draw a tree diagram for each family. I have a information about family is like that :

His mother is working at google. He has two sisters, one is working at
hospital and another one is studying.

How I can parse a string to get this final output in dict like this.

{'mother' : [google], 'sister' : [hospital, studying] }

Need suggestions!!

Answer Source

Short answer, you are not going to be able to do so.

Longer answer, buckle up Raj, for you will have to learn Natural Language Processing to be able to do what you want. And that, my unknown internet stranger, is very hard to do.

Good luck!

edit: Natural language Programming is fun too.

edit2 thanks @ Jordan McQueen & juanpa.arrivillaga for making this a better answer