Delete builder.py
Browse files- builder.py +0 -98
builder.py
DELETED
|
@@ -1,98 +0,0 @@
|
|
| 1 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 2 |
-
#
|
| 3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
-
# you may not use this file except in compliance with the License.
|
| 5 |
-
# You may obtain a copy of the License at
|
| 6 |
-
#
|
| 7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
-
#
|
| 9 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
-
# See the License for the specific language governing permissions and
|
| 13 |
-
# limitations under the License.
|
| 14 |
-
"""Leading and Trailing Silences Removed Large Nepali ASR Dataset"""
|
| 15 |
-
|
| 16 |
-
import os
|
| 17 |
-
import csv
|
| 18 |
-
|
| 19 |
-
import datasets
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
_CITATION = """\
|
| 23 |
-
@inproceedings{kjartansson-etal-sltu2018,
|
| 24 |
-
title = {{Crowd-Sourced Speech Corpora for Javanese, Sundanese, Sinhala, Nepali, and Bangladeshi Bengali}},
|
| 25 |
-
author = {Oddur Kjartansson and Supheakmungkol Sarin and Knot Pipatsrisawat and Martin Jansche and Linne Ha},
|
| 26 |
-
booktitle = {Proc. The 6th Intl. Workshop on Spoken Language Technologies for Under-Resourced Languages (SLTU)},
|
| 27 |
-
year = {2018},
|
| 28 |
-
address = {Gurugram, India},
|
| 29 |
-
month = aug,
|
| 30 |
-
pages = {52--55},
|
| 31 |
-
URL = {http://dx.doi.org/10.21437/SLTU.2018-11}
|
| 32 |
-
}
|
| 33 |
-
"""
|
| 34 |
-
|
| 35 |
-
_DESCRIPTION = """\
|
| 36 |
-
This data set contains transcribed audio data for Nepali. The data set consists of flac files, and a TSV file. The file utt_spk_text.tsv contains a FileID, anonymized UserID and the transcription of audio in the file.
|
| 37 |
-
The data set has been manually quality checked, but there might still be errors.
|
| 38 |
-
The audio files are sampled at rate of 16KHz, and leading and trailing silences are trimmed using torchaudio's voice activity detection.
|
| 39 |
-
"""
|
| 40 |
-
|
| 41 |
-
# TODO: Add link to the official dataset URLs here
|
| 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",
|
| 48 |
-
"index_file": _URL + "metedata1.csv",
|
| 49 |
-
}
|
| 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 |
-
"audio_id": datasets.Value("string"),
|
| 61 |
-
"AUDIO": datasets.Audio(),
|
| 62 |
-
"LABEL": datasets.Value("string"),
|
| 63 |
-
}
|
| 64 |
-
),
|
| 65 |
-
homepage="https://www.openslr.org/54/",
|
| 66 |
-
# Citation for the dataset
|
| 67 |
-
citation=_CITATION,
|
| 68 |
-
task_templates=[
|
| 69 |
-
datasets.tasks.AutomaticSpeechRecognition(
|
| 70 |
-
audio_column="AUDIO", transcription_column="LABEL"
|
| 71 |
-
)
|
| 72 |
-
],
|
| 73 |
-
)
|
| 74 |
-
|
| 75 |
-
def _split_generators(self, dl_manager):
|
| 76 |
-
index_file = dl_manager.download(_URLS["index_file"])
|
| 77 |
-
zip_paths = dl_manager.download(_URLS["zipfile"])
|
| 78 |
-
audio_paths = dl_manager.extract(zip_paths)
|
| 79 |
-
return [
|
| 80 |
-
datasets.SplitGenerator(
|
| 81 |
-
name=datasets.Split.TRAIN,
|
| 82 |
-
gen_kwargs={
|
| 83 |
-
"index_file": index_file,
|
| 84 |
-
"audio_paths": audio_paths,
|
| 85 |
-
},
|
| 86 |
-
),
|
| 87 |
-
]
|
| 88 |
-
|
| 89 |
-
def _generate_examples(self, index_file, audio_paths):
|
| 90 |
-
with open(index_file, encoding="utf-8") as fp:
|
| 91 |
-
reader = csv.DictReader(fp)
|
| 92 |
-
for key, row in enumerate(reader):
|
| 93 |
-
path = os.path.join(audio_paths, 'CLEAN_DATA', row['utterance_id'])
|
| 94 |
-
yield key, {
|
| 95 |
-
"audio_id": row['utterance_id'],
|
| 96 |
-
"AUDIO": path,
|
| 97 |
-
"LABEL": row['transcription'],
|
| 98 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|