I have a list of words. For example:
reel road root curd
I would like to save this data in a way that reflects the following structure:
Start -> r -> e -> reel -> o -> a -> road o -> root c -> curd
It is obvious to me that I need to implement a tree. From this tree, I should be able to easily get statistics, such as node height, number of node descendants, node search, etc. Adding a node should “automatically” add it to the correct position in the tree, since this position is unique.
He would also like to be able to visualize the data in the form of a real graphic tree. Since the tree will be huge , I will need zoom / pan controls for visualization. And of course, beautiful visualization is always better than ugly.
Does anyone know of a Python package that would allow me to achieve all this simply? Writing the code itself will take quite a while. Do you think http://packages.python.org/ete2/ is suitable for this task?
I'm on Python 2.x, btw.
I found that NLTK has a trie class - nltk.containers.trie. This is convenient for me, since I already use NLTK. Does anyone know how to use this class? I cannot find examples anywhere! For example, how to add words to trie?
Velvet ghost
source share