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
|