Update builder.py
Browse files- builder.py +6 -26
builder.py
CHANGED
|
@@ -42,23 +42,6 @@ The audio files are sampled at rate of 16KHz, and leading and trailing silences
|
|
| 42 |
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
| 43 |
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
| 44 |
|
| 45 |
-
|
| 46 |
-
# _URLS = {
|
| 47 |
-
# 'cleaned': {
|
| 48 |
-
# "index_file": "https://huggingface.co/datasets/spktsagar/openslr-nepali-asr-cleaned/resolve/main/data/utt_spk_text_clean.tsv",
|
| 49 |
-
# "zipfiles": [
|
| 50 |
-
# f"https://huggingface.co/datasets/spktsagar/openslr-nepali-asr-cleaned/resolve/main/data/asr_nepali_{k}.zip"
|
| 51 |
-
# for k in [*range(10), *'abcdef']
|
| 52 |
-
# ],
|
| 53 |
-
# },
|
| 54 |
-
# 'original': {
|
| 55 |
-
# "index_file": "https://huggingface.co/datasets/spktsagar/openslr-nepali-asr-cleaned/resolve/main/data/utt_spk_text_orig.tsv",
|
| 56 |
-
# "zipfiles": [
|
| 57 |
-
# f"https://www.openslr.org/resources/54/asr_nepali_{k}.zip"
|
| 58 |
-
# for k in [*range(10), *'abcdef']
|
| 59 |
-
# ],
|
| 60 |
-
# },
|
| 61 |
-
# }
|
| 62 |
_URL = "https://huggingface.co/datasets/SumitMdhr/ASR/resolve/main/"
|
| 63 |
_URLS = {
|
| 64 |
"zipfile": _URL + "CLEAN_DATA.zip",
|
|
@@ -67,19 +50,16 @@ _URLS = {
|
|
| 67 |
|
| 68 |
|
| 69 |
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
| 70 |
-
class
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
VERSION = datasets.Version("1.0.0")
|
| 74 |
-
|
| 75 |
def _info(self):
|
| 76 |
return datasets.DatasetInfo(
|
| 77 |
description=_DESCRIPTION,
|
| 78 |
features=datasets.Features(
|
| 79 |
{
|
| 80 |
"utterance_id": datasets.Value("string"),
|
| 81 |
-
"transcription": datasets.Value("string"),
|
| 82 |
"utterance": datasets.Audio(),
|
|
|
|
| 83 |
}
|
| 84 |
),
|
| 85 |
homepage="https://www.openslr.org/54/",
|
|
@@ -110,9 +90,9 @@ class NepaliAsr(datasets.GeneratorBasedBuilder):
|
|
| 110 |
with open(index_file, encoding="utf-8") as f:
|
| 111 |
reader = csv.DictReader(f, delimiter="\t")
|
| 112 |
for key, row in enumerate(reader):
|
| 113 |
-
path = os.path.join(audio_paths,
|
| 114 |
yield key, {
|
| 115 |
-
"utterance_id": row[
|
| 116 |
"utterance": path,
|
| 117 |
-
"transcription": row[
|
| 118 |
}
|
|
|
|
| 42 |
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
| 43 |
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
_URL = "https://huggingface.co/datasets/SumitMdhr/ASR/resolve/main/"
|
| 46 |
_URLS = {
|
| 47 |
"zipfile": _URL + "CLEAN_DATA.zip",
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
| 53 |
+
class ASR_SAM(datasets.GeneratorBasedBuilder):
|
| 54 |
+
|
|
|
|
|
|
|
|
|
|
| 55 |
def _info(self):
|
| 56 |
return datasets.DatasetInfo(
|
| 57 |
description=_DESCRIPTION,
|
| 58 |
features=datasets.Features(
|
| 59 |
{
|
| 60 |
"utterance_id": datasets.Value("string"),
|
|
|
|
| 61 |
"utterance": datasets.Audio(),
|
| 62 |
+
"transcription": datasets.Value("string"),
|
| 63 |
}
|
| 64 |
),
|
| 65 |
homepage="https://www.openslr.org/54/",
|
|
|
|
| 90 |
with open(index_file, encoding="utf-8") as f:
|
| 91 |
reader = csv.DictReader(f, delimiter="\t")
|
| 92 |
for key, row in enumerate(reader):
|
| 93 |
+
path = os.path.join(audio_paths, 'CLEAN_DATA', row['utterance_id'])
|
| 94 |
yield key, {
|
| 95 |
+
"utterance_id": row['utterance_id'],
|
| 96 |
"utterance": path,
|
| 97 |
+
"transcription": row['transcription'],
|
| 98 |
}
|