Datasets:
Commit
·
5bfea78
1
Parent(s):
2831ba7
init
Browse files- data/coursera/dev.tar.gz +3 -0
- data/coursera/dev.tar.gz.lock +0 -0
- data/coursera/train.tar.gz +3 -0
- data/coursera/train.tar.gz.lock +0 -0
- hebrew_speech_coursera.py +61 -0
data/coursera/dev.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dd13ce53de4ee2f7bc3b51055d2baf836a073719d36d0425e8a8517929a6b521
|
3 |
+
size 1126457579
|
data/coursera/dev.tar.gz.lock
ADDED
File without changes
|
data/coursera/train.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1750d593e6ddcca90e1184c95b09c42e10aea88327b09524165b730110872f6e
|
3 |
+
size 4498440293
|
data/coursera/train.tar.gz.lock
ADDED
File without changes
|
hebrew_speech_coursera.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import glob
|
2 |
+
import os
|
3 |
+
from functools import partial
|
4 |
+
|
5 |
+
import datasets
|
6 |
+
|
7 |
+
DS_NAMES = [
|
8 |
+
"coursera"
|
9 |
+
]
|
10 |
+
VERSION = datasets.Version("0.0.1")
|
11 |
+
|
12 |
+
|
13 |
+
class PublicSpeech(datasets.GeneratorBasedBuilder):
|
14 |
+
"""Speech dataset."""
|
15 |
+
|
16 |
+
BUILDER_CONFIGS = [
|
17 |
+
datasets.BuilderConfig(name=data_name, version=VERSION, description=f"Speech {data_name} dataset")
|
18 |
+
for data_name in DS_NAMES
|
19 |
+
]
|
20 |
+
|
21 |
+
def _info(self):
|
22 |
+
return datasets.DatasetInfo(
|
23 |
+
description="Hebrew speech datasets",
|
24 |
+
features=datasets.Features(
|
25 |
+
{
|
26 |
+
"audio": datasets.Audio(sampling_rate=16000),
|
27 |
+
"sentence": datasets.Value("string"),
|
28 |
+
}
|
29 |
+
),
|
30 |
+
supervised_keys=("audio", "sentence"),
|
31 |
+
homepage="https://huggingface.co/datasets/imvladikon/hebrew_speech",
|
32 |
+
citation="TODO",
|
33 |
+
)
|
34 |
+
|
35 |
+
def _split_generators(self, dl_manager):
|
36 |
+
downloader = partial(
|
37 |
+
lambda split: dl_manager.download_and_extract(f"data/{self.config.name}/{split}.tar.gz"),
|
38 |
+
)
|
39 |
+
|
40 |
+
return [
|
41 |
+
datasets.SplitGenerator(
|
42 |
+
name=datasets.Split.TRAIN,
|
43 |
+
gen_kwargs={"root_path": downloader("train"), "split": "train"},
|
44 |
+
),
|
45 |
+
datasets.SplitGenerator(
|
46 |
+
name=datasets.Split.VALIDATION,
|
47 |
+
gen_kwargs={"root_path": downloader("dev"), "split": "dev"},
|
48 |
+
),
|
49 |
+
]
|
50 |
+
|
51 |
+
def _generate_examples(self, root_path, split):
|
52 |
+
split_path = os.path.join(root_path, split)
|
53 |
+
for wav in glob.glob(split_path + "/*.wav"):
|
54 |
+
uid = os.path.splitext(os.path.basename(wav))[0]
|
55 |
+
with open(os.path.join(split_path, f"{uid}.txt"), encoding="utf-8") as fin:
|
56 |
+
text = fin.read()
|
57 |
+
example = {
|
58 |
+
"audio": wav,
|
59 |
+
"sentence": text,
|
60 |
+
}
|
61 |
+
yield uid, example
|