ingerid commited on
Commit
a5506cd
·
unverified ·
1 Parent(s): c032d91

fix: loading script

Browse files

Signed-off-by: Ingerid Dale <[email protected]>

Files changed (1) hide show
  1. nb_samtale.py +13 -10
nb_samtale.py CHANGED
@@ -67,7 +67,7 @@ class NBSamtaleConfig(datasets.BuilderConfig):
67
  def __init__(self, **kwargs):
68
  # Version history:
69
  # 1.0.0: Initial version.
70
- super().__init__(version=datasets.Version("1.0.0"), **kwargs)
71
  #self.language = language
72
 
73
 
@@ -181,15 +181,18 @@ class NBSamtale(datasets.GeneratorBasedBuilder):
181
  meta[audio_path] = data
182
 
183
  id_ = 0
184
- for path, audiofile in audio_files:
185
- if path in meta:
186
- result = dict(meta[path])
187
- # set the audio feature and the path to the extracted file
188
- path = os.path.join(local_extracted_archive, path) if local_extracted_archive else path
189
- result["audio"] = {"path": path, "bytes": audiofile.read()}
190
- result["path"] = path
191
- yield id_, result
192
- id_ += 1
 
 
 
193
 
194
 
195
  def normalize_transcription(transcription: str, config="annotations"):
 
67
  def __init__(self, **kwargs):
68
  # Version history:
69
  # 1.0.0: Initial version.
70
+ super(NBSamtaleConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
71
  #self.language = language
72
 
73
 
 
181
  meta[audio_path] = data
182
 
183
  id_ = 0
184
+ for archive in audio_files:
185
+ for path, audiofile in archive:
186
+ if path in meta:
187
+ result = dict(meta[path])
188
+ # set the audio feature and the path to the extracted file
189
+ path = os.path.join(local_extracted_archive, path) if local_extracted_archive else path
190
+ result["audio"] = {"path": path, "bytes": audiofile.read()}
191
+ result["path"] = path
192
+ yield id_, result
193
+ id_ += 1
194
+ else:
195
+ print(f"Missing metadata for {path}")
196
 
197
 
198
  def normalize_transcription(transcription: str, config="annotations"):