Package jazzparser :: Package parsers :: Package pcfg :: Module chart :: Class ProbabilisticSignHashSet
[hide private]
[frames] | no frames]

Class ProbabilisticSignHashSet

source code

       object --+        
                |        
     data.HashSet --+    
                    |    
cky.chart.SignHashSet --+
                        |
                       ProbabilisticSignHashSet

For this chart's internal data structure, we use a modified implementation of the HashSet which adds handling of probabilities.

All probabilities are logged,

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_add_existing_value(self, existing_value, new_value)
When a value already exists in the table, this is called instead of adding the value.
source code
 
_max_probability(self) source code
 
append(self, *args, **kwargs)
There's no point in applying a beam if nothing's been added to the set and it's already been applied.
source code
 
remove(self, *args, **kwargs)
Overrides remove() to maintain the index of signs grouped by category.
source code
 
_apply_beam(self)
Applies a beam, using the already given threshold, to the set, pruning out any signs with a probability lower than the given ratio of the most probable sign.
source code
 
ranked(self)
Returns the signs in the set ranked by probability (highest first).
source code

Inherited from cky.chart.SignHashSet: get_distinct_categories, get_signs_by_category, get_signs_grouped_by_category

Inherited from data.HashSet: __contains__, __len__, extend, values

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

Properties [hide private]

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)

_add_existing_value(self, existing_value, new_value)

source code 

When a value already exists in the table, this is called instead of adding the value. By default, it does nothing (i.e. drops the new value), but you can override it if you want to do something else to combine the values.

Note that your custom methods must only modify the sign that's already in the set (existing_value), not add a new sign and not modify new_value.

Overrides: data.HashSet._add_existing_value
(inherited documentation)

append(self, *args, **kwargs)

source code 

There's no point in applying a beam if nothing's been added to the set and it's already been applied. Note that something's been added.

Overrides: data.HashSet.append

remove(self, *args, **kwargs)

source code 

Overrides remove() to maintain the index of signs grouped by category.

See jazzparser.data.HashSet for main doc.

Overrides: data.HashSet.remove