简体   繁体   中英

Does NLTK have a tool for dependency parsing?

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. Ie 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM