espnet2.fileio.read_text.read_multi_columns_text
Less than 1 minute
espnet2.fileio.read_text.read_multi_columns_text
espnet2.fileio.read_text.read_multi_columns_text(path: Path | str, return_unsplit: bool = False) → Tuple[Dict[str, List[str]], Dict[str, str] | None]
Read a text file having 2 or more columns as dict object.
Examples
wav.scp: : key1 /some/path/a1.wav /some/path/a2.wav key2 /some/path/b1.wav /some/path/b2.wav /some/path/b3.wav key3 /some/path/c1.wav …
>>> read_multi_columns_text('wav.scp')
{'key1': ['/some/path/a1.wav', '/some/path/a2.wav'],
'key2': ['/some/path/b1.wav', '/some/path/b2.wav', '/some/path/b3.wav'],
'key3': ['/some/path/c1.wav']}