espnet3.utils.scp_utils.read_scp
Less than 1 minute
espnet3.utils.scp_utils.read_scp
espnet3.utils.scp_utils.read_scp(scp_file)
Read a Kaldi-style SCP file into a key/value dictionary.
Each non-empty line is parsed as <key><space><value>. If a line contains only a key, the value is set to an empty string.
- Parameters:scp_file – Path-like object pointing to an SCP text file.
- Returns: Mapping from key to the rest of the line (value string).
- Return type: dict
- Raises:
- FileNotFoundError – If
scp_filedoes not exist. - OSError – If the file cannot be read.
- FileNotFoundError – If
Example
>>> d = read_scp("data/text.scp")
>>> list(d.items())[:1]