Datasets:
fix: loading script
Browse filesSigned-off-by: Ingerid Dale <[email protected]>
- 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
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
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"):
|