

def parse(self, chunk_struct, trace=None):
    '\n        :type chunk_struct: Tree\n        :param chunk_struct: the chunk structure to be (further) chunked\n        :type trace: int\n        :param trace: The level of tracing that should be used when\n            parsing a text.  ``0`` will generate no tracing output;\n            ``1`` will generate normal tracing output; and ``2`` or\n            highter will generate verbose tracing output.  This value\n            overrides the trace level value that was given to the\n            constructor.\n        :rtype: Tree\n        :return: a chunk structure that encodes the chunks in a given\n            tagged sentence.  A chunk is a non-overlapping linguistic\n            group, such as a noun phrase.  The set of chunks\n            identified in the chunk structure depends on the rules\n            used to define this ``RegexpChunkParser``.\n        '
    if (len(chunk_struct) == 0):
        print('Warning: parsing empty text')
        return Tree(self._root_label, [])
    try:
        chunk_struct.label()
    except AttributeError:
        chunk_struct = Tree(self._root_label, chunk_struct)
    if (trace is None):
        trace = self._trace
    chunkstr = ChunkString(chunk_struct)
    if trace:
        verbose = (trace > 1)
        self._trace_apply(chunkstr, verbose)
    else:
        self._notrace_apply(chunkstr)
    return chunkstr.to_chunkstruct(self._chunk_label)

dataset/ETHPy150Open nltk/nltk/nltk/chunk/regexp.py RegexpChunkParser.parse/original