Datasets:
Tasks:
Automatic Speech Recognition
Formats:
parquet
Size:
10K - 100K
Tags:
speech-recognition
License:
BenjaminGalliot
commited on
Commit
•
f80e65e
0
Parent(s):
Version 1.0
Browse files- README.md +169 -0
- dataset_infos.json +1 -0
- dummy/japh1234/1.0.0/dummy_data.zip +3 -0
- dummy/yong1288/1.0.0/dummy_data.zip +3 -0
- pangloss.py +205 -0
README.md
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pretty_name: Pangloss
|
3 |
+
annotations_creators:
|
4 |
+
- expert-generated
|
5 |
+
language_creators:
|
6 |
+
- expert-generated
|
7 |
+
language:
|
8 |
+
- jya
|
9 |
+
- nru
|
10 |
+
language_bcp47:
|
11 |
+
- x-japh1234
|
12 |
+
- x-yong1288
|
13 |
+
language_details: jya consists of japh1234 (Glottolog code); nru consists of yong1288 (Glottolog code)
|
14 |
+
license: cc-by-nc-sa-4.0
|
15 |
+
multilinguality:
|
16 |
+
- multilingual
|
17 |
+
- translation
|
18 |
+
size_categories:
|
19 |
+
yong1288:
|
20 |
+
- 10K<n<100K
|
21 |
+
japh1234:
|
22 |
+
- 10K<n<100K
|
23 |
+
source_datasets:
|
24 |
+
- original
|
25 |
+
task_categories:
|
26 |
+
- automatic-speech-recognition
|
27 |
+
task_ids:
|
28 |
+
- speech-recognition
|
29 |
+
---
|
30 |
+
|
31 |
+
# Dataset Card for [Needs More Information]
|
32 |
+
|
33 |
+
## Table of Contents
|
34 |
+
- [Dataset Description](#dataset-description)
|
35 |
+
- [Dataset Summary](#dataset-summary)
|
36 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
37 |
+
- [Languages](#languages)
|
38 |
+
- [Dataset Structure](#dataset-structure)
|
39 |
+
- [Data Instances](#data-instances)
|
40 |
+
- [Data Fields](#data-instances)
|
41 |
+
- [Data Splits](#data-instances)
|
42 |
+
- [Dataset Creation](#dataset-creation)
|
43 |
+
- [Curation Rationale](#curation-rationale)
|
44 |
+
- [Source Data](#source-data)
|
45 |
+
- [Annotations](#annotations)
|
46 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
47 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
48 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
49 |
+
- [Discussion of Biases](#discussion-of-biases)
|
50 |
+
- [Other Known Limitations](#other-known-limitations)
|
51 |
+
- [Additional Information](#additional-information)
|
52 |
+
- [Dataset Curators](#dataset-curators)
|
53 |
+
- [Licensing Information](#licensing-information)
|
54 |
+
- [Citation Information](#citation-information)
|
55 |
+
|
56 |
+
## Dataset Description
|
57 |
+
|
58 |
+
- **Homepage:** [Web interface of the Pangloss Collection, which hosts the data sets](https://pangloss.cnrs.fr/)
|
59 |
+
- **Repository:** [GithHub repository of the Pangloss Collection, which hosts the data sets](https://github.com/CNRS-LACITO/Pangloss/)
|
60 |
+
- **Paper:** [A paper about the Pangloss Collection, including a presentation of the Document Type Definition](https://halshs.archives-ouvertes.fr/halshs-01003734)
|
61 |
+
[A paper in French about the deposit in Zenodo](https://halshs.archives-ouvertes.fr/halshs-03475436)
|
62 |
+
- **Leaderboard:** [Needs More Information]
|
63 |
+
- **Point of Contact:** [Benjamin Galliot](mailto:[email protected])
|
64 |
+
|
65 |
+
### Dataset Summary
|
66 |
+
|
67 |
+
Two audio corpora of minority languages of China (Japhug and Na), with transcriptions, proposed as reference data sets for experiments in Natural Language Processing. The data, collected and transcribed in the course of immersion fieldwork, amount to a total of about 1,900 minutes in Japhug and 200 minutes in Na. By making them available in an easily accessible and usable form, we hope to facilitate the development and deployment of state-of-the-art NLP tools for the full range of human languages. There is an associated tool for assembling datasets from the Pangloss Collection (an open archive) in a way that ensures full reproducibility of experiments conducted on these data.
|
68 |
+
The Document Type Definition for the XML files is available here:
|
69 |
+
http://cocoon.huma-num.fr/schemas/Archive.dtd
|
70 |
+
|
71 |
+
### Supported Tasks and Leaderboards
|
72 |
+
|
73 |
+
[Needs More Information]
|
74 |
+
|
75 |
+
### Languages
|
76 |
+
|
77 |
+
Japhug (ISO 639-3 code: jya, Glottolog language code: japh1234) and Yongning Na (ISO 639-3 code: nru, Glottolog language code: yong1288) are two minority languages of China. The documents in the dataset have a transcription in the endangered language. Some of the documents have translations into French, English, and Chinese.
|
78 |
+
|
79 |
+
## Dataset Structure
|
80 |
+
|
81 |
+
### Data Instances
|
82 |
+
|
83 |
+
A typical data row includes the path, audio, sentence, document type and several translations (depending on the sub-corpus).
|
84 |
+
|
85 |
+
`
|
86 |
+
{
|
87 |
+
"path": "cocoon-db3cf0e1-30bb-3225-b012-019252bb4f4d_C1/Tone_BodyPartsOfAnimals_12_F4_2008_withEGG_069.wav",
|
88 |
+
"audio": "{'path': 'na/cocoon-db3cf0e1-30bb-3225-b012-019252bb4f4d_C1/Tone_BodyPartsOfAnimals_12_F4_2008_withEGG_069.wav', 'array': array([0.00018311, 0.00015259, 0.00021362, ..., 0.00030518, 0.00030518, 0.00054932], dtype=float32), 'sampling_rate': 16000}",
|
89 |
+
"sentence": "ʈʂʰɯ˧ | ɖɤ˧mi˧-ɬi˧pi˩ ɲi˩",
|
90 |
+
"doctype": "WORDLIST",
|
91 |
+
"translation:zh": "狐狸的耳朵",
|
92 |
+
"translation:fr": "oreilles de renard",
|
93 |
+
"translation:en": "fox's ears",
|
94 |
+
}
|
95 |
+
`
|
96 |
+
|
97 |
+
### Data Fields
|
98 |
+
|
99 |
+
path: the path to the audio file;;
|
100 |
+
|
101 |
+
audio: a dictionary containing the path to the audio file, the audio array and the sampling rate;
|
102 |
+
|
103 |
+
sentence: the sentence the native has pronunced;
|
104 |
+
|
105 |
+
doctype: the document type (a text or a word list);
|
106 |
+
|
107 |
+
translation:XX: the translation of the sentence in the language XX.
|
108 |
+
|
109 |
+
### Data Splits
|
110 |
+
|
111 |
+
The train, test and validation splits have all been reviewed and were splitted randomly (ratio 8:1:1) at sentence level (after the extraction from various files).
|
112 |
+
|
113 |
+
## Dataset Creation
|
114 |
+
|
115 |
+
### Curation Rationale
|
116 |
+
|
117 |
+
[Needs More Information]
|
118 |
+
|
119 |
+
### Source Data
|
120 |
+
|
121 |
+
#### Initial Data Collection and Normalization
|
122 |
+
|
123 |
+
[Needs More Information]
|
124 |
+
|
125 |
+
#### Who are the source language producers?
|
126 |
+
|
127 |
+
[Needs More Information]
|
128 |
+
|
129 |
+
### Annotations
|
130 |
+
|
131 |
+
#### Annotation process
|
132 |
+
|
133 |
+
[Needs More Information]
|
134 |
+
|
135 |
+
#### Who are the annotators?
|
136 |
+
|
137 |
+
[Needs More Information]
|
138 |
+
|
139 |
+
### Personal and Sensitive Information
|
140 |
+
|
141 |
+
[Needs More Information]
|
142 |
+
|
143 |
+
## Considerations for Using the Data
|
144 |
+
|
145 |
+
### Social Impact of Dataset
|
146 |
+
|
147 |
+
The dataset was collected in immersion fieldwork for language documentation. It contributes to the documentation and study of the world's languages by providing documents of connected, spontaneous speech recorded in their cultural context and transcribed in consultation with native speakers. The impacts concern research, and society at large: a guiding principle of the Pangloss Collection, which hosts the data sets, is that a close association between documentation and research is highly profitable to both. A range of possibilities for uses exist, for the scientific and speaker communities and for the general public.
|
148 |
+
|
149 |
+
### Discussion of Biases
|
150 |
+
|
151 |
+
The corpora are single-speaker and hence clearly do not reflect the sociolinguistic and dialectal diversity of the languages. No claim is made that the language variety described constitutes a 'standard'.
|
152 |
+
|
153 |
+
### Other Known Limitations
|
154 |
+
|
155 |
+
The translations are entirely hand-made by experts working on these languages; the amount and type of translations available varies from document to document, as not all documents have translations and not all translated documents have the same translation languages (Chinese, French, English...).
|
156 |
+
|
157 |
+
## Additional Information
|
158 |
+
|
159 |
+
### Dataset Curators
|
160 |
+
|
161 |
+
[Needs More Information]
|
162 |
+
|
163 |
+
### Licensing Information
|
164 |
+
|
165 |
+
[Needs More Information]
|
166 |
+
|
167 |
+
### Citation Information
|
168 |
+
|
169 |
+
[Needs More Information]
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"yong1288": {"description": "These datasets are extracts from the Pangloss collection and have\nbeen preprocessed for ASR experiments in Na and Japhug.\n", "citation": {"yong1288": "\n@misc{michaud_alexis_2021_5336698,\nauthor = {Michaud, Alexis and\n Galliot, Benjamin and\n Guillaume, S\u00e9verine},\ntitle = {{Yongning Na for Natural Language Processing: a\n single-speaker audio corpus with transcriptions}},\nmonth = aug,\nyear = 2021,\npublisher = {Zenodo},\nversion = {1.0},\ndoi = {10.5281/zenodo.5336698},\nurl = {https://doi.org/10.5281/zenodo.5336698}\n }\n ", "japh1234": "@misc{jacques_guillaume_2021_5521112,\nauthor = {Jacques, Guillaume and\n Galliot, Benjamin and\n Guillaume, S\u00e9verine},\ntitle = {{Japhug for Natural Language Processing: a single-\n speaker audio corpus with transcriptions}},\nmonth = sep,\nyear = 2021,\npublisher = {Zenodo},\nversion = {1.0},\ndoi = {10.5281/zenodo.5521112},\nurl = {https://doi.org/10.5281/zenodo.5521112}\n }\n"}, "homepage": "https://pangloss.cnrs.fr/", "license": "https://creativecommons.org/licenses/by-nc-sa/4.0/fr/legalcode", "features": {"path": {"dtype": "string", "id": null, "_type": "Value"}, "audio": {"sampling_rate": 16000, "mono": true, "decode": true, "id": null, "_type": "Audio"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "doctype": {"dtype": "string", "id": null, "_type": "Value"}, "translation:fr": {"dtype": "string", "id": null, "_type": "Value"}, "translation:en": {"dtype": "string", "id": null, "_type": "Value"}, "translation:zh": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "automatic-speech-recognition", "audio_column": "audio", "transcription_column": "forme"}], "builder_name": "pangloss", "config_name": "yong1288", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4389525, "num_examples": 8630, "dataset_name": "pangloss"}, "test": {"name": "test", "num_bytes": 546007, "num_examples": 1078, "dataset_name": "pangloss"}, "validation": {"name": "validation", "num_bytes": 554964, "num_examples": 1079, "dataset_name": "pangloss"}}, "download_checksums": {"https://mycore.core-cloud.net/index.php/s/RxOb4ai7GU4x1mQ/download": {"num_bytes": 687061550, "checksum": "9ba0fb6c4e1d96794f97cc9a50178383e93ea7546d3725d0f6e5215f7d1044a5"}}, "download_size": 687061550, "post_processing_size": null, "dataset_size": 5490496, "size_in_bytes": 692552046}, "japh1234": {"description": "These datasets are extracts from the Pangloss collection and have\nbeen preprocessed for ASR experiments in Na and Japhug.\n", "citation": {"yong1288": "\n@misc{michaud_alexis_2021_5336698,\nauthor = {Michaud, Alexis and\n Galliot, Benjamin and\n Guillaume, S\u00e9verine},\ntitle = {{Yongning Na for Natural Language Processing: a\n single-speaker audio corpus with transcriptions}},\nmonth = aug,\nyear = 2021,\npublisher = {Zenodo},\nversion = {1.0},\ndoi = {10.5281/zenodo.5336698},\nurl = {https://doi.org/10.5281/zenodo.5336698}\n }\n ", "japh1234": "@misc{jacques_guillaume_2021_5521112,\nauthor = {Jacques, Guillaume and\n Galliot, Benjamin and\n Guillaume, S\u00e9verine},\ntitle = {{Japhug for Natural Language Processing: a single-\n speaker audio corpus with transcriptions}},\nmonth = sep,\nyear = 2021,\npublisher = {Zenodo},\nversion = {1.0},\ndoi = {10.5281/zenodo.5521112},\nurl = {https://doi.org/10.5281/zenodo.5521112}\n }\n"}, "homepage": "https://pangloss.cnrs.fr/", "license": "https://creativecommons.org/licenses/by-nc-sa/4.0/fr/legalcode", "features": {"path": {"dtype": "string", "id": null, "_type": "Value"}, "audio": {"sampling_rate": 16000, "mono": true, "decode": true, "id": null, "_type": "Audio"}, "sentence": {"dtype": "string", "id": null, "_type": "Value"}, "doctype": {"dtype": "string", "id": null, "_type": "Value"}, "translation:fr": {"dtype": "string", "id": null, "_type": "Value"}, "translation:zh": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "automatic-speech-recognition", "audio_column": "audio", "transcription_column": "forme"}], "builder_name": "pangloss", "config_name": "japh1234", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 9609761, "num_examples": 28658, "dataset_name": "pangloss"}, "test": {"name": "test", "num_bytes": 1202275, "num_examples": 3582, "dataset_name": "pangloss"}, "validation": {"name": "validation", "num_bytes": 1204416, "num_examples": 3582, "dataset_name": "pangloss"}}, "download_checksums": {"https://mycore.core-cloud.net/index.php/s/t2GUowRlPWJA8ga/download": {"num_bytes": 3039053553, "checksum": "bcbc06e787c81433dd60dad4a1b6e247f835905f0b96bf3476a19fcb3874a884"}}, "download_size": 3039053553, "post_processing_size": null, "dataset_size": 12016452, "size_in_bytes": 3051070005}}
|
dummy/japh1234/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:423e32e561006f062e3f17a89e7b5a4df1bd3a7f43960b14aaa2f7fd39a6b8b2
|
3 |
+
size 3180
|
dummy/yong1288/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f146def46d89da200ad3951fec8815a9f603b916b29adb73f0c7764c656e2cab
|
3 |
+
size 3108
|
pangloss.py
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
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 |
+
"""Pangloss datasets for Yongning Na (yong1288) and Japhug (japh1234)"""
|
15 |
+
|
16 |
+
import csv
|
17 |
+
import json
|
18 |
+
import os
|
19 |
+
import datasets
|
20 |
+
from datasets.tasks import AutomaticSpeechRecognition
|
21 |
+
|
22 |
+
_CITATION = {
|
23 |
+
"yong1288": """
|
24 |
+
@misc{michaud_alexis_2021_5336698,
|
25 |
+
author = {Michaud, Alexis and
|
26 |
+
Galliot, Benjamin and
|
27 |
+
Guillaume, Séverine},
|
28 |
+
title = {{Yongning Na for Natural Language Processing: a
|
29 |
+
single-speaker audio corpus with transcriptions}},
|
30 |
+
month = aug,
|
31 |
+
year = 2021,
|
32 |
+
publisher = {Zenodo},
|
33 |
+
version = {1.0},
|
34 |
+
doi = {10.5281/zenodo.5336698},
|
35 |
+
url = {https://doi.org/10.5281/zenodo.5336698}
|
36 |
+
}
|
37 |
+
""",
|
38 |
+
"japh1234": """\
|
39 |
+
@misc{jacques_guillaume_2021_5521112,
|
40 |
+
author = {Jacques, Guillaume and
|
41 |
+
Galliot, Benjamin and
|
42 |
+
Guillaume, Séverine},
|
43 |
+
title = {{Japhug for Natural Language Processing: a single-
|
44 |
+
speaker audio corpus with transcriptions}},
|
45 |
+
month = sep,
|
46 |
+
year = 2021,
|
47 |
+
publisher = {Zenodo},
|
48 |
+
version = {1.0},
|
49 |
+
doi = {10.5281/zenodo.5521112},
|
50 |
+
url = {https://doi.org/10.5281/zenodo.5521112}
|
51 |
+
}
|
52 |
+
"""
|
53 |
+
}
|
54 |
+
|
55 |
+
_DESCRIPTION = """\
|
56 |
+
These datasets are extracts from the Pangloss collection and have
|
57 |
+
been preprocessed for ASR experiments in Na and Japhug.
|
58 |
+
"""
|
59 |
+
|
60 |
+
_HOMEPAGE = "https://pangloss.cnrs.fr/"
|
61 |
+
|
62 |
+
_LICENSE = "https://creativecommons.org/licenses/by-nc-sa/4.0/fr/legalcode"
|
63 |
+
|
64 |
+
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
65 |
+
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
66 |
+
|
67 |
+
_VERSION = datasets.Version("1.0.0")
|
68 |
+
|
69 |
+
_LANGUAGES = {
|
70 |
+
"yong1288": {
|
71 |
+
"url": "https://mycore.core-cloud.net/index.php/s/RxOb4ai7GU4x1mQ/download",
|
72 |
+
"homepage": "https://zenodo.org/record/5336698",
|
73 |
+
"description": "Yongning Na dataset",
|
74 |
+
"translations": ["fr", "en", "zh"]
|
75 |
+
},
|
76 |
+
"japh1234": {
|
77 |
+
"url": "https://mycore.core-cloud.net/index.php/s/t2GUowRlPWJA8ga/download",
|
78 |
+
"homepage": "https://zenodo.org/record/5521112",
|
79 |
+
"description": "Japhug dataset",
|
80 |
+
"translations": ["fr", "zh"]
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
85 |
+
class PanglossDataset(datasets.GeneratorBasedBuilder):
|
86 |
+
"""The Pangloss datasets are extracts from Pangloss Collections that can be used for ASR experiments in these languages."""
|
87 |
+
field_translations = {
|
88 |
+
"chemin_audio": "path",
|
89 |
+
"nature": "doctype",
|
90 |
+
"forme": "sentence",
|
91 |
+
"traduction:fr": "translation:fr",
|
92 |
+
"traduction:en": "translation:en",
|
93 |
+
"traduction:zh": "translation:zh"
|
94 |
+
}
|
95 |
+
|
96 |
+
language_codes = {
|
97 |
+
"yong1288": "na",
|
98 |
+
"japh1234": "japhug"
|
99 |
+
}
|
100 |
+
|
101 |
+
# This is an example of a dataset with multiple configurations.
|
102 |
+
# If you don't want/need to define several sub-sets in your dataset,
|
103 |
+
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
104 |
+
|
105 |
+
# If you need to make complex sub-parts in the datasets with configurable options
|
106 |
+
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
107 |
+
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
108 |
+
|
109 |
+
# You will be able to load one or the other configurations in the following list with
|
110 |
+
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
111 |
+
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
112 |
+
BUILDER_CONFIGS = [
|
113 |
+
datasets.BuilderConfig(name=language_name, version=_VERSION, description=language_data["description"])
|
114 |
+
for language_name, language_data in _LANGUAGES.items()
|
115 |
+
]
|
116 |
+
|
117 |
+
#DEFAULT_CONFIG_NAME = "na" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
118 |
+
|
119 |
+
def _info(self):
|
120 |
+
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
121 |
+
features = datasets.Features(
|
122 |
+
{
|
123 |
+
"path": datasets.Value("string"),
|
124 |
+
"audio": datasets.features.Audio(sampling_rate=16_000),
|
125 |
+
"sentence": datasets.Value("string"),
|
126 |
+
"doctype": datasets.Value("string"),
|
127 |
+
**{f"translation:{language_code}": datasets.Value("string") for language_code in _LANGUAGES[self.config.name]["translations"]}
|
128 |
+
}
|
129 |
+
)
|
130 |
+
|
131 |
+
return datasets.DatasetInfo(
|
132 |
+
# This is the description that will appear on the datasets page.
|
133 |
+
description=_DESCRIPTION,
|
134 |
+
# This defines the different columns of the dataset and their types
|
135 |
+
features=features, # Here we define them above because they are different between the two configurations
|
136 |
+
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
137 |
+
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
138 |
+
# supervised_keys=("sentence", "label"),
|
139 |
+
# Homepage of the dataset for documentation
|
140 |
+
homepage=_HOMEPAGE,
|
141 |
+
# License for the dataset if available
|
142 |
+
license=_LICENSE,
|
143 |
+
# Citation for the dataset
|
144 |
+
citation=_CITATION,
|
145 |
+
task_templates=[AutomaticSpeechRecognition(audio_column="audio", transcription_column="forme")],
|
146 |
+
|
147 |
+
)
|
148 |
+
|
149 |
+
def _split_generators(self, dl_manager):
|
150 |
+
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
151 |
+
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
152 |
+
|
153 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
154 |
+
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
155 |
+
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
156 |
+
urls = _LANGUAGES[self.config.name]["url"]
|
157 |
+
data_dir = dl_manager.download_and_extract(urls)
|
158 |
+
return [
|
159 |
+
datasets.SplitGenerator(
|
160 |
+
name=datasets.Split.TRAIN,
|
161 |
+
# These kwargs will be passed to _generate_examples
|
162 |
+
gen_kwargs={
|
163 |
+
"filepath": os.path.join(data_dir, self.language_codes[self.config.name], "train.csv"),
|
164 |
+
"split": "train"
|
165 |
+
},
|
166 |
+
),
|
167 |
+
datasets.SplitGenerator(
|
168 |
+
name=datasets.Split.TEST,
|
169 |
+
# These kwargs will be passed to _generate_examples
|
170 |
+
gen_kwargs={
|
171 |
+
"filepath": os.path.join(data_dir, self.language_codes[self.config.name], "test.csv"),
|
172 |
+
"split": "test"
|
173 |
+
},
|
174 |
+
),
|
175 |
+
datasets.SplitGenerator(
|
176 |
+
name=datasets.Split.VALIDATION,
|
177 |
+
# These kwargs will be passed to _generate_examples
|
178 |
+
gen_kwargs={
|
179 |
+
"filepath": os.path.join(data_dir, self.language_codes[self.config.name], "validation.csv"),
|
180 |
+
"split": "validation"
|
181 |
+
},
|
182 |
+
),
|
183 |
+
]
|
184 |
+
|
185 |
+
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
186 |
+
def _generate_examples(self, filepath, split):
|
187 |
+
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
188 |
+
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
189 |
+
with open(filepath, encoding="utf-8") as file_descriptor:
|
190 |
+
reader = csv.DictReader(file_descriptor)
|
191 |
+
for key, row in enumerate(reader):
|
192 |
+
translated_fieldnames = [self.field_translations[fieldname] for fieldname in reader.fieldnames]
|
193 |
+
data = dict(zip(translated_fieldnames, row.values()))
|
194 |
+
data["audio"] = os.path.join(os.path.dirname(filepath), data["path"])
|
195 |
+
# Yields examples as (key, example) tuples
|
196 |
+
yield key, data
|
197 |
+
|
198 |
+
|
199 |
+
# if __name__ == "__main__":
|
200 |
+
# for language in _LANGUAGES.keys():
|
201 |
+
# datasets.load_dataset("pangloss.py", language)
|
202 |
+
|
203 |
+
# datasets-cli test datasets/pangloss --save_infos --all_configs
|
204 |
+
# datasets-cli dummy_data datasets/pangloss --auto_generate
|
205 |
+
|