nltk.ImmutableTree.leaf_treeposition

ImmutableTree.leaf_treeposition(index)
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.