'Create a new Earley chart parser, that uses ``grammar`` to
parse texts.
:type grammar: CFG
:param grammar: The grammar used to parse texts.
:type trace: int
:param trace: The level of tracing that should be used when
parsing a text.  ``0`` will generate no tracing output;
and higher numbers will produce more verbose tracing
output.
:type trace_chart_width: int
:param trace_chart_width: The default total width reserved for
the chart in trace output.  The remainder of each line will
be used to display edges.
:param chart_class: The class that should be used to create
the charts used by this parser.'

def __init__(self, grammar, strategy=BU_LC_INCREMENTAL_STRATEGY, trace=0, trace_chart_width=50, chart_class=IncrementalChart):

    self._grammar = grammar
    self._trace = trace
    self._trace_chart_width = trace_chart_width
    self._chart_class = chart_class
    self._axioms = []
    self._inference_rules = []
    for rule in strategy:
        if (rule.NUM_EDGES == 0):
            self._axioms.append(rule)
        elif (rule.NUM_EDGES == 1):
            self._inference_rules.append(rule)
        else:
            raise ValueError('Incremental    inference    rules    must    have    NUM_EDGES    ==    0    or    1')
