Datasets:
Download partial-asr.py from omarc/partial-asr: direct link, hf CLI and curl.
- Browser
- Download file 3.33 kB
-
https://huggingface.co/datasets/omarc/partial-asr/resolve/main/partial-asr.py
- Command line
-
hf download hf://datasets/omarc/partial-asr/partial-asr.py
-
curl -L -o partial-asr.py https://huggingface.co/datasets/omarc/partial-asr/resolve/main/partial-asr.py
3.33 kB
| # coding=utf-8 | |
| # Copyright 2021 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # Lint as: python3 | |
| """Librispeech automatic speech recognition dataset.""" | |
| import os | |
| import datasets | |
| _CITATION = """\ | |
| @inproceedings{panayotov2015librispeech, | |
| title={Librispeech: an ASR corpus based on public domain audio books}, | |
| author={Panayotov, Vassil and Chen, Guoguo and Povey, Daniel and Khudanpur, Sanjeev}, | |
| booktitle={Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on}, | |
| pages={5206--5210}, | |
| year={2015}, | |
| organization={IEEE} | |
| } | |
| """ | |
| _LICENSE = "custom license - see project page" | |
| _DESCRIPTION = """\ | |
| LibriSpeech is a corpus of approximately 1000 hours of read English speech with sampling rate of 16 kHz, | |
| prepared by Vassil Panayotov with the assistance of Daniel Povey. The data is derived from read | |
| audiobooks from the LibriVox project, and has been carefully segmented and aligned.87 | |
| """ | |
| _URL = "http://www.openslr.org/12" | |
| class PartialASRConfig(datasets.BuilderConfig): | |
| """BuilderConfig for PartialASRConfig.""" | |
| def __init__(self, **kwargs): | |
| """ | |
| Args: | |
| data_dir: `string`, the path to the folder containing the files in the | |
| downloaded .tar | |
| citation: `string`, citation for the data set | |
| url: `string`, url for information about the data set | |
| **kwargs: keyword arguments forwarded to super. | |
| """ | |
| super(PartialASRConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs) | |
| class LibrispeechASR(datasets.GeneratorBasedBuilder): | |
| """Librispeech dataset.""" | |
| DEFAULT_WRITER_BATCH_SIZE = 256 | |
| DEFAULT_CONFIG_NAME = "all" | |
| BUILDER_CONFIGS = [ | |
| PartialASRConfig(name="original", description="The original transcriptions, no audio removed."), | |
| PartialASRConfig(name="5-percent-removed", description="5% of the audio file was removed from the end."), | |
| PartialASRConfig(name="10-percent-removed", description="10% of the audio file was removed from the end."), | |
| PartialASRConfig(name="15-percent-removed", description="15% of the audio file was removed from the end."), | |
| PartialASRConfig(name="20-percent-removed", description="20% of the audio file was removed from the end."), | |
| PartialASRConfig(name="25-percent-removed", description="25% of the audio file was removed from the end."), | |
| ] | |
| def _info(self): | |
| return datasets.DatasetInfo( | |
| description=_DESCRIPTION, | |
| features=datasets.Features( | |
| { | |
| "text": datasets.Value("string"), | |
| } | |
| ), | |
| supervised_keys=None, | |
| homepage=_URL, | |
| license=_LICENSE, | |
| citation=_CITATION, | |
| ) | |