the-mc-speech-dataset / the-mc-speech-dataset.py
czyzi0's picture
Fix typo
59ce784
raw
history blame
2.2 kB
# coding=utf-8
import datasets
_DESCRIPTION = """\
This is public domain speech dataset consisting of 24018 short audio clips of a single speaker
reading sentences in Polish. A transcription is provided for each clip. Clips have total length of
more than 22 hours.
Texts are in public domain. The audio was recorded in 2021-22 as a part of my master's thesis and
is in public domain.
"""
_HOMEPAGE = "https://github.com/czyzi0/the-mc-speech-dataset"
_CITATION = """\
@masterthesis{mcspeech,
title={Analiza porównawcza korpusów nagrań mowy dla celów syntezy mowy w języku polskim},
author={Czyżnikiewicz, Mateusz},
year={2022},
month={December},
school={Warsaw University of Technology},
type={Master's thesis},
doi={10.13140/RG.2.2.26293.24800},
note={Available at \\url{http://dx.doi.org/10.13140/RG.2.2.26293.24800}},
}
"""
_LICENSE = "CC0 1.0"
class MCSpeech(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"id": datasets.Value("string"),
"transcript": datasets.Value("string"),
},
),
supervised_keys=None,
homepage=_HOMEPAGE,
citation=_CITATION,
license=_LICENSE,
)
def _split_generators(self, dl_manager):
transcripts_path = dl_manager.download_and_extract(
"https://huggingface.co/datasets/czyzi0/the-mc-speech-dataset/raw/main/transcripts.tsv"
)
return [
datasets.SplitGenerator(
name="train",
gen_kwargs={"transcripts_path": transcripts_path}
)
]
def _generate_examples(self, transcripts_path):
with open(transcripts_path, "r") as fh:
header = next(fh).strip().split("\t")
for item_idx, line in enumerate(fh):
line = line.strip().split("\t")
item = {
"id": line[header.index("id")],
"transcript": line[header.index("transcript")],
}
yield item_idx, item