nltk.Tree.leaf_treeposition

Tree.leaf_treeposition(index)[source]
Returns:The tree position of the index-th leaf in this tree. I.e., if tp=self.leaf_treeposition(i), then self[tp]==self.leaves()[i].
Raises:IndexError – If this tree contains fewer than index+1 leaves, or if index<0.