nltk.parse.ChartParser.__init__¶
-
ChartParser.
__init__
(grammar, strategy=[<nltk.parse.chart.LeafInitRule object at 0x2b21a94e1250>, <nltk.parse.chart.EmptyPredictRule object at 0x2b21a94e1290>, <nltk.parse.chart.BottomUpPredictCombineRule object at 0x2b21a94e12d0>, <nltk.parse.chart.SingleEdgeFundamentalRule object at 0x2b21a94e1310>], trace=0, trace_chart_width=50, use_agenda=True, chart_class=<class 'nltk.parse.chart.Chart'>)[source]¶ Create a new chart parser, that uses
grammar
to parse texts.Parameters: - grammar (CFG) – The grammar used to parse texts.
- strategy (list(ChartRuleI)) – A list of rules that should be used to decide what edges to add to the chart (top-down strategy by default).
- trace (int) – 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. - trace_chart_width (int) – The default total width reserved for the chart in trace output. The remainder of each line will be used to display edges.
- use_agenda (bool) – Use an optimized agenda-based algorithm, if possible.
- chart_class – The class that should be used to create the parse charts.