def __init__(self, grammar, trace=0, **property_names): """ Create a new C{BottomUpPCFGChartParser}, that uses C{grammar} to parse texts. @type grammar: C{PCFG} @param grammar: The grammar used to parse texts. @type trace: C{int} @param trace: The level of tracing that should be used when parsing a text. C{0} will generate no tracing output; and higher numbers will produce more verbose tracing output. """ assert _chktype(1, grammar, PCFG) assert _chktype(2, trace, types.IntType) self._grammar = grammar self._trace = trace AbstractParser.__init__(self, **property_names)
def __init__(self, grammar, trace=0, guessUnknown=0, spellchecker=None, **property_names): """ Create a new C{ViterbiPCFGParser}, that uses {grammar} to parse texts. @type grammar: C{PCFG} @param grammar: The grammar used to parse texts. @type trace: C{int} @param trace: The level of tracing that should be used when parsing a text. C{0} will generate no tracing output; and higher numbers will produce more verbose tracing output. """ assert _chktype(1, grammar, PCFG) assert _chktype(2, trace, types.IntType) self._grammar = grammar self._trace = trace self._guessUnknown = guessUnknown self._guessKnown = 0 self._spellchecker = spellchecker AbstractParser.__init__(self, **property_names)