Datasets:

License:
mariosasko commited on
Commit
84251a5
1 Parent(s): 8766a11

Fix script

Browse files
Files changed (1) hide show
  1. MOCKS.py +65 -121
MOCKS.py CHANGED
@@ -18,11 +18,11 @@
18
 
19
  import csv
20
  import os
21
- import json
22
 
23
  import datasets
24
- from datasets.utils.py_utils import size_str
25
- from tqdm import tqdm
 
26
 
27
 
28
  _CITATION = """\
@@ -41,96 +41,81 @@ audio testset for evaluation and benchmarking Open-Vocabulary Keyword Spotting (
41
 
42
 
43
  _BASE_URL = "https://huggingface.co/datasets/voiceintelligenceresearch/MOCKS/tree/main"
44
- _DL_URL = "https://huggingface.co/datasets/voiceintelligenceresearch/MOCKS/blob/main/"
45
- _TR_URL = "https://huggingface.co/datasets/voiceintelligenceresearch/MOCKS/raw/main/"
46
  _DL_URLS = {
47
  "de.MCV": {
48
- "offline": _DL_URL + "de/MCV/test/offline/data.tar.gz",
49
- "online": _DL_URL + "de/MCV/test/online/data.tar.gz",
50
- "offline_transcription" : _TR_URL + "de/MCV/test/data_offline_transcription.tsv",
51
- "online_transcription" : _TR_URL + "de/MCV/test/data_online_transcription.tsv",
52
  },
53
  "en.LS-clean": {
54
- "offline": _DL_URL + "en/LS-clean/test/offline/data.tar.gz",
55
- "online": _DL_URL + "en/LS-clean/test/online/data.tar.gz",
56
- "offline_transcription" : _TR_URL + "en/LS-clean/test/data_offline_transcription.tsv",
57
- "online_transcription" : _TR_URL + "en/LS-clean/test/data_online_transcription.tsv",
58
  },
59
  "en.LS-other": {
60
- "offline": _DL_URL + "en/LS-other/test/offline/data.tar.gz",
61
- "online": _DL_URL + "en/LS-other/test/online/data.tar.gz",
62
- "offline_transcription" : _TR_URL + "en/LS-other/test/data_offline_transcription.tsv",
63
- "online_transcription" : _TR_URL + "en/LS-other/test/data_online_transcription.tsv",
64
  },
65
  "en.MCV": {
66
- "offline": _DL_URL + "en/MCV/test/offline/data.tar.gz",
67
- "online": _DL_URL + "en/MCV/test/online/data.tar.gz",
68
- "offline_transcription" : _TR_URL + "en/MCV/test/data_offline_transcription.tsv",
69
- "online_transcription" : _TR_URL + "en/MCV/test/data_online_transcription.tsv",
70
  },
71
  "es.MCV": {
72
- "offline": _DL_URL + "es/MCV/test/offline/data.tar.gz",
73
- "online": _DL_URL + "es/MCV/test/online/data.tar.gz",
74
- "offline_transcription" : _TR_URL + "es/MCV/test/data_offline_transcription.tsv",
75
- "online_transcription" : _TR_URL + "es/MCV/test/data_online_transcription.tsv",
76
  },
77
  "fr.MCV": {
78
- "offline": _DL_URL + "fr/MCV/test/offline/data.tar.gz",
79
- "online": _DL_URL + "fr/MCV/test/online/data.tar.gz",
80
- "offline_transcription" : _TR_URL + "fr/MCV/test/data_offline_transcription.tsv",
81
- "online_transcription" : _TR_URL + "fr/MCV/test/data_online_transcription.tsv",
82
  },
83
  "it.MCV": {
84
- "offline": _DL_URL + "it/MCV/test/offline/data.tar.gz",
85
- "online": _DL_URL + "it/MCV/test/online/data.tar.gz",
86
- "offline_transcription" : _TR_URL + "it/MCV/test/data_offline_transcription.tsv",
87
- "online_transcription" : _TR_URL + "it/MCV/test/data_online_transcription.tsv",
88
  },
89
  "all": {
90
- "de.MCV.offline": _DL_URL + "de/MCV/test/offline/data.tar.gz",
91
- "de.MCV.online": _DL_URL + "de/MCV/test/online/data.tar.gz",
92
- "en.LS-clean.offline": _DL_URL + "en/LS-clean/test/offline/data.tar.gz",
93
- "en.LS-clean.online": _DL_URL + "en/LS-clean/test/online/data.tar.gz",
94
- "en.LS-other.offline": _DL_URL + "en/LS-other/test/offline/data.tar.gz",
95
- "en.LS-other.online": _DL_URL + "en/LS-other/test/online/data.tar.gz",
96
- "en.MCV.offline": _DL_URL + "en/MCV/test/offline/data.tar.gz",
97
- "en.MCV.online": _DL_URL + "en/MCV/test/online/data.tar.gz",
98
- "es.MCV.offline": _DL_URL + "es/MCV/test/offline/data.tar.gz",
99
- "es.MCV.online": _DL_URL + "es/MCV/test/online/data.tar.gz",
100
- "fr.MCV.offline": _DL_URL + "fr/MCV/test/offline/data.tar.gz",
101
- "fr.MCV.online": _DL_URL + "fr/MCV/test/online/data.tar.gz",
102
- "it.MCVoffline": _DL_URL + "it/MCV/test/offline/data.tar.gz",
103
- "it.MCV.online": _DL_URL + "it/MCV/test/online/data.tar.gz",
104
- "de.MCV.offline_transcription" : _TR_URL + "de/MCV/test/data_offline_transcription.tsv",
105
- "de.MCV.online_transcription" : _TR_URL + "de/MCV/test/data_online_transcription.tsv",
106
- "en.LS-clean.offline_transcription" : _TR_URL + "en/LS-clean/test/data_offline_transcription.tsv",
107
- "en.LS-clean.online_transcription" : _TR_URL + "en/LS-clean/test/data_online_transcription.tsv",
108
- "en.LS-other.offline_transcription" : _TR_URL + "en/LS-other/test/data_offline_transcription.tsv",
109
- "en.LS-other.online_transcription" : _TR_URL + "en/LS-other/test/data_online_transcription.tsv",
110
- "en.MCV.offline_transcription" : _TR_URL + "en/MCV/test/data_offline_transcription.tsv",
111
- "en.MCVonline_transcription" : _TR_URL + "en/MCV/test/data_online_transcription.tsv",
112
- "es.MCV.offline_transcription" : _TR_URL + "es/MCV/test/data_offline_transcription.tsv",
113
- "es.MCV.online_transcription" : _TR_URL + "es/MCV/test/data_online_transcription.tsv",
114
- "fr.MCV.offline_transcription" : _TR_URL + "fr/MCV/test/data_offline_transcription.tsv",
115
- "fr.MCV.online_transcription" : _TR_URL + "fr/MCV/test/data_online_transcription.tsv",
116
- "it.MCV.offline_transcription" : _TR_URL + "it/MCV/test/data_offline_transcription.tsv",
117
- "it.MCV.online_transcription" : _TR_URL + "it/MCV/test/data_online_transcription.tsv",
118
  }
119
  }
120
 
121
- logger = datasets.logging.get_logger(__name__)
122
-
123
- class MocksConfig(datasets.BuilderConfig):
124
- """BuilderConfig for MOCKS testset."""
125
-
126
- def __init__(self, name, version, **kwargs):
127
-
128
- super(MocksConfig, self).__init__(
129
- name=name,
130
- version=datasets.Version(version),
131
- description=description,
132
- **kwargs,
133
- )
134
 
135
  class Mocks(datasets.GeneratorBasedBuilder):
136
  """Mocks Dataset."""
@@ -155,25 +140,20 @@ class Mocks(datasets.GeneratorBasedBuilder):
155
  "audio_id": datasets.Value("string"),
156
  "audio": datasets.Audio(sampling_rate=16_000),
157
  "transcription": datasets.Value("string"),
158
- "type": datasets.Value("string")
159
  }
160
  ),
161
- supervised_keys=("file", "text"),
162
  homepage=_BASE_URL,
163
  citation=_CITATION
164
  )
165
 
166
  def _split_generators(self, dl_manager):
167
  archive_path = dl_manager.download(_DL_URLS[self.config.name])
168
- # (Optional) In non-streaming mode, we can extract the archive locally to have actual local audio files:
169
- local_extracted_archive = dl_manager.extract(archive_path) if not dl_manager.is_streaming else {}
170
 
171
  if self.config.name == "de.MCV":
172
  offline_split = [
173
  datasets.SplitGenerator(
174
  name="offline",
175
  gen_kwargs={
176
- "local_extracted_archive": local_extracted_archive.get("offline"),
177
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
178
  "transcription": archive_path["offline_transcription"],
179
  "s_type": "offline"
@@ -184,7 +164,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
184
  datasets.SplitGenerator(
185
  name="online",
186
  gen_kwargs={
187
- "local_extracted_archive": local_extracted_archive.get("online"),
188
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
189
  "transcription": archive_path["online_transcription"],
190
  "s_type": "online"
@@ -197,7 +176,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
197
  datasets.SplitGenerator(
198
  name="offline",
199
  gen_kwargs={
200
- "local_extracted_archive": local_extracted_archive.get("offline"),
201
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
202
  "transcription": archive_path["offline_transcription"],
203
  "s_type": "offline"
@@ -208,7 +186,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
208
  datasets.SplitGenerator(
209
  name="online",
210
  gen_kwargs={
211
- "local_extracted_archive": local_extracted_archive.get("online"),
212
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
213
  "transcription": archive_path["online_transcription"],
214
  "s_type": "online"
@@ -221,7 +198,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
221
  datasets.SplitGenerator(
222
  name="offline",
223
  gen_kwargs={
224
- "local_extracted_archive": local_extracted_archive.get("offline"),
225
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
226
  "transcription": archive_path["offline_transcription"],
227
  "s_type": "offline"
@@ -232,7 +208,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
232
  datasets.SplitGenerator(
233
  name="online",
234
  gen_kwargs={
235
- "local_extracted_archive": local_extracted_archive.get("online"),
236
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
237
  "transcription": archive_path["online_transcription"],
238
  "s_type": "online"
@@ -245,7 +220,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
245
  datasets.SplitGenerator(
246
  name="offline",
247
  gen_kwargs={
248
- "local_extracted_archive": local_extracted_archive.get("offline"),
249
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
250
  "transcription": archive_path["offline_transcription"],
251
  "s_type": "offline"
@@ -256,7 +230,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
256
  datasets.SplitGenerator(
257
  name="online",
258
  gen_kwargs={
259
- "local_extracted_archive": local_extracted_archive.get("online"),
260
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
261
  "transcription": archive_path["online_transcription"],
262
  "s_type": "online"
@@ -280,7 +253,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
280
  datasets.SplitGenerator(
281
  name="online",
282
  gen_kwargs={
283
- "local_extracted_archive": local_extracted_archive.get("online"),
284
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
285
  "transcription": archive_path["online_transcription"],
286
  "s_type": "online"
@@ -293,7 +265,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
293
  datasets.SplitGenerator(
294
  name="offline",
295
  gen_kwargs={
296
- "local_extracted_archive": local_extracted_archive.get("offline"),
297
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
298
  "transcription": archive_path["offline_transcription"],
299
  "s_type": "offline"
@@ -304,7 +275,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
304
  datasets.SplitGenerator(
305
  name="online",
306
  gen_kwargs={
307
- "local_extracted_archive": local_extracted_archive.get("online"),
308
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
309
  "transcription": archive_path["online_transcription"],
310
  "s_type": "online"
@@ -317,7 +287,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
317
  datasets.SplitGenerator(
318
  name="offline",
319
  gen_kwargs={
320
- "local_extracted_archive": local_extracted_archive.get("offline"),
321
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
322
  "transcription": archive_path["offline_transcription"],
323
  "s_type": "offline"
@@ -328,7 +297,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
328
  datasets.SplitGenerator(
329
  name="online",
330
  gen_kwargs={
331
- "local_extracted_archive": local_extracted_archive.get("online"),
332
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
333
  "transcription": archive_path["online_transcription"],
334
  "s_type": "online"
@@ -341,7 +309,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
341
  datasets.SplitGenerator(
342
  name="de.MCV.offline",
343
  gen_kwargs={
344
- "local_extracted_archive": local_extracted_archive.get("de.MCV.offline"),
345
  "audio_files": dl_manager.iter_archive(archive_path["de.MCV.offline"]),
346
  "transcription": archive_path["de.MCV.offline_transcription"],
347
  "s_type": "offline"
@@ -350,7 +317,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
350
  datasets.SplitGenerator(
351
  name="en.LS-clean.offline",
352
  gen_kwargs={
353
- "local_extracted_archive": local_extracted_archive.get("en.LS-clean.offline"),
354
  "audio_files": dl_manager.iter_archive(archive_path["en.LS-clean.offline"]),
355
  "transcription": archive_path["en.LS-clean.offline_transcription"],
356
  "s_type": "offline"
@@ -359,7 +325,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
359
  datasets.SplitGenerator(
360
  name="en.LS-other.offline",
361
  gen_kwargs={
362
- "local_extracted_archive": local_extracted_archive.get("en.LS-other.offline"),
363
  "audio_files": dl_manager.iter_archive(archive_path["en.LS-other.offline"]),
364
  "transcription": archive_path["en.LS-other.offline_transcription"],
365
  "s_type": "offline"
@@ -368,7 +333,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
368
  datasets.SplitGenerator(
369
  name="en.MCV.offline",
370
  gen_kwargs={
371
- "local_extracted_archive": local_extracted_archive.get("en.MCV.offline"),
372
  "audio_files": dl_manager.iter_archive(archive_path["en.MCV.offline"]),
373
  "transcription": archive_path["en.MCV.offline_transcription"],
374
  "s_type": "offline"
@@ -377,7 +341,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
377
  datasets.SplitGenerator(
378
  name="es.MCV.offline",
379
  gen_kwargs={
380
- "local_extracted_archive": local_extracted_archive.get("es.MCV.offline"),
381
  "audio_files": dl_manager.iter_archive(archive_path["es.MCV.offline"]),
382
  "transcription": archive_path["es.MCV.offline_transcription"],
383
  "s_type": "offline"
@@ -386,7 +349,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
386
  datasets.SplitGenerator(
387
  name="fr.MCV.offline",
388
  gen_kwargs={
389
- "local_extracted_archive": local_extracted_archive.get("fr.MCV.offline"),
390
  "audio_files": dl_manager.iter_archive(archive_path["fr.MCV.offline"]),
391
  "transcription": archive_path["fr.MCV.offline_transcription"],
392
  "s_type": "offline"
@@ -395,7 +357,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
395
  datasets.SplitGenerator(
396
  name="it.MCV.offline",
397
  gen_kwargs={
398
- "local_extracted_archive": local_extracted_archive.get("it.MCV.offline"),
399
  "audio_files": dl_manager.iter_archive(archive_path["it.MCV.offline"]),
400
  "transcription": archive_path["it.MCV.offline_transcription"],
401
  "s_type": "offline"
@@ -406,8 +367,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
406
  datasets.SplitGenerator(
407
  name="de.MCV.online",
408
  gen_kwargs={
409
- "local_extracted_archive": local_extracted_archive.get("de.MCV.online"),
410
- "audio_files": dl_manager.iter_archive(archive_path["de.MCV.online"]),
411
  "transcription": archive_path["de.MCV.offline_transconline"],
412
  "s_type": "online"
413
  }
@@ -415,7 +374,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
415
  datasets.SplitGenerator(
416
  name="en.LS-clean.online",
417
  gen_kwargs={
418
- "local_extracted_archive": local_extracted_archive.get("en.LS-clean.online"),
419
  "audio_files": dl_manager.iter_archive(archive_path["en.LS-clean.online"]),
420
  "transcription": archive_path["en.LS-clean.online_transcription"],
421
  "s_type": "online"
@@ -424,7 +382,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
424
  datasets.SplitGenerator(
425
  name="en.LS-other.online",
426
  gen_kwargs={
427
- "local_extracted_archive": local_extracted_archive.get("en.LS-other.online"),
428
  "audio_files": dl_manager.iter_archive(archive_path["en.LS-other.online"]),
429
  "transcription": archive_path["en.LS-other.online_transcription"],
430
  "s_type": "online"
@@ -433,7 +390,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
433
  datasets.SplitGenerator(
434
  name="en.MCV.online",
435
  gen_kwargs={
436
- "local_extracted_archive": local_extracted_archive.get("en.MCV.online"),
437
  "audio_files": dl_manager.iter_archive(archive_path["en.MCV.online"]),
438
  "transcription": archive_path["en.MCV.online_transcription"],
439
  "s_type": "online"
@@ -442,7 +398,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
442
  datasets.SplitGenerator(
443
  name="es.MCV.online",
444
  gen_kwargs={
445
- "local_extracted_archive": local_extracted_archive.get("es.MCV.online"),
446
  "audio_files": dl_manager.iter_archive(archive_path["es.MCV.online"]),
447
  "transcription": archive_path["es.MCV.online_transcription"],
448
  "s_type": "online"
@@ -451,7 +406,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
451
  datasets.SplitGenerator(
452
  name="fr.MCV.online",
453
  gen_kwargs={
454
- "local_extracted_archive": local_extracted_archive.get("fr.MCV.online"),
455
  "audio_files": dl_manager.iter_archive(archive_path["fr.MCV.online"]),
456
  "transcription": archive_path["fr.MCV.online_transcription"],
457
  "s_type": "online"
@@ -460,7 +414,6 @@ class Mocks(datasets.GeneratorBasedBuilder):
460
  datasets.SplitGenerator(
461
  name="it.MCV.online",
462
  gen_kwargs={
463
- "local_extracted_archive": local_extracted_archive.get("it.MCV.online"),
464
  "audio_files": dl_manager.iter_archive(archive_path["it.MCV.online"]),
465
  "transcription": archive_path["it.MCV.online_transcription"],
466
  "s_type": "online"
@@ -470,29 +423,20 @@ class Mocks(datasets.GeneratorBasedBuilder):
470
 
471
  return online_split + offline_split
472
 
473
- def _generate_examples(self, local_extracted_archive, audio_files, transcription, s_type):
474
  """Lorem ipsum."""
475
  metadata = {}
476
- trans_col_name = "keyword_transcription"
477
-
478
- if s_type == "online":
479
- trans_col_name = "adversary_keyword_transcription"
480
- logger.info(transcription)
481
  with open(transcription, encoding="utf-8") as f:
482
- print(f)
483
  for row in f:
484
- r = row.split(r"\t")
485
- print(row)
486
- audio_id = r[0].split("/")[-1]
487
- keyword = r[1]
488
- metadata[audio_id] = {"audio_id": audio_id,
489
- trans_col_name: keyword}
490
 
491
- inside_clips_dir = True
492
  id_ = 0
493
  for path, f in audio_files:
494
  _, audio_name = os.path.split(path)
495
  if audio_name in metadata:
496
  audio = {"bytes": f.read()}
497
- yield id_, {**metadata[audio_id], "audio": audio}
498
  id_ +=1
 
18
 
19
  import csv
20
  import os
 
21
 
22
  import datasets
23
+
24
+
25
+ logger = datasets.logging.get_logger(__name__)
26
 
27
 
28
  _CITATION = """\
 
