Utilities

CREMA utilities

crema.utils.base(filename)

Identify a file by its basename:

/path/to/base.name.ext => base.name

Parameters:
filename : str

Path to the file

Returns:
base : str

The base name of the file

crema.utils.get_ann_audio(directory)

Get a list of annotations and audio files from a directory.

This also validates that the lengths match and are paired properly.

Parameters:
directory : str

The directory to search

Returns:
pairs : list of tuples (audio_file, annotation_file)
crema.utils.git_version()

Return the git revision as a string

Returns:
git_version : str

The current git revision

crema.utils.increment_version(filename)

Increment a model version identifier.

Parameters:
filename : str

The file containing the model version

Returns:
model_version : str

The new model version. This version will also be written out to filename.

crema.utils.load_h5(filename)

Load data from an hdf5 file created by save_h5.

Parameters:
filename : str

Path to the hdf5 file

Returns:
data : dict

The key-value data stored in filename

See also

save_h5
crema.utils.save_h5(filename, **kwargs)

Save data to an hdf5 file.

Parameters:
filename : str

Path to the file

kwargs

key-value pairs of data

See also

load_h5