anand-kamble commited on
Commit
91a8040
1 Parent(s): e1d5670
Files changed (1) hide show
  1. common_voice_11_0.py +10 -5
common_voice_11_0.py CHANGED
@@ -87,8 +87,10 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
87
  release_date=STATS["date"],
88
  num_clips=lang_stats["clips"],
89
  num_speakers=lang_stats["users"],
90
- validated_hr=float(lang_stats["validHrs"]) if lang_stats["validHrs"] else None,
91
- total_hr=float(lang_stats["totalHrs"]) if lang_stats["totalHrs"] else None,
 
 
92
  size_bytes=int(lang_stats["size"]) if lang_stats["size"] else None,
93
  )
94
  for lang, lang_stats in STATS["locales"].items()
@@ -142,9 +144,11 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
142
  ]
143
  print(audio_urls)
144
  archive_paths = dl_manager.download(audio_urls)
145
- local_extracted_archive_paths = dl_manager.extract(archive_paths) if not dl_manager.is_streaming else {}
 
146
 
147
- meta_urls = {split: _TRANSCRIPT_URL.format(lang=lang, split=split) for split in splits}
 
148
  meta_paths = dl_manager.download_and_extract(meta_urls)
149
 
150
  split_generators = []
@@ -191,7 +195,8 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
191
  if filename in metadata:
192
  result = dict(metadata[filename])
193
  # set the audio feature and the path to the extracted file
194
- path = os.path.join(local_extracted_archive_paths[i], path) if local_extracted_archive_paths else path
 
195
  result["audio"] = {"path": path, "bytes": file.read()}
196
  result["path"] = path
197
  yield path, result
 
87
  release_date=STATS["date"],
88
  num_clips=lang_stats["clips"],
89
  num_speakers=lang_stats["users"],
90
+ validated_hr=float(
91
+ lang_stats["validHrs"]) if lang_stats["validHrs"] else None,
92
+ total_hr=float(lang_stats["totalHrs"]
93
+ ) if lang_stats["totalHrs"] else None,
94
  size_bytes=int(lang_stats["size"]) if lang_stats["size"] else None,
95
  )
96
  for lang, lang_stats in STATS["locales"].items()
 
144
  ]
145
  print(audio_urls)
146
  archive_paths = dl_manager.download(audio_urls)
147
+ local_extracted_archive_paths = dl_manager.extract(
148
+ archive_paths) if not dl_manager.is_streaming else {}
149
 
150
+ meta_urls = {split: _TRANSCRIPT_URL.format(
151
+ lang=lang, split=split) for split in splits}
152
  meta_paths = dl_manager.download_and_extract(meta_urls)
153
 
154
  split_generators = []
 
195
  if filename in metadata:
196
  result = dict(metadata[filename])
197
  # set the audio feature and the path to the extracted file
198
+ path = os.path.join(
199
+ local_extracted_archive_paths[i], path) if local_extracted_archive_paths else path
200
  result["audio"] = {"path": path, "bytes": file.read()}
201
  result["path"] = path
202
  yield path, result