Closed alxwrd closed 6 years ago
This changes Word.tree() so it returns the treelib.Tree object.
Word.tree()
treelib.Tree
I also added using the data keyword argument for create_node as mentioned here: http://treelib.readthedocs.io/en/latest/examples.html#advanced-usage
data
create_node
>>> aero_tree = ety.tree("aerodynamically") >>> aero_tree <treelib.tree.Tree object at 0x7f5cd5c9dfd0> >>> print(aero_tree) aerodynamically (English) ├── -ally (English) └── aerodynamic (English) ├── aero- (English) │ └── ἀήρ (Ancient Greek (to 1453)) └── dynamic (English) └── dynamique (French) └── δυναμικός (Ancient Greek (to 1453)) └── δύναμις (Ancient Greek (to 1453)) └── δύναμαι (Ancient Greek (to 1453)) >>> aero_tree.show(data_property="language") English ├── English └── English ├── English │ └── Ancient Greek (to 1453) └── English └── French └── Ancient Greek (to 1453) └── Ancient Greek (to 1453) └── Ancient Greek (to 1453) >>> aero_tree.show(data_property="word") aerodynamically ├── -ally └── aerodynamic ├── aero- │ └── ἀήρ └── dynamic └── dynamique └── δυναμικός └── δύναμις └── δύναμαι
I didn't know you could do that 😲 looks cool
This changes
Word.tree()
so it returns thetreelib.Tree
object.I also added using the
data
keyword argument forcreate_node
as mentioned here: http://treelib.readthedocs.io/en/latest/examples.html#advanced-usage