class documentation
class TopDownPredictRule(AbstractChartRule): (source)
Known subclasses: nltk.app.chartparser_app.TopDownPredictEdgeRule, nltk.parse.chart.CachedTopDownPredictRule
A rule licensing edges corresponding to the grammar productions for the nonterminal following an incomplete edge's dot. In particular, this rule specifies that [A -> alpha \* B beta][i:j] licenses the edge [B -> \* gamma][j:j] for each grammar production B -> gamma.
| Note | |
| This rule corresponds to the Predictor Rule in Earley parsing. |
| Method | apply |
Return a generator that will add edges licensed by this rule and the given edges to the chart, one at a time. Each time the generator is resumed, it will either add a new edge and yield that edge; or return. |
| Constant | NUM |
Undocumented |
Inherited from AbstractChartRule:
| Method | __str__ |
Undocumented |
| Method | apply |
Return a generator that will add all edges licensed by this rule, given the edges that are currently in the chart, one at a time. Each time the generator is resumed, it will either add a new edge and yield that edge; or return. |
overrides
nltk.parse.chart.AbstractChartRule.applyoverridden in
nltk.parse.chart.CachedTopDownPredictRuleReturn a generator that will add edges licensed by this rule and the given edges to the chart, one at a time. Each time the generator is resumed, it will either add a new edge and yield that edge; or return.
| Parameters | |
| chart | Undocumented |
| grammar | Undocumented |
| edge | Undocumented |
| *edges:list(EdgeI) | A set of existing edges. The number of edges that should be passed to apply() is specified by the NUM_EDGES class variable. |
| Returns | |
| iter(EdgeI) | Undocumented |