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

Module distance

source code

Base distance metric representation.


Author: Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>

Classes [hide private]
  DistanceMetric
Base class for semantic distance metrics.
  FScoreMetric
Metrics that compute their distance by f-score share a lot of processing.
Functions [hide private]
 
command_line_metric(formalism, metric_name=None, options='')
Utility function to make it easy to load a metric, with user-specified options, from the command line.
source code
Variables [hide private]
  __package__ = 'jazzparser.formalisms.base.semantics'
Function Details [hide private]

command_line_metric(formalism, metric_name=None, options='')

source code 

Utility function to make it easy to load a metric, with user-specified options, from the command line. Takes care of printing help output.

Typical options:

 parser.add_option("-m", "--metric", dest="metric", action="store", 
     help="semantics distance metric to use. Use '-m help' for a list of available metrics")
 parser.add_option("--mopt", "--metric-options", dest="mopts", action="append", 
     help="options to pass to the semantics metric. Use with '--mopt help' with -m to see available options")

You could then call this as:

 metric = command_line_metric(formalism, options.metric, options.mopts)
Returns:
the metric instantiated with given options