Stanford Dependencies in Python

David McClosky wrote to the Corpora List with the following news:

I’m happy to announce two new Python packages for parsing to Stanford Dependencies. The first is PyStanfordDependencies which is a Python interface for converting Penn Treebank trees to Stanford Dependencies. It is designed to be easy to install and run (by default, it will download and use the latest version of Stanford Dependencies for you):

[code lang=text]
import StanfordDependencies
sd = StanfordDependencies.get_instance(version='3.4.1')
sent = sd.convert_tree('(S1 (NP (DT some) (JJ blue) (NN moose)))')
print sent.as_asciitree()
moose [root]
+– some [det]
+– blue [amod]

PyStanfordDependencies also includes a basic library for reading, manipulating, and producing CoNLL-X style dependency trees.

The second package is an updated version of bllipparser (better known as the Charniak-Johnson reranking parser). bllipparser gives you access to the parser and reranker from Python. The most recent update integrates bllipparser with PyStanfordDependencies allowing you parse straight from text to Stanford Dependencies. It also adds tools for reading and manipulating Penn Treebank trees.

More information is available in the READMEs. Feedback, bug reports, feature requests are welcomed (please use the GitHub issue trackers for the latter two).