Package nltk :: Package parse :: Module chart :: Class AbstractChartRule
[hide private]
[frames] | no frames]

type AbstractChartRule

source code

object --+    
         |    
ChartRuleI --+
             |
            AbstractChartRule
Known Subclasses:

An abstract base class for chart rules. AbstractChartRule provides:

Instance Methods [hide private]
iter of EdgeI
apply_iter(self, chart, grammar, *edges)
Returns: A generator that will add edges licensed by this rule and the given edges to the chart, one at a time.
source code
iter of EdgeI
apply_everywhere_iter(self, chart, grammar)
Returns: A generator that will add all edges licensed by this rule, given the edges that are currently in the chart, one at a time.
source code
list of EdgeI
apply(self, chart, grammar, *edges)
Add the edges licensed by this rule and the given edges to the chart.
source code
list of EdgeI
apply_everywhere(self, chart, grammar)
Add all the edges licensed by this rule and the edges in the chart to the chart.
source code
 
__str__(self) source code
Class Variables [hide private]

Inherited from ChartRuleI: NUM_EDGES

Method Details [hide private]

apply_iter(self, chart, grammar, *edges)

source code 
Parameters:
  • edges - 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 of EdgeI
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.
Overrides: ChartRuleI.apply_iter
(inherited documentation)

apply_everywhere_iter(self, chart, grammar)

source code 
Returns: iter of EdgeI
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: ChartRuleI.apply_everywhere_iter
(inherited documentation)

apply(self, chart, grammar, *edges)

source code 

Add the edges licensed by this rule and the given edges to the chart.

Parameters:
  • edges - A set of existing edges. The number of edges that should be passed to apply is specified by the NUM_EDGES class variable.
Returns: list of EdgeI
A list of the edges that were added.
Overrides: ChartRuleI.apply
(inherited documentation)

apply_everywhere(self, chart, grammar)

source code 

Add all the edges licensed by this rule and the edges in the chart to the chart.

Returns: list of EdgeI
A list of the edges that were added.
Overrides: ChartRuleI.apply_everywhere
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 
Overrides: object.__str__
(inherited documentation)