Datasets:
carlosdanielhernandezmena
commited on
Commit
•
6576c80
1
Parent(s):
22adad3
Adding audio files to the repo
Browse files- corpus/files/metadata_dev.tsv +0 -0
- corpus/files/metadata_test.tsv +0 -0
- corpus/files/metadata_train.tsv +0 -0
- corpus/files/tars_dev.paths +1 -0
- corpus/files/tars_test.paths +1 -0
- corpus/files/tars_train.paths +3 -0
- corpus/speech/dev.tar.gz +3 -0
- corpus/speech/dev.tar.gz.lock +0 -0
- corpus/speech/test.tar.gz +3 -0
- corpus/speech/test.tar.gz.lock +0 -0
- corpus/speech/train/train_part_01.tar.gz +3 -0
- corpus/speech/train/train_part_01.tar.gz.lock +0 -0
- corpus/speech/train/train_part_02.tar.gz +3 -0
- corpus/speech/train/train_part_02.tar.gz.lock +0 -0
- corpus/speech/train/train_part_03.tar.gz +3 -0
- corpus/speech/train/train_part_03.tar.gz.lock +0 -0
- samromur_children.py +154 -0
corpus/files/metadata_dev.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
corpus/files/metadata_test.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
corpus/files/metadata_train.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
corpus/files/tars_dev.paths
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
corpus/speech/dev.tar.gz
|
corpus/files/tars_test.paths
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
corpus/speech/test.tar.gz
|
corpus/files/tars_train.paths
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
corpus/speech/train/train_part_01.tar.gz
|
2 |
+
corpus/speech/train/train_part_02.tar.gz
|
3 |
+
corpus/speech/train/train_part_03.tar.gz
|
corpus/speech/dev.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6ac2f303f13865b83c575ad30dc7478119791e53a5c1229451edef697bd65273
|
3 |
+
size 97904092
|
corpus/speech/dev.tar.gz.lock
ADDED
File without changes
|
corpus/speech/test.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8c25ba87b02ed93834f140597c087f9457fee304b96eca39af2f49ab0b5350a5
|
3 |
+
size 96491069
|
corpus/speech/test.tar.gz.lock
ADDED
File without changes
|
corpus/speech/train/train_part_01.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a34abbaa2bbe125bac1389673089f26ce8c4821c0e7e8042c1e360ce932e75cd
|
3 |
+
size 1692048832
|
corpus/speech/train/train_part_01.tar.gz.lock
ADDED
File without changes
|
corpus/speech/train/train_part_02.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4a1d3a45c6f58999ebf04ad2a41a63e95257bac47908c2a53d9abf769ef31916
|
3 |
+
size 2613128168
|
corpus/speech/train/train_part_02.tar.gz.lock
ADDED
File without changes
|
corpus/speech/train/train_part_03.tar.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0776b4c4bf25e0e46eada3dd50623ec330e15a8f86d22f399acb7301cd52bdf7
|
3 |
+
size 2299865851
|
corpus/speech/train/train_part_03.tar.gz.lock
ADDED
File without changes
|
samromur_children.py
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from collections import defaultdict
|
2 |
+
import os
|
3 |
+
import json
|
4 |
+
import csv
|
5 |
+
|
6 |
+
import datasets
|
7 |
+
|
8 |
+
_NAME="samromur_children"
|
9 |
+
_VERSION="1.0.0"
|
10 |
+
_AUDIO_EXTENSIONS=".flac"
|
11 |
+
|
12 |
+
_DESCRIPTION = """
|
13 |
+
The Samrómur Children corpus contains more than 137000 validated speech-recordings uttered by Icelandic children.
|
14 |
+
"""
|
15 |
+
|
16 |
+
_CITATION = """
|
17 |
+
@misc{menasamromurchildren2021,
|
18 |
+
title={Samrómur Children Icelandic Speech 1.0},
|
19 |
+
ldc_catalog_no={LDC2022S11},
|
20 |
+
DOI={https://doi.org/10.35111/frrj-qd60},
|
21 |
+
author={Hernández Mena, Carlos Daniel and Borsky, Michal and Mollberg, David Erik and Guðmundsson, Smári Freyr and Hedström, Staffan and Pálsson, Ragnar and Jónsson, Ólafur Helgi and Þorsteinsdóttir, Sunneva and Guðmundsdóttir, Jóhanna Vigdís and Magnúsdóttir, Eydís Huld and Þórhallsdóttir, Ragnheiður and Guðnason, Jón},
|
22 |
+
publisher={Reykjavík University}
|
23 |
+
journal={Linguistic Data Consortium, Philadelphia},
|
24 |
+
year={2019},
|
25 |
+
url={https://catalog.ldc.upenn.edu/LDC2022S11},
|
26 |
+
}
|
27 |
+
"""
|
28 |
+
|
29 |
+
_HOMEPAGE = "https://catalog.ldc.upenn.edu/LDC2022S11"
|
30 |
+
|
31 |
+
_LICENSE = "CC-BY-4.0, See https://creativecommons.org/licenses/by/4.0/"
|
32 |
+
|
33 |
+
_BASE_DATA_DIR = "corpus/"
|
34 |
+
_METADATA_TRAIN = os.path.join(_BASE_DATA_DIR,"files","metadata_train.tsv")
|
35 |
+
_METADATA_TEST = os.path.join(_BASE_DATA_DIR,"files", "metadata_test.tsv")
|
36 |
+
_METADATA_DEV = os.path.join(_BASE_DATA_DIR,"files", "metadata_dev.tsv")
|
37 |
+
|
38 |
+
_TARS_TRAIN = os.path.join(_BASE_DATA_DIR,"files","tars_train.paths")
|
39 |
+
_TARS_TEST = os.path.join(_BASE_DATA_DIR,"files", "tars_test.paths")
|
40 |
+
_TARS_DEV = os.path.join(_BASE_DATA_DIR,"files", "tars_dev.paths")
|
41 |
+
|
42 |
+
class SamromurChildrenConfig(datasets.BuilderConfig):
|
43 |
+
"""BuilderConfig for Samromur Children"""
|
44 |
+
|
45 |
+
def __init__(self, name, **kwargs):
|
46 |
+
name=_NAME
|
47 |
+
super().__init__(name=name, **kwargs)
|
48 |
+
|
49 |
+
class SamromurChildren(datasets.GeneratorBasedBuilder):
|
50 |
+
"""Samrómur Children Icelandic Speech 1.0"""
|
51 |
+
|
52 |
+
VERSION = datasets.Version(_VERSION)
|
53 |
+
BUILDER_CONFIGS = [
|
54 |
+
SamromurChildrenConfig(
|
55 |
+
name=_NAME,
|
56 |
+
version=datasets.Version(_VERSION),
|
57 |
+
)
|
58 |
+
]
|
59 |
+
|
60 |
+
def _info(self):
|
61 |
+
features = datasets.Features(
|
62 |
+
{
|
63 |
+
"audio_id": datasets.Value("string"),
|
64 |
+
"audio": datasets.Audio(sampling_rate=16000),
|
65 |
+
"speaker_id": datasets.Value("string"),
|
66 |
+
"gender": datasets.Value("string"),
|
67 |
+
"age": datasets.Value("string"),
|
68 |
+
"duration": datasets.Value("float32"),
|
69 |
+
"normalized_text": datasets.Value("string"),
|
70 |
+
}
|
71 |
+
)
|
72 |
+
return datasets.DatasetInfo(
|
73 |
+
description=_DESCRIPTION,
|
74 |
+
features=features,
|
75 |
+
homepage=_HOMEPAGE,
|
76 |
+
license=_LICENSE,
|
77 |
+
citation=_CITATION,
|
78 |
+
)
|
79 |
+
|
80 |
+
def _split_generators(self, dl_manager):
|
81 |
+
|
82 |
+
metadata_train=dl_manager.download_and_extract(_METADATA_TRAIN)
|
83 |
+
metadata_test=dl_manager.download_and_extract(_METADATA_TEST)
|
84 |
+
metadata_dev=dl_manager.download_and_extract(_METADATA_DEV)
|
85 |
+
|
86 |
+
tars_train=dl_manager.download_and_extract(_TARS_TRAIN)
|
87 |
+
tars_test=dl_manager.download_and_extract(_TARS_TEST)
|
88 |
+
tars_dev=dl_manager.download_and_extract(_TARS_DEV)
|
89 |
+
|
90 |
+
hash_tar_files=defaultdict(dict)
|
91 |
+
with open(tars_train,'r') as f:
|
92 |
+
hash_tar_files['train']=[path.replace('\n','') for path in f]
|
93 |
+
|
94 |
+
with open(tars_test,'r') as f:
|
95 |
+
hash_tar_files['test']=[path.replace('\n','') for path in f]
|
96 |
+
|
97 |
+
with open(tars_dev,'r') as f:
|
98 |
+
hash_tar_files['dev']=[path.replace('\n','') for path in f]
|
99 |
+
|
100 |
+
hash_meta_paths={"train":metadata_train,"test":metadata_test,"dev":metadata_dev}
|
101 |
+
audio_paths = dl_manager.download(hash_tar_files)
|
102 |
+
|
103 |
+
splits=["train","dev","test"]
|
104 |
+
local_extracted_audio_paths = (
|
105 |
+
dl_manager.extract(audio_paths) if not dl_manager.is_streaming else
|
106 |
+
{
|
107 |
+
split:[None] * len(audio_paths[split]) for split in splits
|
108 |
+
}
|
109 |
+
)
|
110 |
+
|
111 |
+
return [
|
112 |
+
datasets.SplitGenerator(
|
113 |
+
name=datasets.Split.TRAIN,
|
114 |
+
gen_kwargs={
|
115 |
+
"audio_archives":[dl_manager.iter_archive(archive) for archive in audio_paths["train"]],
|
116 |
+
"local_extracted_archives_paths": local_extracted_audio_paths["train"],
|
117 |
+
"metadata_paths": hash_meta_paths["train"],
|
118 |
+
}
|
119 |
+
),
|
120 |
+
datasets.SplitGenerator(
|
121 |
+
name=datasets.Split.VALIDATION,
|
122 |
+
gen_kwargs={
|
123 |
+
"audio_archives": [dl_manager.iter_archive(archive) for archive in audio_paths["dev"]],
|
124 |
+
"local_extracted_archives_paths": local_extracted_audio_paths["dev"],
|
125 |
+
"metadata_paths": hash_meta_paths["dev"],
|
126 |
+
}
|
127 |
+
),
|
128 |
+
datasets.SplitGenerator(
|
129 |
+
name=datasets.Split.TEST,
|
130 |
+
gen_kwargs={
|
131 |
+
"audio_archives": [dl_manager.iter_archive(archive) for archive in audio_paths["test"]],
|
132 |
+
"local_extracted_archives_paths": local_extracted_audio_paths["test"],
|
133 |
+
"metadata_paths": hash_meta_paths["test"],
|
134 |
+
}
|
135 |
+
),
|
136 |
+
]
|
137 |
+
|
138 |
+
def _generate_examples(self, audio_archives, local_extracted_archives_paths, metadata_paths):
|
139 |
+
|
140 |
+
features = ["speaker_id","gender","age","duration","normalized_text"]
|
141 |
+
|
142 |
+
with open(metadata_paths) as f:
|
143 |
+
metadata = {x["audio_id"]: x for x in csv.DictReader(f, delimiter="\t")}
|
144 |
+
|
145 |
+
for audio_archive, local_extracted_archive_path in zip(audio_archives, local_extracted_archives_paths):
|
146 |
+
for audio_filename, audio_file in audio_archive:
|
147 |
+
audio_id = audio_filename.split(os.sep)[-1].split(_AUDIO_EXTENSIONS)[0]
|
148 |
+
path = os.path.join(local_extracted_archive_path, audio_filename) if local_extracted_archive_path else audio_filename
|
149 |
+
|
150 |
+
yield audio_id, {
|
151 |
+
"audio_id": audio_id,
|
152 |
+
**{feature: metadata[audio_id][feature] for feature in features},
|
153 |
+
"audio": {"path": path, "bytes": audio_file.read()},
|
154 |
+
}
|