Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top