Package nltk_lite :: Package parse :: Module chart :: Class ChartParse
[hide private]
[frames] | no frames]

Class ChartParse

source code

object --+        
         |        
    ParseI --+    
             |    
 AbstractParse --+
                 |
                ChartParse
Known Subclasses:
SteppingChartParse

A generic chart parser. A strategy, or list of ChartRules, is used to decide what edges to add to the chart. In particular, ChartParse uses the following algorithm to parse texts:

Instance Methods [hide private]
 
__init__(self, grammar, strategy, trace=0)
Create a new chart parser, that uses grammar to parse texts.
source code
list of Tree
get_parse_list(self, tokens, tree_class=<class 'nltk_lite.parse.tree.Tree'>)
Returns: A list of the parse trees for the sentence.
source code

Inherited from AbstractParse: get_parse, grammar, parse

Inherited from ParseI: get_parse_dict, get_parse_probs

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, grammar, strategy, trace=0)
(Constructor)

source code 

Create a new chart parser, that uses grammar to parse texts.

Parameters:
  • grammar (cfg.Grammar) - The grammar used to parse texts.
  • strategy (list of ChartRuleI) - A list of rules that should be used to decide what edges to add to the chart.
  • trace (int) - The level of tracing that should be used when parsing a text. 0 will generate no tracing output; and higher numbers will produce more verbose tracing output.
Overrides: AbstractParse.__init__

get_parse_list(self, tokens, tree_class=<class 'nltk_lite.parse.tree.Tree'>)

source code 
Returns: list of Tree
A list of the parse trees for the sentence. When possible, this list should be sorted from most likely to least likely.
Overrides: AbstractParse.get_parse_list