def renumber(self):
        """Destructively renumber the indices based on the actual tokens
        (e.g., if there are gaps between token indices, this will remove
        them). Old Token objects will still exist, so you'll need to
        update your references."""
        mapping = {0: 0} # old index -> real index
        needs_renumbering = False
        for real_index, token in enumerate(self, 1):
            mapping[token.index] = real_index
            if token.index != real_index:
                needs_renumbering = True

        if needs_renumbering:
            # update all indices
            self[:] = [token._replace(index=mapping[token.index],
                                      head=mapping[token.head])
                       for token in self]
Destructively renumber the indices based on the actual tokens
        (e.g., if there are gaps between token indices, this will remove
        them). Old Token objects will still exist, so you'll need to
        update your references.