How to extract Predicate and subject from a sentence using NLP Libraries?
Asked Answered
S

2

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)

Scheider answered 1/9, 2016 at 3:18 Comment(0)
L
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

Leucoma answered 12/6, 2020 at 0:4 Comment(0)
S
3

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

Selfabasement answered 1/9, 2016 at 12:7 Comment(5)
Can I find the subject and predicate using Dependency parser Tree?Scheider
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: #33734169Selfabasement
Can I invite you or tag you on my new question? If yes! How?Scheider
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).Ascariasis
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 : )Selfabasement

© 2022 - 2024 — McMap. All rights reserved.