41
 
42
 
43
  _BASE_URL = "https://huggingface.co/datasets/voiceintelligenceresearch/MOCKS/tree/main"
 
 
44
  _DL_URLS = {
45
  "de.MCV": {
46
+ "offline": "de/MCV/test/offline/data.tar.gz",
47
+ "online": "de/MCV/test/online/data.tar.gz",
48
+ "offline_transcription" : "de/MCV/test/data_offline_transcription.tsv",
49
+ "online_transcription" : "de/MCV/test/data_online_transcription.tsv",
50
  },
51
  "en.LS-clean": {
52
+ "offline": "en/LS-clean/test/offline/data.tar.gz",
53
+ "online": "en/LS-clean/test/online/data.tar.gz",
54
+ "offline_transcription" : "en/LS-clean/test/data_offline_transcription.tsv",
55
+ "online_transcription" : "en/LS-clean/test/data_online_transcription.tsv",
56
  },
57
  "en.LS-other": {
58
+ "offline": "en/LS-other/test/offline/data.tar.gz",
59
+ "online": "en/LS-other/test/online/data.tar.gz",
60
+ "offline_transcription" : "en/LS-other/test/data_offline_transcription.tsv",
61
+ "online_transcription" : "en/LS-other/test/data_online_transcription.tsv",
62
  },
63
  "en.MCV": {
64
+ "offline": "en/MCV/test/offline/data.tar.gz",
65
+ "online": "en/MCV/test/online/data.tar.gz",
66
+ "offline_transcription" : "en/MCV/test/data_offline_transcription.tsv",
67
+ "online_transcription" : "en/MCV/test/data_online_transcription.tsv",
68
  },
69
  "es.MCV": {
70
+ "offline": "es/MCV/test/offline/data.tar.gz",
71
+ "online": "es/MCV/test/online/data.tar.gz",
72
+ "offline_transcription" : "es/MCV/test/data_offline_transcription.tsv",
73
+ "online_transcription" : "es/MCV/test/data_online_transcription.tsv",
74
  },
75
  "fr.MCV": {
76
+ "offline": "fr/MCV/test/offline/data.tar.gz",
77
+ "online": "fr/MCV/test/online/data.tar.gz",
78
+ "offline_transcription": "fr/MCV/test/data_offline_transcription.tsv",
79
+ "online_transcription": "fr/MCV/test/data_online_transcription.tsv",
80
  },
81
  "it.MCV": {
82
+ "offline": "it/MCV/test/offline/data.tar.gz",
83
+ "online": "it/MCV/test/online/data.tar.gz",
84
+ "offline_transcription": "it/MCV/test/data_offline_transcription.tsv",
85
+ "online_transcription": "it/MCV/test/data_online_transcription.tsv",
86
  },
87
  "all": {
88
+ "de.MCV.offline": "de/MCV/test/offline/data.tar.gz",
89
+ "de.MCV.online": "de/MCV/test/online/data.tar.gz",
90
+ "en.LS-clean.offline": "en/LS-clean/test/offline/data.tar.gz",
91
+ "en.LS-clean.online": "en/LS-clean/test/online/data.tar.gz",
92
+ "en.LS-other.offline": "en/LS-other/test/offline/data.tar.gz",
93
+ "en.LS-other.online": "en/LS-other/test/online/data.tar.gz",
94
+ "en.MCV.offline": "en/MCV/test/offline/data.tar.gz",
95
+ "en.MCV.online": "en/MCV/test/online/data.tar.gz",
96
+ "es.MCV.offline": "es/MCV/test/offline/data.tar.gz",
97
+ "es.MCV.online": "es/MCV/test/online/data.tar.gz",
98
+ "fr.MCV.offline": "fr/MCV/test/offline/data.tar.gz",
99
+ "fr.MCV.online": "fr/MCV/test/online/data.tar.gz",
100
+ "it.MCVoffline": "it/MCV/test/offline/data.tar.gz",
101
+ "it.MCV.online": "it/MCV/test/online/data.tar.gz",
102
+ "de.MCV.offline_transcription": "de/MCV/test/data_offline_transcription.tsv",
103
+ "de.MCV.online_transcription": "de/MCV/test/data_online_transcription.tsv",
104
+ "en.LS-clean.offline_transcription": "en/LS-clean/test/data_offline_transcription.tsv",
105
+ "en.LS-clean.online_transcription": "en/LS-clean/test/data_online_transcription.tsv",
106
+ "en.LS-other.offline_transcription": "en/LS-other/test/data_offline_transcription.tsv",
107
+ "en.LS-other.online_transcription": "en/LS-other/test/data_online_transcription.tsv",
108
+ "en.MCV.offline_transcription": "en/MCV/test/data_offline_transcription.tsv",
109
+ "en.MCVonline_transcription": "en/MCV/test/data_online_transcription.tsv",
110
+ "es.MCV.offline_transcription": "es/MCV/test/data_offline_transcription.tsv",
111
+ "es.MCV.online_transcription": "es/MCV/test/data_online_transcription.tsv",
112
+ "fr.MCV.offline_transcription": "fr/MCV/test/data_offline_transcription.tsv",
113
+ "fr.MCV.online_transcription": "fr/MCV/test/data_online_transcription.tsv",
114
+ "it.MCV.offline_transcription": "it/MCV/test/data_offline_transcription.tsv",
115
+ "it.MCV.online_transcription": "it/MCV/test/data_online_transcription.tsv",
116
  }
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  class Mocks(datasets.GeneratorBasedBuilder):
121
  """Mocks Dataset."""
 
140
  "audio_id": datasets.Value("string"),
141
  "audio": datasets.Audio(sampling_rate=16_000),
142
  "transcription": datasets.Value("string"),
 
143
  }
