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

Class RandomChartParser

source code

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

A bottom-up parser for PCFGs that tries edges in random order. This sorting order results in a random search strategy.

Instance Methods [hide private]
None
sort_queue(self, queue, chart)
Sort the given queue of Edges, placing the edge that should be tried first at the beginning of the queue.
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, placing the edge that should be tried first at the beginning of the queue. This method will be called after each Edge is added to the queue.

Parameters:
  • queue - 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 - 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
(inherited documentation)