Initialize HDF5 scp loader. Args: feats_scp (str): Kaldi-style feats.scp file with hdf5 format. default_hdf5_path (str): Path in hdf5 file. If the scp contain the info, not used.
(self, feats_scp, default_hdf5_path="feats")
| 129 | """ |
| 130 | |
| 131 | def __init__(self, feats_scp, default_hdf5_path="feats"): |
| 132 | """Initialize HDF5 scp loader. |
| 133 | |
| 134 | Args: |
| 135 | feats_scp (str): Kaldi-style feats.scp file with hdf5 format. |
| 136 | default_hdf5_path (str): Path in hdf5 file. If the scp contain the info, not used. |
| 137 | |
| 138 | """ |
| 139 | self.default_hdf5_path = default_hdf5_path |
| 140 | with open(feats_scp) as f: |
| 141 | lines = [line.replace("\n", "") for line in f.readlines()] |
| 142 | self.data = {} |
| 143 | for line in lines: |
| 144 | key, value = line.split() |
| 145 | self.data[key] = value |
| 146 | |
| 147 | def get_path(self, key): |
| 148 | """Get hdf5 file path for a given key.""" |
nothing calls this directly
no outgoing calls
no test coverage detected