class nltk.InsideChartParser(grammar, beam_size=0, trace=0)[source]

A bottom-up parser for PCFG grammars that tries edges in descending order of the inside probabilities of their trees. The “inside probability” of a tree is simply the probability of the entire tree, ignoring its context. In particular, the inside probability of a tree generated by production p with children c[1], c[2], ..., c[n] is P(p)P(c[1])P(c[2])...P(c[n]); and the inside probability of a token is 1 if it is present in the text, and 0 if it is absent.

This sorting order results in a type of lowest-cost-first search strategy.


__init__(grammar[, beam_size, trace]) Create a new BottomUpProbabilisticChartParser, that uses grammar to parse texts.
parse_all(sent, *args, **kwargs)
parse_one(sent, *args, **kwargs)
rtype:Tree or None
parse_sents(sents, *args, **kwargs) Apply self.parse() to each element of sents.
sort_queue(queue, chart) Sort the given queue of edges, in descending order of the inside probabilities of the edges’ trees.
trace([trace]) Set the level of tracing output that should be generated when parsing a text.