144
  ),
 
145
  homepage=_BASE_URL,
146
  citation=_CITATION
147
  )
148
 
149
  def _split_generators(self, dl_manager):
150
  archive_path = dl_manager.download(_DL_URLS[self.config.name])
 
 
151
 
152
  if self.config.name == "de.MCV":
153
  offline_split = [
154
  datasets.SplitGenerator(
155
  name="offline",
156
  gen_kwargs={
 
157
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
158
  "transcription": archive_path["offline_transcription"],
159
  "s_type": "offline"
 
164
  datasets.SplitGenerator(
165
  name="online",
166
  gen_kwargs={
 
167
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
168
  "transcription": archive_path["online_transcription"],
169
  "s_type": "online"
 
176
  datasets.SplitGenerator(
177
  name="offline",
178
  gen_kwargs={
 
179
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
180
  "transcription": archive_path["offline_transcription"],
181
  "s_type": "offline"
 
186
  datasets.SplitGenerator(
187
  name="online",
188
  gen_kwargs={
 
189
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
190
  "transcription": archive_path["online_transcription"],
191
  "s_type": "online"
 
198
  datasets.SplitGenerator(
199
  name="offline",
200
  gen_kwargs={
 
201
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
202
  "transcription": archive_path["offline_transcription"],
203
  "s_type": "offline"
 
208
  datasets.SplitGenerator(
209
  name="online",
210
  gen_kwargs={
 
211
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
212
  "transcription": archive_path["online_transcription"],
213
  "s_type": "online"
 
220
  datasets.SplitGenerator(
221
  name="offline",
222
  gen_kwargs={
 
223
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
224
  "transcription": archive_path["offline_transcription"],
225
  "s_type": "offline"
 
230
  datasets.SplitGenerator(
231
  name="online",
232
  gen_kwargs={
 
233
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
234
  "transcription": archive_path["online_transcription"],
235
  "s_type": "online"
 
253
  datasets.SplitGenerator(
254
  name="online",
255
  gen_kwargs={
 
256
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
257
  "transcription": archive_path["online_transcription"],
258
  "s_type": "online"
 
265
  datasets.SplitGenerator(
266
  name="offline",
267
  gen_kwargs={
 
268
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
269
  "transcription": archive_path["offline_transcription"],
270
  "s_type": "offline"
 
275
  datasets.SplitGenerator(
276
  name="online",
277
  gen_kwargs={
 
278
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
279
  "transcription": archive_path["online_transcription"],
280
  "s_type": "online"
 
287
  datasets.SplitGenerator(
288
  name="offline",
289
  gen_kwargs={
 
290
  "audio_files": dl_manager.iter_archive(archive_path["offline"]),
291
  "transcription": archive_path["offline_transcription"],
292
  "s_type": "offline"
 
297
  datasets.SplitGenerator(
298
  name="online",
299
  gen_kwargs={
 
300
  "audio_files": dl_manager.iter_archive(archive_path["online"]),
301
  "transcription": archive_path["online_transcription"],
302
  "s_type": "online"
 
309
  datasets.SplitGenerator(
310
  name="de.MCV.offline",
311
  gen_kwargs={
 
312
  "audio_files": dl_manager.iter_archive(archive_path["de.MCV.offline"]),
313
  "transcription": archive_path["de.MCV.offline_transcription"],
314
  "s_type": "offline"
 
317
  datasets.SplitGenerator(
318
  name="en.LS-clean.offline",
319
  gen_kwargs={
 
320
  "audio_files": dl_manager.iter_archive(archive_path["en.LS-clean.offline"]),
321
  "transcription": archive_path["en.LS-clean.offline_transcription"],
322
  "s_type": "offline"
 
325
  datasets.SplitGenerator(
326
  name="en.LS-other.offline",
327
  gen_kwargs={
 
328
  "audio_files": dl_manager.iter_archive(archive_path["en.LS-other.offline"]),
329
  "transcription": archive_path["en.LS-other.offline_transcription"],
330
  "s_type": "offline"
 
333
  datasets.SplitGenerator(
334
  name="en.MCV.offline",
335
  gen_kwargs={
 
336
  "audio_files": dl_manager.iter_archive(archive_path["en.MCV.offline"]),
337
  "transcription": archive_path["en.MCV.offline_transcription"],
338
  "s_type": "offline"
 
341
  datasets.SplitGenerator(
342
  name="es.MCV.offline",
343
  gen_kwargs={
 
344
  "audio_files": dl_manager.iter_archive(archive_path["es.MCV.offline"]),
345
  "transcription": archive_path["es.MCV.offline_transcription"],
346
  "s_type": "offline"
 
349
  datasets.SplitGenerator(
350
  name="fr.MCV.offline",
351
  gen_kwargs={
 
352
  "audio_files": dl_manager.iter_archive(archive_path["fr.MCV.offline"]),
353
  "transcription": archive_path["fr.MCV.offline_transcription"],
354
  "s_type": "offline"
 
357
  datasets.SplitGenerator(
358
  name="it.MCV.offline",
359
  gen_kwargs={
 
360
  "audio_files": dl_manager.iter_archive(archive_path["it.MCV.offline"]),
361
  "transcription": archive_path["it.MCV.offline_transcription"],
362
  "s_type": "offline"
 
367
  datasets.SplitGenerator(
368
  name="de.MCV.online",
369
  gen_kwargs={
 
 
370
  "transcription": archive_path["de.MCV.offline_transconline"],
371
  "s_type": "online"
372
  }
 
374
  datasets.SplitGenerator(
375
  name="en.LS-clean.online",
376
  gen_kwargs={
 
377
  "audio_files": dl_manager.iter_archive(archive_path["en.LS-clean.online"]),
378
  "transcription": archive_path["en.LS-clean.online_transcription"],
379
  "s_type": "online"
 
382
  datasets.SplitGenerator(
383
  name="en.LS-other.online",
384
  gen_kwargs={
 
385
  "audio_files": dl_manager.iter_archive(archive_path["en.LS-other.online"]),
386
  "transcription": archive_path["en.LS-other.online_transcription"],
387
  "s_type": "online"
 
390
  datasets.SplitGenerator(
391
  name="en.MCV.online",
392
  gen_kwargs={
 
393
  "audio_files": dl_manager.iter_archive(archive_path["en.MCV.online"]),
394
  "transcription": archive_path["en.MCV.online_transcription"],
395
  "s_type": "online"
 
398
  datasets.SplitGenerator(
399
  name="es.MCV.online",
400
  gen_kwargs={
 
401
  "audio_files": dl_manager.iter_archive(archive_path["es.MCV.online"]),
402
  "transcription": archive_path["es.MCV.online_transcription"],
403
  "s_type": "online"
 
406
  datasets.SplitGenerator(
407
  name="fr.MCV.online",
408
  gen_kwargs={
 
409
  "audio_files": dl_manager.iter_archive(archive_path["fr.MCV.online"]),
410
  "transcription": archive_path["fr.MCV.online_transcription"],
411
  "s_type": "online"
 
414
  datasets.SplitGenerator(
415
  name="it.MCV.online",
416
  gen_kwargs={
 
417
  "audio_files": dl_manager.iter_archive(archive_path["it.MCV.online"]),
418
  "transcription": archive_path["it.MCV.online_transcription"],
419
  "s_type": "online"
 
423
 
424
  return online_split + offline_split
425
 
426
+ def _generate_examples(self, audio_files, transcription, s_type):
427
  """Lorem ipsum."""
428
  metadata = {}
 
 
 
 
 
429
  with open(transcription, encoding="utf-8") as f:
430
+ f = csv.reader(f, delimiter="\t")
431
  for row in f:
432
+ audio_id = row[0].split("/")[-1]
433
+ keyword_transcription = row[1]
434
+ metadata[audio_id] = {"audio_id": audio_id, "transcription": keyword_transcription}
 
 
 
435
 
 
436
  id_ = 0
437
  for path, f in audio_files:
438
  _, audio_name = os.path.split(path)
439
  if audio_name in metadata:
440
  audio = {"bytes": f.read()}
441
+ yield id_, {**metadata[audio_name], "audio": audio}
442
  id_ +=1