I'm trying to implement application that can determine meaning of sentence, by dividing it to smaller pieces. So I need to know what words are subject, object etc. so that my program can know how to handle this sentence.
The subject of the sentence is what (or whom) the sentence is about. In the sentence “The cat is sleeping in the sun,” the word cat is the subject. A predicate is the part of a sentence, or a clause, that tells what the subject is doing or what the subject is.
The object of a sentence is the person or thing that receives the action of the verb. It is the who or what that the subject does something to.
In subject questions where we want to find information about the subject, we do not use the auxiliary verb do/does/did. In object questions where we want to find information about the object, we use the auxiliary verb do/does/did. Study the sentence given below. John broke a window.
You should look at the Natural Language Toolkit, which is for exactly this sort of thing.
See this section of the manual: Categorizing and Tagging Words - here's an extract:
>>> text = nltk.word_tokenize("And now for something completely different")
>>> nltk.pos_tag(text)
[('And', 'CC'), ('now', 'RB'), ('for', 'IN'), ('something', 'NN'),
('completely', 'RB'), ('different', 'JJ')]
"Here we see that and is CC, a coordinating conjunction; now and completely are RB, or adverbs; for is IN, a preposition; something is NN, a noun; and different is JJ, an adjective."
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