__init__(self,
start,
productions,
calculate_leftcorners=True)
(Constructor)
| source code
|
Create a new context-free grammar, from the given start state and set
of WeightedProductions.
- Parameters:
start (Nonterminal) - The start symbol
productions (list of Production) - The list of productions that defines the grammar
calculate_leftcorners (bool) - False if we don't want to calculate the leftcorner relation. In
that case, some optimized chart parsers won't work.
- Raises:
ValueError - if the set of productions with any left-hand-side do not have
probabilities that sum to a value within EPSILON of 1.
- Overrides:
ContextFreeGrammar.__init__
|