class CachedTopDownPredictRule(TopDownPredictRule): (source)
Known subclasses: nltk.parse.earleychart.PredictorRule, nltk.parse.featurechart.FeatureTopDownPredictRule
A cached version of TopDownPredictRule. After the first time this rule is applied to an edge with a given end and next, it will not generate any more edges for edges with that end and next.
If chart or grammar are changed, then the cache is flushed.
| Method | __init__ |
Undocumented |
| 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. |
| Instance Variable | _done |
Undocumented |
Inherited from TopDownPredictRule:
| Constant | NUM |
Undocumented |
Inherited from AbstractChartRule (via TopDownPredictRule):
| 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. |
nltk.parse.featurechart.FeatureTopDownPredictRuleReturn 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 |