tree_to_treesegment(canvas,
t,
make_node=<class 'nltk.draw.TextWidget'>,
make_leaf=<class 'nltk.draw.TextWidget'>,
**attribs)
| source code
|
Convert a Tree into a TreeSegmentWidget .
- Parameters:
make_node - A CanvasWidget constructor or a function that
creates CanvasWidgets . make_node is
used to convert the Tree 's nodes into
CanvasWidgets . If no constructor is specified, then
TextWidget will be used.
make_leaf - A CanvasWidget constructor or a function that
creates CanvasWidgets . make_leaf is
used to convert the Tree 's leafs into
CanvasWidgets . If no constructor is specified, then
TextWidget will be used.
attribs - Attributes for the canvas widgets that make up the returned
TreeSegmentWidget . Any attribute beginning with
'tree_' will be passed to all
TreeSegmentWidget s (with the 'tree_'
prefix removed. Any attribute beginning with
'node_' will be passed to all nodes. Any attribute
beginning with 'leaf_' will be passed to all leaves.
And any attribute beginning with 'loc_' will be
passed to all text locations (for Tree s).
|