config Package

skll.config.fix_json(json_string)[source]

Fixes incorrectly formatted quotes and capitalized booleans in the given JSON string.

Parameters:json_string (str) – A JSON-style string.
Returns:json_string – The normalized JSON string.
Return type:str
skll.config.load_cv_folds(folds_file, ids_to_floats=False)[source]

Loads cross-validation folds from a CSV file with two columns for example ID and fold ID (and a header).

Parameters:
  • folds_file (str) – The path to a folds file to read.
  • ids_to_floats (bool, optional) – Whether to convert IDs to floats. Defaults to False.
Returns:

res – A dictionary with example IDs as the keys and fold IDs as the values.

Return type:

dict

Raises:

ValueError – If example IDs cannot be converted to floats and ids_to_floats is True.

skll.config.locate_file(file_path, config_dir)[source]

Locate a file, given a file path and configuration directory.

Parameters:
  • file_path (str) – The file to locate. Path may be absolute or relative.
  • config_dir (str) – The path to the configuration file directory.
Returns:

path_to_check – The normalized absolute path, if it exists.

Return type:

str

Raises:

IOError – If the file does not exist.