nikitakit / self-attentive-parser

High-accuracy NLP parser with models for 11 languages.

Home Page:https://parser.kitaev.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Visualize the parse tree

xiaohy9 opened this issue · comments

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!

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