Update openslr-nepali-asr-cleaned.py
#1
by
SunilC
- opened
openslr-nepali-asr-cleaned.py
CHANGED
@@ -1,24 +1,7 @@
|
|
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}},
|
@@ -35,19 +18,12 @@ URL = {http://dx.doi.org/10.21437/SLTU.2018-11}
|
|
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 |
-
|
39 |
The audio files are sampled at rate of 16KHz, and leading and trailing silences are trimmed using torchaudio's voice activity detection.
|
40 |
"""
|
41 |
|
42 |
-
# Official homepage for the dataset
|
43 |
_HOMEPAGE = "https://www.openslr.org/54/"
|
44 |
-
|
45 |
-
# The licence for the dataset
|
46 |
_LICENSE = "license:cc-by-sa-4.0"
|
47 |
|
48 |
-
# TODO: Add link to the official dataset URLs here
|
49 |
-
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
50 |
-
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
51 |
_URLS = {
|
52 |
'cleaned': {
|
53 |
"index_file": "https://huggingface.co/datasets/spktsagar/openslr-nepali-asr-cleaned/resolve/main/data/utt_spk_text_clean.tsv",
|
@@ -66,20 +42,14 @@ _URLS = {
|
|
66 |
}
|
67 |
|
68 |
|
69 |
-
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
70 |
class OpenslrNepaliAsrCleaned(datasets.GeneratorBasedBuilder):
|
71 |
-
"""End Silences Removed Large Nepali ASR Dataset"""
|
72 |
-
|
73 |
VERSION = datasets.Version("1.0.0")
|
74 |
|
75 |
BUILDER_CONFIGS = [
|
76 |
-
datasets.BuilderConfig(name="original", version=VERSION,
|
77 |
-
|
78 |
-
datasets.BuilderConfig(name="cleaned", version=VERSION,
|
79 |
-
description="All cleaned utterances, speaker id and transcription from Openslr Large Nepali ASR Dataset"),
|
80 |
]
|
81 |
|
82 |
-
# It's not mandatory to have a default configuration. Just use one if it make sense.
|
83 |
DEFAULT_CONFIG_NAME = "original"
|
84 |
|
85 |
def _info(self):
|
@@ -94,16 +64,9 @@ class OpenslrNepaliAsrCleaned(datasets.GeneratorBasedBuilder):
|
|
94 |
)
|
95 |
return datasets.DatasetInfo(
|
96 |
description=_DESCRIPTION,
|
97 |
-
# Here we define them above because they are different between the two configurations
|
98 |
features=features,
|
99 |
-
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
100 |
-
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
101 |
-
# supervised_keys=("sentence", "label"),
|
102 |
-
# Homepage of the dataset for documentation
|
103 |
homepage=_HOMEPAGE,
|
104 |
-
# License for the dataset if available
|
105 |
license=_LICENSE,
|
106 |
-
# Citation for the dataset
|
107 |
citation=_CITATION,
|
108 |
task_templates=[datasets.tasks.AutomaticSpeechRecognition(
|
109 |
audio_column="utterance", transcription_column="transcription"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import csv
|
|
|
3 |
import datasets
|
4 |
|
|
|
5 |
_CITATION = """\
|
6 |
@inproceedings{kjartansson-etal-sltu2018,
|
7 |
title = {{Crowd-Sourced Speech Corpora for Javanese, Sundanese, Sinhala, Nepali, and Bangladeshi Bengali}},
|
|
|
18 |
_DESCRIPTION = """\
|
19 |
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.
|
20 |
The data set has been manually quality checked, but there might still be errors.
|
|
|
21 |
The audio files are sampled at rate of 16KHz, and leading and trailing silences are trimmed using torchaudio's voice activity detection.
|
22 |
"""
|
23 |
|
|
|
24 |
_HOMEPAGE = "https://www.openslr.org/54/"
|
|
|
|
|
25 |
_LICENSE = "license:cc-by-sa-4.0"
|
26 |
|
|
|
|
|
|
|
27 |
_URLS = {
|
28 |
'cleaned': {
|
29 |
"index_file": "https://huggingface.co/datasets/spktsagar/openslr-nepali-asr-cleaned/resolve/main/data/utt_spk_text_clean.tsv",
|
|
|
42 |
}
|
43 |
|
44 |
|
|
|
45 |
class OpenslrNepaliAsrCleaned(datasets.GeneratorBasedBuilder):
|
|
|
|
|
46 |
VERSION = datasets.Version("1.0.0")
|
47 |
|
48 |
BUILDER_CONFIGS = [
|
49 |
+
datasets.BuilderConfig(name="original", version=VERSION, description="All original utterances, speaker id and transcription from Openslr Large Nepali ASR Dataset"),
|
50 |
+
datasets.BuilderConfig(name="cleaned", version=VERSION, description="All cleaned utterances, speaker id and transcription from Openslr Large Nepali ASR Dataset"),
|
|
|
|
|
51 |
]
|
52 |
|
|
|
53 |
DEFAULT_CONFIG_NAME = "original"
|
54 |
|
55 |
def _info(self):
|
|
|
64 |
)
|
65 |
return datasets.DatasetInfo(
|
66 |
description=_DESCRIPTION,
|
|
|
67 |
features=features,
|
|
|
|
|
|
|
|
|
68 |
homepage=_HOMEPAGE,
|
|
|
69 |
license=_LICENSE,
|
|
|
70 |
citation=_CITATION,
|
71 |
task_templates=[datasets.tasks.AutomaticSpeechRecognition(
|
72 |
audio_column="utterance", transcription_column="transcription"
|