Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does NLTK have a tool for dependency parsing?

Tags:

python

nlp

nltk

I'm building a NLP application and have been using the Stanford Parser for most of my parsing work, but I would like to start using Python.

So far, NLTK seems like the best bet, but I cannot figure out how to parse grammatical dependencies. I.e. this is an example from the Stanford Parser. I want to be able to produce this in NTLK using Python from the original sentence "I am switching to Python.":

nsubj(switching-3, I-1)
aux(switching-3, am-2)
prep_to(switching-3, Python-5)

Can anyone give me a shove in the right direction to parse grammatical dependencies?

like image 360
sholsapp Avatar asked Jun 27 '10 00:06

sholsapp


People also ask

What is the use of dependency parsing in NLP?

In natural language processing, dependency parsing is a technique used to identify semantic relations between words in a sentence. Dependency parsers are used to map the words in a sentence to semantic roles, thereby identifying the syntactic relations between words.

What is dependency parse tree?

A dependency parse links words together based on their connections. Each vertex in the tree corresponds to a word, child nodes to words that are reliant on the parent, and edges to relationships.

How does dependency parser work?

A dependency parser analyzes the grammatical structure of a sentence, establishing relationships between "head" words and words which modify those heads. The figure below shows a dependency parse of a short sentence.


1 Answers

NLTK includes support for using the MaltParser, see nltk.parse.malt.MaltParser.

The pretrained English model for the MaltParser that's available here parses to the Stanford basic dependency representation. However, you would still need to call Stanford's JavaNLP code to convert the basic dependencies to the CCprocessed representation given above in your example parse.

like image 165
dmcer Avatar answered Oct 03 '22 18:10

dmcer