Visualize the parse tree
xiaohy9 opened this issue · comments
xiaohy9 commented
I’d like to visualize the parse tree from Berkeley Neural Parser. But I couldn’t find the function in the package. Could you give me the hint how to generate the tree graph as in the online demo site:
https://parser.kitaev.io/
if this function is not part of the package, please consider adding it. thanks a lot!
Christina Lohr commented
Hi, I had the same problem and I have solved it with nltk lib :
`
do spacy and benepar comands before.
import nltk
from nltk import Tree, ParentedTree
parse_tree = ParentedTree.fromstring('(' + sent._.parse_string + ')')
print(parse_tree.pretty_print())
`
BR, Christina