def _verify(self, s, verify_tags):
        # Check overall form
        if not ChunkString._VALID.match(s):
            raise ValueError('Transformation generated invalid '
                             'chunkstring:\n  %s' % s)

        # Check that parens are balanced.  If the string is long, we
        # have to do this in pieces, to avoid a maximum recursion
        # depth limit for regular expressions.
        brackets = ChunkString._BRACKETS.sub('', s)
        for i in range(1 + len(brackets) // 5000):
            substr = brackets[i*5000:i*5000+5000]
            if not ChunkString._BALANCED_BRACKETS.match(substr):
                raise ValueError('Transformation generated invalid '
                                 'chunkstring:\n  %s' % s)

        if verify_tags<=0: return

        tags1 = (re.split(r'[\{\}<>]+', s))[1:-1]
        tags2 = [self._tag(piece) for piece in self._pieces]
        if tags1 != tags2:
            raise ValueError('Transformation generated invalid '
                             'chunkstring: tag changed')
Check to make sure that ``s`` still corresponds to some chunked
dataset/ETHPy150Open nltk/nltk/nltk/chunk/regexp.py/ChunkString._verify