class documentation

class FeatureFundamentalRule(FundamentalRule): (source)

View In Hierarchy

A specialized version of the fundamental rule that operates on nonterminals whose symbols are ``FeatStructNonterminal``s. Rather tha simply comparing the nonterminals for equality, they are unified. Variable bindings from these unifications are collected and stored in the chart using a ``FeatureTreeEdge``. When a complete edge is generated, these bindings are applied to all nonterminals in the edge. The fundamental rule states that: - ``[A -> alpha \* B1 beta][i:j]`` - ``[B2 -> gamma \*][j:k]`` licenses the edge: - ``[A -> alpha B3 \* beta][i:j]`` assuming that B1 and B2 can be unified to generate B3.

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 FundamentalRule:

Constant NUM_EDGES Undocumented

Inherited from AbstractChartRule (via FundamentalRule):

Method __str__ Undocumented
Method apply_everywhere 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.
def apply(self, chart, grammar, left_edge, right_edge): (source) ΒΆ

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
chartUndocumented
grammarUndocumented
left_edgeUndocumented
right_edgeUndocumented
*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