speechmatics.helpers¶
Helper functions used by the library.
- speechmatics.helpers.del_none(dictionary)[source]¶
Recursively delete from the dictionary all entries which values are None. This function changes the input parameter in place.
- Parameters
dictionary (dict) – input dictionary
- Returns
output dictionary
- Return type
dict
- speechmatics.helpers.get_version() str [source]¶
Reads the version number from the package or from VERSION file in case the package information is not found.
- Returns
the library version
- Return type
str
- speechmatics.helpers.json_utf8(func)[source]¶
A decorator to turn a function’s return value into JSON
- async speechmatics.helpers.read_in_chunks(stream, chunk_size)[source]¶
Utility method for reading in and yielding chunks
- Parameters
stream (io.IOBase) – file-like object to read audio from
chunk_size (int) – maximum chunk size in bytes
- Raises
ValueError – if no data was read from the stream
- Returns
a sequence of chunks of data where the length in bytes of each chunk is <= max_sample_size and a multiple of max_sample_size
- Return type
collections.AsyncIterable