

def xform(self, regexp, repl):
    '\n        Apply the given transformation to the string encoding of this\n        ``ChunkString``.  In particular, find all occurrences that match\n        ``regexp``, and replace them using ``repl`` (as done by\n        ``re.sub``).\n\n        This transformation should only add and remove braces; it\n        should *not* modify the sequence of angle-bracket delimited\n        tags.  Furthermore, this transformation may not result in\n        improper bracketing.  Note, in particular, that bracketing may\n        not be nested.\n\n        :type regexp: str or regexp\n        :param regexp: A regular expression matching the substring\n            that should be replaced.  This will typically include a\n            named group, which can be used by ``repl``.\n        :type repl: str\n        :param repl: An expression specifying what should replace the\n            matched substring.  Typically, this will include a named\n            replacement group, specified by ``regexp``.\n        :rtype: None\n        :raise ValueError: If this transformation generated an\n            invalid chunkstring.\n        '
    s = re.sub(regexp, repl, self._str)
    s = re.sub('\\{\\}', '', s)
    if (self._debug > 1):
        self._verify(s, (self._debug - 2))
    self._str = s

dataset/ETHPy150Open nltk/nltk/nltk/chunk/regexp.py ChunkString.xform/original