Package nltk :: Package parse :: Module pchart :: Class InsideChartParser
[hide private]
[frames] | no frames]

Class InsideChartParser

source code

     object --+        
              |        
    api.ParserI --+    
                  |    
BottomUpChartParser --+
                      |
                     InsideChartParser
Known Subclasses:

A bottom-up parser for PCFGs 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.

Instance Methods [hide private]
None
sort_queue(self, queue, chart)
Sort the given queue of edges, in descending order of the inside probabilities of the edges' trees.
source code

Inherited from BottomUpChartParser: __init__, grammar, nbest_parse, trace

Inherited from BottomUpChartParser (private): _prune, _setprob

Inherited from api.ParserI: batch_iter_parse, batch_nbest_parse, batch_parse, batch_prob_parse, iter_parse, parse, prob_parse

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

    Deprecated

Inherited from api.ParserI: batch_test, get_parse, get_parse_dict, get_parse_list, get_parse_prob

Instance Variables [hide private]

Inherited from BottomUpChartParser (private): _grammar, _trace

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

sort_queue(self, queue, chart)

source code 

Sort the given queue of edges, in descending order of the inside probabilities of the edges' trees.

Parameters:
  • queue (list of Edge) - The queue of Edges to sort. Each edge in this queue is an edge that could be added to the chart by the fundamental rule; but that has not yet been added.
  • chart (Chart) - The chart being used to parse the text. This chart can be used to provide extra information for sorting the queue.
Returns: None
Overrides: BottomUpChartParser.sort_queue