nltk.CFG.fromstring

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

Return the CFG corresponding to the input string(s).

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