So I have this Stanford-style parsing of an english sentence:
所以我有斯坦福风格的英语句子解析:
"There is a tree behind a car"
Parse: [S [NP There_EX NP] [VP is_VBZ [NP [NP a_DT tree_NN NP] [PP behind_IN [NP a_DT car_NN NP] PP] NP] VP] S]
I want to use some of the tree drawing methods in python to draw a parsing tree from the data.
我想在python中使用一些树绘制方法从数据中绘制一个解析树。
Is there an easy way to use that parsing representation to draw a tree with python or should I change the representation somehow?
是否有一种简单的方法来使用该解析表示来绘制python树或者我应该以某种方式更改表示?
2 个解决方案
#1
7
NLTK has a tree
module. You can use it to parse the representation you get out of Stanford (see this related question). Then you can use nltk.tree.draw
to display it.
NLTK有一个树模块。您可以使用它来解析您从斯坦福获得的表示(请参阅此相关问题)。然后你可以使用nltk.tree.draw来显示它。
#2
0
Convert the parse into a representation that is understandable by graphviz. Then pass that representation to graphviz. There's also an interefacing library called pygraphviz.
将解析转换为graphviz可理解的表示形式。然后将该表示传递给graphviz。还有一个名为pygraphviz的接口库。
#1
7
NLTK has a tree
module. You can use it to parse the representation you get out of Stanford (see this related question). Then you can use nltk.tree.draw
to display it.
NLTK有一个树模块。您可以使用它来解析您从斯坦福获得的表示(请参阅此相关问题)。然后你可以使用nltk.tree.draw来显示它。
#2
0
Convert the parse into a representation that is understandable by graphviz. Then pass that representation to graphviz. There's also an interefacing library called pygraphviz.
将解析转换为graphviz可理解的表示形式。然后将该表示传递给graphviz。还有一个名为pygraphviz的接口库。