Datasets:
Add basic dataset script
Browse files- the-mc-speech-dataset.py +67 -0
the-mc-speech-dataset.py
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
|
3 |
+
import datasets
|
4 |
+
|
5 |
+
|
6 |
+
_DESCRIPTION = """\
|
7 |
+
This is public domain speech dataset consisting of 24018 short audio clips of a single speaker
|
8 |
+
reading sentences in Polish. A transcription is provided for each clip. Clips have total length of
|
9 |
+
more than 22 hours.
|
10 |
+
Texts are in public domain. The audio was recorded in 2021-22 as a part of my master's thesis and
|
11 |
+
is in public domain.
|
12 |
+
"""
|
13 |
+
_HOMEPAGE = "https://github.com/czyzi0/the-mc-speech-dataset"
|
14 |
+
_CITATION = """\
|
15 |
+
@masterthesis{mcspeech,
|
16 |
+
title={Analiza porównawcza korpusów nagrań mowy dla celów syntezy mowy w języku polskim},
|
17 |
+
author={Czyżnikiewicz, Mateusz},
|
18 |
+
year={2022},
|
19 |
+
month={December},
|
20 |
+
school={Warsaw University of Technology},
|
21 |
+
type={Master's thesis},
|
22 |
+
doi={10.13140/RG.2.2.26293.24800},
|
23 |
+
note={Available at \url{http://dx.doi.org/10.13140/RG.2.2.26293.24800}},
|
24 |
+
}
|
25 |
+
"""
|
26 |
+
_LICENSE = "CC0 1.0"
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
class MCSpeech(datasets.GeneratorBasedBuilder):
|
31 |
+
|
32 |
+
def _info(self):
|
33 |
+
return datasets.DatasetInfo(
|
34 |
+
description=_DESCRIPTION,
|
35 |
+
features=datasets.Features(
|
36 |
+
{
|
37 |
+
"id": datasets.Value("string"),
|
38 |
+
"transcript": datasets.Value("string"),
|
39 |
+
},
|
40 |
+
),
|
41 |
+
supervised_keys=None,
|
42 |
+
homepage=_HOMEPAGE,
|
43 |
+
citation=_CITATION,
|
44 |
+
license=_LICENSE,
|
45 |
+
)
|
46 |
+
|
47 |
+
def _split_generators(self, dl_manager):
|
48 |
+
transcripts_path = dl_manager.download_and_extract(
|
49 |
+
"https://huggingface.co/datasets/czyzi0/the-mc-speech-dataset/raw/main/transcripts.tsv"
|
50 |
+
)
|
51 |
+
return [
|
52 |
+
datasets.SplitGenerator(
|
53 |
+
name="train",
|
54 |
+
gen_kwargs={"transcripts_path": transcripts_path}
|
55 |
+
)
|
56 |
+
]
|
57 |
+
|
58 |
+
def _generate_examples(self, transcipts_path):
|
59 |
+
with open(transcripts_path, "r") as fh:
|
60 |
+
header = next(fh).strip().split("\t")
|
61 |
+
for item_idx, line in enumerate(fh):
|
62 |
+
line = line.strip().split("\t")
|
63 |
+
item = {
|
64 |
+
"id": line[header.index("id")],
|
65 |
+
"transcript": line[header.index("transcript")],
|
66 |
+
}
|
67 |
+
yield item_idx, item
|