8

I want to find predicate and subject from a sentence using Natural Language Processing Libraries. Is this technique have any name in the world of NLP or Is there any way to do that?

Example : He likes child. Result: (He, likes child)

user6750923
  • 469
  • 2
  • 11
  • 22

2 Answers2

6

Yes you can do that with Word Dependency Parsing which is available in spaCy NLP. Here is the visualization using spaCy displaCy:

enter image description here

from that visualization, you can extract the word "He" as subject since its dependency property is "nsubj" or "normal subject", the word "likes" is predicate since its dependency property is "root" that means no dependency to other word in the sentence, and the word "childs" as an object since its dependency property is "dobj" or direct object.

You can access that visualization directly here

Syauqi Haris
  • 406
  • 5
  • 6
3

The task you described is information extraction. Check the Wikipedia article or the Stanford open information extraction software

Dan
  • 61
  • 12
  • Can I find the subject and predicate using `Dependency parser Tree`? – user6750923 Sep 02 '16 at 19:12
  • thats a different question, please search first before you want to ask and then open a new question. But for now: a parse tree is created by a parser. Referring to our context you may look at this question: http://stackoverflow.com/questions/33733669/extract-np-vp-np-from-stanford-dependency-parse-tree – Dan Sep 02 '16 at 22:23
  • Can I invite you or tag you on my new question? If yes! How? – user6750923 Sep 03 '16 at 04:33
  • The OpenIE system basically does get the subject and predicate from the dependency tree. You can write custom code to do this yourself (e.g., with Semgrex), but I do recommend looking at OpenIE to make sure you actually want different semantics. In additon to Stanford, UW also has some systems that may be worth a look (Ollie, OpenIE 4, etc). – Gabor Angeli Sep 03 '16 at 08:48
  • You cant invite users to answer questions. A mechanism to save high rep users from request-bombardment. But if you think my answer to your question was satisfying you can accept it and close the question and I will take a look at your other questions which I can see over your profile page : ) – Dan Sep 05 '16 at 08:32