class FeatureTopDownPredictRule(CachedTopDownPredictRule): (source)
Known subclasses: nltk.parse.earleychart.FeaturePredictorRule
A specialized version of the (cached) top down predict rule that operates on nonterminals whose symbols are ``FeatStructNonterminal``s. Rather than simply comparing the nonterminals for equality, they are unified.
The top down expand rule states that:
- [A -> alpha \* B1 beta][i:j]
licenses the edge:
- [B2 -> \* gamma][j:j]
for each grammar production B2 -> gamma, assuming that B1 and B2 can be unified.
| 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. |
Inherited from CachedTopDownPredictRule:
| Method | __init__ |
Undocumented |
| Instance Variable | _done |
Undocumented |
Inherited from TopDownPredictRule (via CachedTopDownPredictRule):
| Constant | NUM |
Undocumented |
Inherited from AbstractChartRule (via CachedTopDownPredictRule, 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. |
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.
| 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 |