nltk.parse.IncrementalChartParser
¶
-
class
nltk.parse.
IncrementalChartParser
(grammar, strategy=[<nltk.parse.chart.LeafInitRule object at 0x2b21a94fb150>, <nltk.parse.chart.EmptyPredictRule object at 0x2b21a94fb190>, <nltk.parse.chart.BottomUpPredictCombineRule object at 0x2b21a94fb1d0>, <nltk.parse.earleychart.CompleteFundamentalRule object at 0x2b21a94fb210>], trace=0, trace_chart_width=50, chart_class=<class 'nltk.parse.earleychart.IncrementalChart'>)[source]¶ An incremental chart parser implementing Jay Earley’s parsing algorithm:
For each index end in [0, 1, ..., N]:For each edge such that edge.end = end:If edge is incomplete and edge.next is not a part of speech:Apply PredictorRule to edgeIf edge is incomplete and edge.next is a part of speech:Apply ScannerRule to edgeIf edge is complete:Apply CompleterRule to edgeReturn any complete parses in the chart
Methods¶
__init__ (grammar[, strategy, trace, ...]) |
Create a new Earley chart parser, that uses grammar to parse texts. |
||
chart_parse (tokens[, trace]) |
|||
grammar () |
|||
parse (tokens[, tree_class]) |
|||
parse_all (sent, *args, **kwargs) |
|
||
parse_one (sent, *args, **kwargs) |
|
||
parse_sents (sents, *args, **kwargs) |
Apply self.parse() to each element of sents . |