Update teric_asr_lab.py
Browse files- teric_asr_lab.py +9 -8
teric_asr_lab.py
CHANGED
|
@@ -28,7 +28,7 @@ from .release_stats import STATS
|
|
| 28 |
|
| 29 |
|
| 30 |
_CITATION = """\
|
| 31 |
-
@inproceedings{
|
| 32 |
author = {Bateesa, T. and Wairagala, EP. },
|
| 33 |
title = {Teric Lab: A Massively-Multilingual Speech Corpus},
|
| 34 |
}
|
|
@@ -43,7 +43,7 @@ _BASE_URL = "https://huggingface.co/datasets/Tobius/teric_asr_lab/resolve/main/"
|
|
| 43 |
|
| 44 |
_AUDIO_URL = _BASE_URL + "audio/{lang}/{split}/{lang}_{split}_{shard_idx}.tar"
|
| 45 |
|
| 46 |
-
_TRANSCRIPT_URL = _BASE_URL + "transcript/{lang}/{split}.
|
| 47 |
|
| 48 |
_N_SHARDS_URL = _BASE_URL + "n_shards.json"
|
| 49 |
|
|
@@ -102,7 +102,8 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
|
|
| 102 |
)
|
| 103 |
features = datasets.Features(
|
| 104 |
{
|
| 105 |
-
"
|
|
|
|
| 106 |
"sentence": datasets.Value("string"),
|
| 107 |
"up_votes": datasets.Value("int64"),
|
| 108 |
"down_votes": datasets.Value("int64"),
|
|
@@ -165,8 +166,8 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
|
|
| 165 |
with open(meta_path, encoding="utf-8") as f:
|
| 166 |
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
| 167 |
for row in tqdm(reader, desc="Reading metadata..."):
|
| 168 |
-
if not row["
|
| 169 |
-
row["
|
| 170 |
# # accent -> accents in CV 8.0
|
| 171 |
# if "accents" in row:
|
| 172 |
# row["accent"] = row["accents"]
|
|
@@ -175,7 +176,7 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
|
|
| 175 |
for field in data_fields:
|
| 176 |
if field not in row:
|
| 177 |
row[field] = ""
|
| 178 |
-
metadata[row["
|
| 179 |
|
| 180 |
for i, audio_archive in enumerate(archives):
|
| 181 |
for path, file in audio_archive:
|
|
@@ -184,6 +185,6 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
|
|
| 184 |
result = dict(metadata[filename])
|
| 185 |
# set the audio feature and the path to the extracted file
|
| 186 |
path = os.path.join(local_extracted_archive_paths[i], path) if local_extracted_archive_paths else path
|
| 187 |
-
result["audio
|
| 188 |
-
result["
|
| 189 |
yield path, result
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
_CITATION = """\
|
| 31 |
+
@inproceedings{TericLabs:2023,
|
| 32 |
author = {Bateesa, T. and Wairagala, EP. },
|
| 33 |
title = {Teric Lab: A Massively-Multilingual Speech Corpus},
|
| 34 |
}
|
|
|
|
| 43 |
|
| 44 |
_AUDIO_URL = _BASE_URL + "audio/{lang}/{split}/{lang}_{split}_{shard_idx}.tar"
|
| 45 |
|
| 46 |
+
_TRANSCRIPT_URL = _BASE_URL + "transcript/{lang}/{split}.tsv"
|
| 47 |
|
| 48 |
_N_SHARDS_URL = _BASE_URL + "n_shards.json"
|
| 49 |
|
|
|
|
| 102 |
)
|
| 103 |
features = datasets.Features(
|
| 104 |
{
|
| 105 |
+
"path": datasets.Value("string"),
|
| 106 |
+
"audio": datasets.features.Audio(sampling_rate=48_000),
|
| 107 |
"sentence": datasets.Value("string"),
|
| 108 |
"up_votes": datasets.Value("int64"),
|
| 109 |
"down_votes": datasets.Value("int64"),
|
|
|
|
| 166 |
with open(meta_path, encoding="utf-8") as f:
|
| 167 |
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
| 168 |
for row in tqdm(reader, desc="Reading metadata..."):
|
| 169 |
+
if not row["path"].endswith(".wav"):
|
| 170 |
+
row["path"] += ".wav"
|
| 171 |
# # accent -> accents in CV 8.0
|
| 172 |
# if "accents" in row:
|
| 173 |
# row["accent"] = row["accents"]
|
|
|
|
| 176 |
for field in data_fields:
|
| 177 |
if field not in row:
|
| 178 |
row[field] = ""
|
| 179 |
+
metadata[row["path"]] = row
|
| 180 |
|
| 181 |
for i, audio_archive in enumerate(archives):
|
| 182 |
for path, file in audio_archive:
|
|
|
|
| 185 |
result = dict(metadata[filename])
|
| 186 |
# set the audio feature and the path to the extracted file
|
| 187 |
path = os.path.join(local_extracted_archive_paths[i], path) if local_extracted_archive_paths else path
|
| 188 |
+
result["audio"] = {"path": path, "bytes": file.read()}
|
| 189 |
+
result["path"] = path
|
| 190 |
yield path, result
|