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 BottomUpChartParse
.
BottomUpChartParse
is an abstract class that implements a
bottom-up chart parser for PCFG
s. 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:
-
InsideParse
searches edges in decreasing order of their
trees' inside probabilities.
-
RandomParse
searches edges in random order.
-
LongestParse
searches edges in decreasing order of their
location's length.
The BottomUpChartParse
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 InsideParse.
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.
|