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)
Subject, predicate, and objects are the three different components when breaking down a sentence. The subject is the "who" or "what" of the sentence, the predicate is the verb, and the object is any noun or concept that is part of the action of the subject.
It follows subject-verb-object model. To mark the subject, write a rule set with POS tags. Tag the sentence I[NOUN] shot[VERB] an elephant[NOUN] . If you see the first noun is subject, then there is a verb and then there is an object.
Every complete sentence contains two parts: a subject and a predicate. The subject is what (or whom) the sentence is about, while the predicate tells something about the subject.
Yes you can do that with Word Dependency Parsing which is available in spaCy NLP. Here is the visualization using spaCy displaCy:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With