How to get "inter-term relation" between words in NLTK?

52 views
Skip to first unread message

Oliver

unread,
Mar 12, 2015, 5:08:06 PM3/12/15
to nltk-...@googlegroups.com
Hi guys,

since days I try to figure this out. Ich googled a lot, posted on stackoverflow, but can't get an answer. Now I found you guys, hope someone is able to help me. I would be very happy :) 
So here my problem. I have a sentence/question: "How much could you rent a Volkswagen bug for in 1966?
I want to get the relations between the words, like in this picture 







I tried this: 
text = nltk.word_tokenize("How much could you rent a Volkswagen bug for in 1966?")
posTagged
= nltk.pos_tag(text)    
n
= nltk.chunk.ne_chunk(posTagged)
n
.draw()

But I get only a flat tree. So how am I able to do get the relation between "How much" and "rent"? I am using python 3 and nltk 3. 

With best regards, Oliver

Steven Bird

unread,
Mar 12, 2015, 9:49:52 PM3/12/15
to nltk-...@googlegroups.com
Oliver – you might want to learn about semantic role labeling (not a functionality available in NLTK).
http://en.wikipedia.org/wiki/Semantic_role_labeling


--
You received this message because you are subscribed to the Google Groups "nltk-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nltk-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages