Datasets:
Upload partial-asr.py
Browse files- partial-asr.py +87 -0
partial-asr.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2021 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
|
| 16 |
+
# Lint as: python3
|
| 17 |
+
"""Librispeech automatic speech recognition dataset."""
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
import os
|
| 21 |
+
|
| 22 |
+
import datasets
|
| 23 |
+
|
| 24 |
+
_CITATION = """\
|
| 25 |
+
@inproceedings{panayotov2015librispeech,
|
| 26 |
+
title={Librispeech: an ASR corpus based on public domain audio books},
|
| 27 |
+
author={Panayotov, Vassil and Chen, Guoguo and Povey, Daniel and Khudanpur, Sanjeev},
|
| 28 |
+
booktitle={Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on},
|
| 29 |
+
pages={5206--5210},
|
| 30 |
+
year={2015},
|
| 31 |
+
organization={IEEE}
|
| 32 |
+
}
|
| 33 |
+
"""
|
| 34 |
+
_LICENSE = "custom license - see project page"
|
| 35 |
+
|
| 36 |
+
_DESCRIPTION = """\
|
| 37 |
+
LibriSpeech is a corpus of approximately 1000 hours of read English speech with sampling rate of 16 kHz,
|
| 38 |
+
prepared by Vassil Panayotov with the assistance of Daniel Povey. The data is derived from read
|
| 39 |
+
audiobooks from the LibriVox project, and has been carefully segmented and aligned.87
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
+
_URL = "http://www.openslr.org/12"
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class PartialASRConfig(datasets.BuilderConfig):
|
| 46 |
+
"""BuilderConfig for PartialASRConfig."""
|
| 47 |
+
|
| 48 |
+
def __init__(self, **kwargs):
|
| 49 |
+
"""
|
| 50 |
+
Args:
|
| 51 |
+
data_dir: `string`, the path to the folder containing the files in the
|
| 52 |
+
downloaded .tar
|
| 53 |
+
citation: `string`, citation for the data set
|
| 54 |
+
url: `string`, url for information about the data set
|
| 55 |
+
**kwargs: keyword arguments forwarded to super.
|
| 56 |
+
"""
|
| 57 |
+
super(PartialASRConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class LibrispeechASR(datasets.GeneratorBasedBuilder):
|
| 61 |
+
"""Librispeech dataset."""
|
| 62 |
+
|
| 63 |
+
DEFAULT_WRITER_BATCH_SIZE = 256
|
| 64 |
+
DEFAULT_CONFIG_NAME = "all"
|
| 65 |
+
BUILDER_CONFIGS = [
|
| 66 |
+
PartialASRConfig(name="original", description="The original transcriptions, no audio removed."),
|
| 67 |
+
PartialASRConfig(name="5-percent-removed", description="5% of the audio file was removed from the end."),
|
| 68 |
+
PartialASRConfig(name="10-percent-removed", description="10% of the audio file was removed from the end."),
|
| 69 |
+
PartialASRConfig(name="15-percent-removed", description="15% of the audio file was removed from the end."),
|
| 70 |
+
PartialASRConfig(name="20-percent-removed", description="20% of the audio file was removed from the end."),
|
| 71 |
+
PartialASRConfig(name="25-percent-removed", description="25% of the audio file was removed from the end."),
|
| 72 |
+
|
| 73 |
+
]
|
| 74 |
+
|
| 75 |
+
def _info(self):
|
| 76 |
+
return datasets.DatasetInfo(
|
| 77 |
+
description=_DESCRIPTION,
|
| 78 |
+
features=datasets.Features(
|
| 79 |
+
{
|
| 80 |
+
"text": datasets.Value("string"),
|
| 81 |
+
}
|
| 82 |
+
),
|
| 83 |
+
supervised_keys=None,
|
| 84 |
+
homepage=_URL,
|
| 85 |
+
license=_LICENSE,
|
| 86 |
+
citation=_CITATION,
|
| 87 |
+
)
|