Thank you very much for this information. It seems to point me to the right direction. However, I do not fully understand the flatten function and its output. Some indices seem to be inaccurate. I tried to find this function at nltk.tree.Tree.flatten, but it returns a flattened tree, not a tuple.
So your flatten function must be a different one, and it's not one of the builtins, either. Could you tell me where I can find the documentation about this flatten function? -- http://mail.python.org/mailman/listinfo/python-list