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

Module pchart

source code

Classes and interfaces for associating probabilities with tree structures that represent the internal organization of a text. The probabilistic parser module defines BottomUpChartParser.

BottomUpChartParser is an abstract class that implements a bottom-up chart parser for PCFGs. It maintains a queue of edges, and adds them to the chart one at a time. The ordering of this queue is based on the probabilities associated with the edges, allowing the parser to expand more likely edges before less likely ones. Each subclass implements a different queue ordering, producing different search strategies. Currently the following subclasses are defined:

The BottomUpChartParser constructor has an optional argument beam_size. If non-zero, this controls the size of the beam (aka the edge queue). This option is most useful with InsideChartParser.

Classes [hide private]
  ProbabilisticLeafEdge
  ProbabilisticTreeEdge
  BottomUpInitRule
  BottomUpPredictRule
  ProbabilisticFundamentalRule
  SingleEdgeProbabilisticFundamentalRule
  BottomUpChartParser
An abstract bottom-up parser for PCFGs that uses a Chart to record partial results.
  InsideChartParser
A bottom-up parser for PCFGs that tries edges in descending order of the inside probabilities of their trees.
  RandomChartParser
A bottom-up parser for PCFGs that tries edges in random order.
  UnsortedChartParser
A bottom-up parser for PCFGs that tries edges in whatever order.
  LongestChartParser
A bottom-up parser for PCFGs that tries longer edges before shorter ones.
Functions [hide private]
 
demo()
A demonstration of the probabilistic parsers.
source code
Function Details [hide private]

demo()

source code 

A demonstration of the probabilistic parsers. The user is prompted to select which demo to run, and how many parses should be found; and then each parser is run on the same demo, and a summary of the results are displayed.