Package jazzparser :: Package formalisms :: Package base :: Package semantics :: Module distance :: Class DistanceMetric
[hide private]
[frames] | no frames]

Class DistanceMetric

source code

object --+
         |
        DistanceMetric
Known Subclasses:

Base class for semantic distance metrics. Formalism-specific distance metrics should be provided as subclasses of this.

Instance Methods [hide private]
 
__init__(self, options={})
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_get_identifier(self)
A human-readable identifier for the metric represented by this instance.
source code
 
distance(self, sem1, sem2)
Compares the two semantics instances and returns a float distance between them.
source code
 
print_computation(self, sem1, sem2)
Produces a string showing a derivation of the distance metric that would be returned for the given inputs.
source code
 
total_distance(self, input_pairs)
Returns the distances summed over the given pairs of inputs.
source code
 
format_distance(self, dist)
Format a distance value (as returned from distance or total_distance) as a string suitable for human-readable output.
source code

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

Class Variables [hide private]
  OPTIONS = []
  name = 'base'
Properties [hide private]
  identifier
A human-readable identifier for the metric represented by this instance.

Inherited from object: __class__

Method Details [hide private]

__init__(self, options={})
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

print_computation(self, sem1, sem2)

source code 

Produces a string showing a derivation of the distance metric that would be returned for the given inputs. This is useful for debugging the metric.

Subclasses are not required to provide this, and there may not always be something sensible to show.

total_distance(self, input_pairs)

source code 

Returns the distances summed over the given pairs of inputs. By default, this will just be the sum of the individual distances, but in some cases it may be necessary to do something else, as with f-score.

The input pairs may continue None values. For example, if evaluating the distance of parse results from the gold standard, there may be inputs for which no parse result is obtained. It doesn't make sense, however, for both of the pair to be None.


Property Details [hide private]

identifier

A human-readable identifier for the metric represented by this instance.

Get Method:
_get_identifier(self) - A human-readable identifier for the metric represented by this instance.