|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""Librispeech language modeling dataset.""" |
|
|
|
|
|
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} |
|
} |
|
""" |
|
|
|
_DESCRIPTION = """\ |
|
Language modeling resources to be used in conjunction with the LibriSpeech ASR corpus. |
|
""" |
|
|
|
_URL = "http://www.openslr.org/11" |
|
|
|
_DL_URL = "http://www.openslr.org/resources/11/librispeech-lm-norm.txt.gz" |
|
|
|
|
|
class LibrispeechLm(datasets.GeneratorBasedBuilder): |
|
"""Librispeech language modeling dataset.""" |
|
|
|
VERSION = datasets.Version("0.1.0") |
|
|
|
def _info(self): |
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=datasets.Features( |
|
{ |
|
"text": datasets.Value("string"), |
|
} |
|
), |
|
supervised_keys=("text", "text"), |
|
homepage=_URL, |
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
"""Returns SplitGenerators.""" |
|
archive_path = dl_manager.download_and_extract(_DL_URL) |
|
return [ |
|
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"archive_path": archive_path}), |
|
] |
|
|
|
def _generate_examples(self, archive_path): |
|
"""Yields examples.""" |
|
with open(archive_path, "r", encoding="utf-8") as f: |
|
for key, line in enumerate(f): |
|
text = line.strip() |
|
if text: |
|
yield key, {"text": text} |
|
|