

def to_chunkstruct(self, chunk_label='CHUNK'):
    '\n        Return the chunk structure encoded by this ``ChunkString``.\n\n        :rtype: Tree\n        :raise ValueError: If a transformation has generated an\n            invalid chunkstring.\n        '
    if (self._debug > 0):
        self._verify(self._str, 1)
    pieces = []
    index = 0
    piece_in_chunk = 0
    for piece in re.split('[{}]', self._str):
        length = piece.count('<')
        subsequence = self._pieces[index:(index + length)]
        if piece_in_chunk:
            pieces.append(Tree(chunk_label, subsequence))
        else:
            pieces += subsequence
        index += length
        piece_in_chunk = (not piece_in_chunk)
    return Tree(index._root_label, pieces)

dataset/ETHPy150Open nltk/nltk/nltk/chunk/regexp.py ChunkString.to_chunkstruct/VarMisuse@134/241 `self`->`index`