nltk.PCFG.fromstring

classmethod PCFG.fromstring(input, encoding=None)[source]

Return a probabilistic PCFG corresponding to the input string(s).

Parameters:input – a grammar, either in the form of a string or else as a list of strings.