'Create a new chart parser, that uses ``grammar`` to parse
texts.
:type grammar: CFG
:param grammar: The grammar used to parse texts.
:type strategy: list(ChartRuleI)
:param strategy: A list of rules that should be used to decide
what edges to add to the chart (top-down strategy by default).
: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.
:type use_agenda: bool
:param use_agenda: Use an optimized agenda-based algorithm,
if possible.
:param chart_class: The class that should be used to create
the parse charts.'

def __init__(self, grammar, strategy=BU_LC_STRATEGY, trace=0, trace_chart_width=50, use_agenda=True, chart_class=Chart):

    self._grammar = grammar
    self._strategy = strategy
    self._trace = trace
    self._trace_chart_width = trace_chart_width
    self._use_agenda = use_agenda
    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:
            self._use_agenda = False
