python - Color Vertices in nltk.Tree -
so drawing parse tree in nltk pretty easy. not easy trying read through vague docs , lack of examples figure out how color vertices in tree. surely feature , should easy do? here example of parse tree. i'd able specify nodes colored, example, red. how might this?
from nltk.draw.util import * nltk.draw.tree import * tree_string = "(root (s (np (dt the) (nn cat)) (vp (vbd ate) (np (dt the) (nn mouse))) (. .)))" t = tree.fromstring(tree_string) draw_trees(t)
Comments
Post a Comment