At Sunday 31/12/2006 14:25, vertigo wrote:
I use nltk package - but it should not matter here.
Yes, it does. The framework should provide some form of tree traversal.
So i wanted to 'travel thru my tree' to last node which should be changed:
>>> tree6 = Tree('main', ['sub1', 'sub2'])
>>> sub
Hello
I have trees like this:
>>> from nltk_lite.parse.tree import Tree
>>> tree6 = Tree('main', ['sub1', 'sub2'])
>>> tree6
('main': 'sub1' 'sub2')
I use nltk package - but it should not matter here.
I could change it's lafes (add node) like this:
>>> tree6[0] = Tree('newsub',[])
>>> tree6
('ma