nltk.CFG.productions¶
-
CFG.
productions
(lhs=None, rhs=None, empty=False)[source]¶ Return the grammar productions, filtered by the left-hand side or the first item in the right-hand side.
Parameters: - lhs – Only return productions with the given left-hand side.
- rhs – Only return productions with the given first item in the right-hand side.
- empty – Only return productions with an empty right-hand side.
Returns: A list of productions matching the given constraints.
Return type: list(Production)