Package jazzparser :: Package parsers :: Package tagrank :: Module chart :: Class TagRankChart
[hide private]
[frames] | no frames]

Class TagRankChart

source code

     object --+    
              |    
cky.chart.Chart --+
                  |
                 TagRankChart

Overrides the CKY chart to add probabilistic stuff.

Signs in the input should have an attribute 'probability'. The results of rule application will also have such an attribute.

Nested Classes [hide private]
  HASH_SET_IMPL
For this chart's internal data structure, we use a modified implementation of the HashSet which adds some basic handling of the tag probabilities that came from the tagger's model.
Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_get_ranked_parses(self)
Full parses ranked by probability.
source code
 
apply_unary_rule(self, rule, start, end, beam=True)
Applies a given unary rule to particular arcs and adds the results to the chart.
source code
 
_apply_binary_rule(self, rule, sign_pair)
Override to provide probability propagation.
source code
 
_apply_binary_rule_semantics(self, rule, sign_pair, category)
Like _apply_binary_rule, but uses the apply_rule_semantics() of the rule instead of apply_rule().
source code
 
apply_binary_rules(self, start, middle, end, beam=True)
Add to the chart all signs resulting from possible applications of binary rules to pairs of signs between node pairs (start,middle) and (middle,end), producing entries in (start,end).
source code
 
apply_binary_rule(self, rule, start, middle, end, beam=True)
Apply a given binary rule to particular arcs in the chart.
source code
 
apply_beam(self, arc=None)
Applies a beam to every arc in the chart.
source code
 
_sign_string(self, sign) source code
 
launch_inspector(self, input=None)
Starts up a graphical chart inspector to inspect this chart.
source code

Inherited from cky.chart.Chart: __len__, __str__, add_word_signs, apply_unary_rules, get_grouped_sign_pairs, get_grouped_signs, get_sign, get_sign_pairs, get_signs, kill_inspector, to_string

Inherited from cky.chart.Chart (private): _get_parses, _get_summary

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]
  ranked_parses
Full parses ranked by probability.

Inherited from cky.chart.Chart: parses, size, summary

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

_get_ranked_parses(self)

source code 

Full parses ranked by probability. Returns a list.

apply_unary_rule(self, rule, start, end, beam=True)

source code 

Applies a given unary rule to particular arcs and adds the results to the chart.

Parameters:
  • result_modifier - function to be applied to each result, taking the result sign as the first argument and the input sign as the second.
Overrides: cky.chart.Chart.apply_unary_rule
(inherited documentation)

_apply_binary_rule(self, rule, sign_pair)

source code 

Override to provide probability propagation.

See jazzparser.parsers.cky.chart.Chart._apply_binary_rule for full doc.

Overrides: cky.chart.Chart._apply_binary_rule

_apply_binary_rule_semantics(self, rule, sign_pair, category)

source code 

Like _apply_binary_rule, but uses the apply_rule_semantics() of the rule instead of apply_rule().

Extends the overridden method to add probabilities.

Overrides: cky.chart.Chart._apply_binary_rule_semantics

See Also: jazzparser.parsers.cky.chart.Chart._apply_binary_rule_semantics

apply_binary_rules(self, start, middle, end, beam=True)

source code 

Add to the chart all signs resulting from possible applications of binary rules to pairs of signs between node pairs (start,middle) and (middle,end), producing entries in (start,end).

Returns:
True if signs were added as a result of rule application, False otherwise
Overrides: cky.chart.Chart.apply_binary_rules
(inherited documentation)

apply_binary_rule(self, rule, start, middle, end, beam=True)

source code 

Apply a given binary rule to particular arcs in the chart.

Note that this method is not used by apply_binary_rules for efficiency reasons, but apply_binary_rules simply does the same thing for all possible binary rules.

Overrides: cky.chart.Chart.apply_binary_rule
(inherited documentation)

apply_beam(self, arc=None)

source code 

Applies a beam to every arc in the chart. If arc is given, it should be a tuple of (start,end): applies a beam only to the arc starting at start and ending at end. Note that the beam will not be applied to any leaves (lexical arcs) in the chart.

_sign_string(self, sign)

source code 
Overrides: cky.chart.Chart._sign_string

launch_inspector(self, input=None)

source code 

Starts up a graphical chart inspector to inspect this chart. The inspector will run in a separate thread. Subclasses of Chart should override this if they have their own version of the chart inspector and instantiate that instead.

Parameters:
  • input - a string representation of the input to pass to the inspector so it can display it.
Overrides: cky.chart.Chart.launch_inspector
(inherited documentation)

Property Details [hide private]

ranked_parses

Full parses ranked by probability. Returns a list.

Get Method:
_get_ranked_parses(self) - Full parses ranked by probability.