Is it possible to use Stanford Parser in NLTK? (I am not talking about Stanford POS.)
You can use the Stanford Parsers output to create a Tree in nltk (nltk.tree.Tree).
Assuming the stanford parser gives you a file in which there is exactly one parse tree for every sentence. Then this example works, though it might not look very pythonic:
f = open(sys.argv[1]+".output"+".30"+".stp", "r")
parse_trees_text=[]
tree = ""
for line in f:
if line.isspace():
parse_trees_text.append(tree)
tree = ""
elif "(. ...))" in line:
#print "YES"
tree = tree+')'
parse_trees_text.append(tree)
tree = ""
else:
tree = tree + line
parse_trees=[]
for t in parse_trees_text:
tree = nltk.Tree(t)
tree.__delitem__(len(tree)-1) #delete "(. .))" from tree (you don't need that)
s = traverse(tree)
parse_trees.append(tree)