Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A file to print parse trees from standard input using NLTK
#!/usr/bin/python
from nltk.tree import Tree
import sys
# A program to display parse trees (in Penn treebank format) with NLTK
#
# To install NLTK on ubuntu: sudo apt-get install python-nltk
for line in sys.stdin:
t = Tree.parse(line)
t.draw()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment