'Create a new context-free grammar, from the given start state
and set of ``ProbabilisticProductions``.
:param start: The start symbol
:type start: Nonterminal
:param productions: The list of productions that defines the grammar
:type productions: list(Production)
:raise ValueError: if the set of productions with any left-hand-side
do not have probabilities that sum to a value within
EPSILON of 1.
:param calculate_leftcorners: False if we don\'t want to calculate the
leftcorner relation. In that case, some optimized chart parsers won\'t work.
:type calculate_leftcorners: bool'

def __init__(self, start, productions, calculate_leftcorners=True):

    CFG.__init__(self, start, productions, calculate_leftcorners)
    probs = {}
    for production in productions:
        probs[production.lhs()] = (probs.get(production.lhs(), 0) + production.prob())
    for (lhs, p) in probs.items():
        if (not ((1 - PCFG.EPSILON) < p < (1 + PCFG.EPSILON))):
            raise ValueError((u'Productions    for    %r    do    not    sum    to    1' % lhs))
