mpenagar commited on
Commit
e3c318d
1 Parent(s): 76ae58e

Initial release

Browse files
.gitattributes CHANGED
@@ -53,3 +53,20 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
+ audio/train_3.tar filter=lfs diff=lfs merge=lfs -text
57
+ audio/train_6.tar filter=lfs diff=lfs merge=lfs -text
58
+ metadata/test.tsv filter=lfs diff=lfs merge=lfs -text
59
+ metadata/train.tsv filter=lfs diff=lfs merge=lfs -text
60
+ audio/train_8.tar filter=lfs diff=lfs merge=lfs -text
61
+ metadata/dev.tsv filter=lfs diff=lfs merge=lfs -text
62
+ metadata/train_clean.tsv filter=lfs diff=lfs merge=lfs -text
63
+ audio/train_10.tar filter=lfs diff=lfs merge=lfs -text
64
+ audio/train_1.tar filter=lfs diff=lfs merge=lfs -text
65
+ audio/train_4.tar filter=lfs diff=lfs merge=lfs -text
66
+ audio/train_5.tar filter=lfs diff=lfs merge=lfs -text
67
+ audio/train_7.tar filter=lfs diff=lfs merge=lfs -text
68
+ audio/dev_0.tar filter=lfs diff=lfs merge=lfs -text
69
+ audio/test_0.tar filter=lfs diff=lfs merge=lfs -text
70
+ audio/train_0.tar filter=lfs diff=lfs merge=lfs -text
71
+ audio/train_2.tar filter=lfs diff=lfs merge=lfs -text
72
+ audio/train_9.tar filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc0-1.0
3
+ task_categories:
4
+ - automatic-speech-recognition
5
+ language:
6
+ - es
7
+ - eu
8
+ pretty_name: Basque Parliament Corpus 1.0
9
+ ---
audio/dev_0.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15b1a603e54345532b62e998084c70a16e8e6d5ce840eeeda09c46d9ab4da066
3
+ size 87152640
audio/test_0.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5d6fb717e8ee87f1462ab2c28f2c4a213b1cbcf6c89f9c2214d12c47b9a69d9
3
+ size 110704640
audio/train_0.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97218ccbaf968fdb103f75deded29100f8745377e98ebae68a200bfc8d6097fe
3
+ size 1583441920
audio/train_1.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d456823a5377369a0470f641b496db8b5ddaef4f18de4ec292ebeefaceb92b69
3
+ size 1577973760
audio/train_10.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27138b1c69910b65ac5c27612c5133bd2c9c883725a3972e8b6136925d12b404
3
+ size 701992960
audio/train_2.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac95854e4d7c25b0ddee94f9120e42a5374d720f59850f1b095aeb307a790d6f
3
+ size 1584486400
audio/train_3.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6737803ec69699c47b6e9b912041baa3c5c9cd4d83f4b415cb245298da6425f9
3
+ size 1578762240
audio/train_4.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3215f5da63e3a61dec78871a231a38f5aa1dde52d6a90b1ac39f044eb88befc
3
+ size 1584875520
audio/train_5.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc6530934c97c5a17ecb27c2c107918ec2182e038b43e4dc14f39daebfb41eba
3
+ size 1577738240
audio/train_6.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:723c752020adfd78b9213fe030d048d2668c26120f4dac0fba879fb2446aea65
3
+ size 1608622080
audio/train_7.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:66be9bbf8a8d1108d536f0beb9441fa38028ef2ec185b92ed89d20e8f503aa75
3
+ size 1594931200
audio/train_8.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4a573e50ea03f0709811ce6631d1b460ad531f0238c6b692da5352319431f73
3
+ size 1588899840
audio/train_9.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:106492eefd5161f400eff5209dbe30977f2d4e92c283c7bdb1f3bf502efa96f8
3
+ size 1574410240
basque_parliament_1.py ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2023 GTTS (http://gtts.ehu.eus)
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # Lint as: python3
16
+ """Basque Parliament dataset"""
17
+
18
+
19
+ import datasets
20
+ from datasets.utils.py_utils import size_str
21
+ import os
22
+ import csv
23
+ from tqdm import tqdm
24
+
25
+ from .languages import LANGUAGES
26
+ from .release_stats import STATS
27
+
28
+
29
+ _CITATION = """\
30
+ """
31
+
32
+ _HOMEPAGE = "https://huggingface.co/datasets/gttsehu/basque_parliament_1"
33
+
34
+ _LICENSE = "https://creativecommons.org/publicdomain/zero/1.0/"
35
+
36
+ _DESCRIPTION = (
37
+ f"Basque Parliament dataset blah blah blah..."
38
+ f"blah blah blah..."
39
+ f"blah blah blah..."
40
+ )
41
+
42
+ _BASE_URL = "https://huggingface.co/datasets/gttsehu/basque_parliament_1/resolve/main/"
43
+
44
+ _AUDIO_URL = _BASE_URL + "audio/{split}_{shard_idx}.tar"
45
+ _METADATA_URL = _BASE_URL + "metadata/{split}.tsv"
46
+
47
+ class BasqueParliamentConfig(datasets.BuilderConfig):
48
+ """BuilderConfig for BasqueParliament."""
49
+
50
+ def __init__(self, name, version, **kwargs):
51
+ self.language = kwargs.pop("language", None)
52
+ self.release_date = kwargs.pop("release_date", None)
53
+ self.num_clips = kwargs.pop("num_clips", None)
54
+ self.num_speakers = kwargs.pop("num_speakers", None)
55
+ self.validated_hr = kwargs.pop("validated_hr", None)
56
+ self.total_hr = kwargs.pop("total_hr", None)
57
+ self.size_bytes = kwargs.pop("size_bytes", None)
58
+ self.size_human = size_str(self.size_bytes)
59
+ description = _DESCRIPTION
60
+
61
+ super(BasqueParliamentConfig, self).__init__(
62
+ name = name,
63
+ version = datasets.Version(version),
64
+ description = _DESCRIPTION,
65
+ **kwargs,
66
+ )
67
+
68
+
69
+ class BasqueParliament(datasets.GeneratorBasedBuilder):
70
+ """Basque Parliament is a free Basque-Spanish speech corpus."""
71
+
72
+ DEFAULT_CONFIG_NAME = "all"
73
+
74
+ BUILDER_CONFIGS = [
75
+ BasqueParliamentConfig(
76
+ name=lang,
77
+ version=STATS["version"],
78
+ language=LANGUAGES[lang],
79
+ release_date=STATS["date"],
80
+ num_clips=lang_stats["clips"],
81
+ num_speakers=lang_stats["users"],
82
+ total_hr=float(lang_stats["totalHrs"]) if lang_stats["totalHrs"] else None,
83
+ size_bytes=int(lang_stats["size"]) if lang_stats["size"] else None,
84
+ )
85
+ for lang, lang_stats in STATS["locales"].items()
86
+ ]
87
+
88
+ def _info(self):
89
+ description = (
90
+ f"Basque Parliament dataset blah blah blah..."
91
+ f"blah blah blah..."
92
+ f"blah blah blah..."
93
+ )
94
+ features = datasets.Features(
95
+ {
96
+ "path": datasets.Value("string"),
97
+ "audio": datasets.features.Audio(sampling_rate=16_000),
98
+ "sentence": datasets.Value("string"),
99
+ "speaker_id": datasets.Value("string"),
100
+ "language": datasets.Value("string"),
101
+ "PRR": datasets.Value("float32"),
102
+ "length": datasets.Value("float32"),
103
+ }
104
+ )
105
+
106
+ return datasets.DatasetInfo(
107
+ description = _DESCRIPTION,
108
+ features = features,
109
+ supervised_keys = None,
110
+ homepage = _HOMEPAGE,
111
+ license = _LICENSE,
112
+ citation = _CITATION,
113
+ version = self.config.version,
114
+ )
115
+
116
+
117
+ def _split_generators(self, dl_manager):
118
+ lang = self.config.name
119
+
120
+ audio_urls = {}
121
+ splits = ("train", "train_clean", "dev", "test")
122
+ for split in splits:
123
+ if split == "train_clean": continue
124
+ audio_urls[split] = [
125
+ _AUDIO_URL.format(split=split, shard_idx=i) for i in range(STATS["n_shards"][split])
126
+ ]
127
+ audio_urls["train_clean"]=audio_urls["train"]
128
+ archive_paths = dl_manager.download(audio_urls)
129
+ local_extracted_archive_paths = dl_manager.extract(archive_paths) if not dl_manager.is_streaming else {}
130
+
131
+ metadata_urls = {split: _METADATA_URL.format(lang=lang, split=split) for split in splits}
132
+ metadata_paths = dl_manager.download_and_extract(metadata_urls)
133
+
134
+ split_generators = []
135
+ split_names = {
136
+ "train": datasets.Split.TRAIN,
137
+ "dev": datasets.Split.VALIDATION,
138
+ "test": datasets.Split.TEST,
139
+ }
140
+ for split in splits:
141
+ split_generators.append(
142
+ datasets.SplitGenerator(
143
+ name=split_names.get(split, split),
144
+ gen_kwargs={
145
+ "local_extracted_archive_paths": local_extracted_archive_paths.get(split),
146
+ "archives": [dl_manager.iter_archive(path) for path in archive_paths.get(split)],
147
+ "metadata_path": metadata_paths[split],
148
+ },
149
+ ),
150
+ )
151
+
152
+ return split_generators
153
+
154
+ def _generate_examples(self, local_extracted_archive_paths, archives, metadata_path):
155
+ lang = self.config.name
156
+ data_fields = list(self._info().features.keys())
157
+ metadata = {}
158
+ with open(metadata_path, encoding="utf-8") as f:
159
+ reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
160
+ metadata = { row["path"]:row for row in tqdm(reader, desc="Reading metadata...") }
161
+
162
+ excluded = 0
163
+ for i, audio_archive in enumerate(archives):
164
+ for path, file in audio_archive:
165
+ if path not in metadata :
166
+ excluded += 1
167
+ continue
168
+ result = dict(metadata[path])
169
+ if lang == "all" or lang == result["language"] :
170
+ # set the audio feature and the path to the extracted file
171
+ path = os.path.join(local_extracted_archive_paths[i], path) if local_extracted_archive_paths else path
172
+ result["audio"] = {"path": path, "bytes": file.read()}
173
+ result["path"] = path
174
+ yield path, result
175
+ print(excluded,'audio files not found in metadata')
176
+
languages.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ LANGUAGES = {
2
+ 'eu': 'Basque (Euskara)' ,
3
+ 'es': 'Spanish (Español)' ,
4
+ 'bi': 'Mixed Basque + Spanish (Euskara + Español)' ,
5
+ 'all': 'All' ,
6
+ }
metadata/dev.tsv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:891440ba0ecac79bb9ec6eda088e0ef1f6c7b509c48e7c0953d20cd9c35beea3
3
+ size 755615
metadata/test.tsv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d134bb26a872ab30f47ed9f09b72941cd4540e68075346615b47c0f7200a13b
3
+ size 942019
metadata/train.tsv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19fad432b30bb83b57e579eeabfef7e9448ce1af453011e3215a179f81355485
3
+ size 137997555
metadata/train_clean.tsv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:219b0d8fd647d3e9f09fe002bee43b0c30c115030993d690df6f674cc7c79c32
3
+ size 124067153
release_stats.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ STATS = {
2
+ "name": "BasqueParliament",
3
+ "version": "1.0.0",
4
+ "date": "2023-12-29",
5
+ "years": (2013,2014,2015,2016,2017,2018,2019,2020,2021,2022),
6
+ "locales": {
7
+ "es": {'reportedSentences': 149, 'duration': 1, 'clips': 1, 'users': 416, 'size': 1, 'avgDurationSecs': 1, 'totalHrs': 1},
8
+ "eu": {'reportedSentences': 175, 'duration': 1, 'clips': 1, 'users': 416, 'size': 1, 'avgDurationSecs': 1, 'totalHrs': 1},
9
+ "bi": {'reportedSentences': 142, 'duration': 1, 'clips': 1, 'users': 416, 'size': 1, 'avgDurationSecs': 1, 'totalHrs': 1},
10
+ "all": {'reportedSentences': 142, 'duration': 1, 'clips': 1, 'users': 416, 'size': 1, 'avgDurationSecs': 1, 'totalHrs': 1},
11
+ },
12
+ "n_shards" : {
13
+ "train" : 11 ,
14
+ "dev" : 1,
15
+ "test" : 1
16
+ },
17
+ 'totalDuration': 1,
18
+ 'totalHrs': 1
19
+ }