nltk.SteppingRecursiveDescentParser.expand

SteppingRecursiveDescentParser.expand(production=None)[source]

Expand the first element of the frontier. In particular, if the first element of the frontier is a subtree whose node type is equal to production‘s left hand side, then add a child to that subtree for each element of production‘s right hand side. If production is not specified, then use the first untried expandable production. If all expandable productions have been tried, do nothing.

Returns:The production used to expand the frontier, if an expansion was performed. If no expansion was performed, return None.
Return type:Production or None