Package jazzparser :: Package utils :: Module options
[hide private]
[frames] | no frames]

Module options

source code

Framework for specifying multiple options to a module on the command line.

For modules like taggers and parsers, the options available will vary depending on what component is selected. This framework allows a specific component to list its available options and how they should be interpreted.

This is one of my greater works of genius to be found in this codebase. It's incredibly useful so often.


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

Classes [hide private]
  UnprocessedOptionValue
Simple wrapper for strings to mark that they haven't yet been processed as option values.
  ModuleOption
An option that can be specified on the command line and that is specific to a certain modular component (e.g.
  ModuleOptionError
Functions [hide private]
 
options_help_text(options, intro=None)
Produces a load of help text to output to the command line to display the usage of all of the options in the list.
source code
 
file_option(value)
A filter function for filenames of existing files.
source code
 
new_file_option(value)
A filter function for a new filename.
source code
 
zero_to_one_float(value)
A filter function for floats that should lie between 0.0 and 1.0.
source code
 
choose_from_dict(dic)
Filter function constructor.
source code
 
choose_from_list(lst)
Filter function constructor.
source code
Variables [hide private]
  __package__ = None
hash(x)
Function Details [hide private]

file_option(value)

source code 

A filter function for filenames of existing files. Errors if the file doesn't exist.

new_file_option(value)

source code 

A filter function for a new filename. Doesn't require the file to exist, but errors if the directory doesn't exist.

zero_to_one_float(value)

source code 

A filter function for floats that should lie between 0.0 and 1.0.

Accepts the range ends (0.0 and 1.0). Raises an errror for any incorrectly formatted numbers or numbers outside this range.

This is useful for probabilities or ratios.

choose_from_dict(dic)

source code 

Filter function constructor. Returns a filter function that will verify that the filtered value is among the dic's keys and return the corresponding value if it is.

choose_from_list(lst)

source code 

Filter function constructor.

Returns a filter function that will verify that the value is one of those in the list and then just return that value if it is.