Upload 4 files
Browse files- README.md +9 -0
- __init__.py +0 -0
- asr_sundanese_4_pbl.py +152 -0
- requirements.txt +1 -0
README.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- sun
|
4 |
+
pretty_name: Su Id Asr
|
5 |
+
task_categories:
|
6 |
+
- speech-recognition
|
7 |
+
tags:
|
8 |
+
- speech-recognition
|
9 |
+
---
|
__init__.py
ADDED
File without changes
|
asr_sundanese_4_pbl.py
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import csv
|
2 |
+
import os
|
3 |
+
from typing import Dict, List
|
4 |
+
|
5 |
+
import datasets
|
6 |
+
|
7 |
+
from seacrowd.utils import schemas
|
8 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
9 |
+
from seacrowd.utils.constants import (DEFAULT_SEACROWD_VIEW_NAME,
|
10 |
+
DEFAULT_SOURCE_VIEW_NAME, Tasks)
|
11 |
+
|
12 |
+
_DATASETNAME = "su_id_asr"
|
13 |
+
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
14 |
+
_UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
|
15 |
+
|
16 |
+
_LANGUAGES = ["sun"]
|
17 |
+
_LOCAL = False
|
18 |
+
_CITATION = """\
|
19 |
+
@inproceedings{sodimana18_sltu,
|
20 |
+
author={Keshan Sodimana and Pasindu {De Silva} and Supheakmungkol Sarin and Oddur Kjartansson and Martin Jansche and Knot Pipatsrisawat and Linne Ha},
|
21 |
+
title={{A Step-by-Step Process for Building TTS Voices Using Open Source Data and Frameworks for Bangla, Javanese, Khmer, Nepali, Sinhala, and Sundanese}},
|
22 |
+
year=2018,
|
23 |
+
booktitle={Proc. 6th Workshop on Spoken Language Technologies for Under-Resourced Languages (SLTU 2018)},
|
24 |
+
pages={66--70},
|
25 |
+
doi={10.21437/SLTU.2018-14}
|
26 |
+
}
|
27 |
+
"""
|
28 |
+
|
29 |
+
_DESCRIPTION = """\
|
30 |
+
Sundanese ASR training data set containing ~220K utterances.
|
31 |
+
This dataset was collected by Google in Indonesia.
|
32 |
+
|
33 |
+
|
34 |
+
"""
|
35 |
+
|
36 |
+
_HOMEPAGE = "https://indonlp.github.io/nusa-catalogue/card.html?su_id_asr"
|
37 |
+
|
38 |
+
_LICENSE = "Attribution-ShareAlike 4.0 International."
|
39 |
+
|
40 |
+
_URLs = {
|
41 |
+
"su_id_asr_train": "https://univindonesia-my.sharepoint.com/:u:/g/personal/raditya_aditama_office_ui_ac_id/EYWcDjCaympMhkU06LUpZiUBePQfzwXuj7dkQXvKbO6fwA?e=rPTjS5&download=1",
|
42 |
+
"su_id_asr_dev": "https://univindonesia-my.sharepoint.com/:u:/g/personal/raditya_aditama_office_ui_ac_id/EeyuO-hrrmdJtru6BK9FX-EBbFFGxziZSmZrqG3cr9bvJA?e=EcpFAz&download=1",
|
43 |
+
"su_id_asr_test": "https://univindonesia-my.sharepoint.com/:u:/g/personal/raditya_aditama_office_ui_ac_id/Ea2HSFeafYFLtAH3Z6cLt9kBp6l-IkcRonRaV5b9yvjE6g?e=IhaOiv&download=1",
|
44 |
+
}
|
45 |
+
|
46 |
+
_SUPPORTED_TASKS = [Tasks.SPEECH_RECOGNITION]
|
47 |
+
|
48 |
+
_SOURCE_VERSION = "1.0.0"
|
49 |
+
_SEACROWD_VERSION = "2024.06.20"
|
50 |
+
|
51 |
+
|
52 |
+
class SuIdASR(datasets.GeneratorBasedBuilder):
|
53 |
+
"""su_id contains ~220K utterances for Sundanese ASR training data."""
|
54 |
+
|
55 |
+
BUILDER_CONFIGS = [
|
56 |
+
SEACrowdConfig(
|
57 |
+
name="su_id_asr_source",
|
58 |
+
version=datasets.Version(_SOURCE_VERSION),
|
59 |
+
description="SU_ID_ASR source schema",
|
60 |
+
schema="source",
|
61 |
+
subset_id="su_id_asr",
|
62 |
+
),
|
63 |
+
SEACrowdConfig(
|
64 |
+
name="su_id_asr_seacrowd_sptext",
|
65 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
66 |
+
description="SU_ID_ASR Nusantara schema",
|
67 |
+
schema="seacrowd_sptext",
|
68 |
+
subset_id="su_id_asr",
|
69 |
+
),
|
70 |
+
]
|
71 |
+
|
72 |
+
DEFAULT_CONFIG_NAME = "su_id_asr_source"
|
73 |
+
|
74 |
+
def _info(self):
|
75 |
+
if self.config.schema == "source":
|
76 |
+
features = datasets.Features(
|
77 |
+
{
|
78 |
+
"id": datasets.Value("string"),
|
79 |
+
"speaker_id": datasets.Value("string"),
|
80 |
+
"path": datasets.Value("string"),
|
81 |
+
"audio": datasets.Audio(sampling_rate=16_000),
|
82 |
+
"text": datasets.Value("string"),
|
83 |
+
}
|
84 |
+
)
|
85 |
+
elif self.config.schema == "seacrowd_sptext":
|
86 |
+
features = schemas.speech_text_features
|
87 |
+
|
88 |
+
return datasets.DatasetInfo(
|
89 |
+
description=_DESCRIPTION,
|
90 |
+
features=features,
|
91 |
+
homepage=_HOMEPAGE,
|
92 |
+
license=_LICENSE,
|
93 |
+
citation=_CITATION,
|
94 |
+
task_templates=[datasets.AutomaticSpeechRecognition(audio_column="audio", transcription_column="text")],
|
95 |
+
)
|
96 |
+
|
97 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
98 |
+
return [
|
99 |
+
datasets.SplitGenerator(
|
100 |
+
name=datasets.Split.TRAIN,
|
101 |
+
gen_kwargs={"filepath": dl_manager.download_and_extract(_URLs["su_id_asr_train"])},
|
102 |
+
),
|
103 |
+
datasets.SplitGenerator(
|
104 |
+
name=datasets.Split.VALIDATION,
|
105 |
+
gen_kwargs={"filepath": dl_manager.download_and_extract(_URLs["su_id_asr_dev"])},
|
106 |
+
),
|
107 |
+
datasets.SplitGenerator(
|
108 |
+
name=datasets.Split.TEST,
|
109 |
+
gen_kwargs={"filepath": dl_manager.download_and_extract(_URLs["su_id_asr_test"])},
|
110 |
+
)
|
111 |
+
]
|
112 |
+
|
113 |
+
def _generate_examples(self, filepath: str):
|
114 |
+
|
115 |
+
if self.config.schema == "source" or self.config.schema == "seacrowd_sptext":
|
116 |
+
|
117 |
+
tsv_file = os.path.join(filepath, "asr_sundanese", "utt_spk_text.tsv")
|
118 |
+
|
119 |
+
with open(tsv_file, "r") as file:
|
120 |
+
tsv_file = csv.reader(file, delimiter="\t")
|
121 |
+
|
122 |
+
for line in tsv_file:
|
123 |
+
audio_id, speaker_id, transcription_text = line[0], line[1], line[2]
|
124 |
+
|
125 |
+
wav_path = os.path.join(filepath, "asr_sundanese", "data", "{}".format(audio_id[:2]), "{}.flac".format(audio_id))
|
126 |
+
|
127 |
+
if os.path.exists(wav_path):
|
128 |
+
if self.config.schema == "source":
|
129 |
+
ex = {
|
130 |
+
"id": audio_id,
|
131 |
+
"speaker_id": speaker_id,
|
132 |
+
"path": wav_path,
|
133 |
+
"audio": wav_path,
|
134 |
+
"text": transcription_text,
|
135 |
+
}
|
136 |
+
yield audio_id, ex
|
137 |
+
elif self.config.schema == "seacrowd_sptext":
|
138 |
+
ex = {
|
139 |
+
"id": audio_id,
|
140 |
+
"speaker_id": speaker_id,
|
141 |
+
"path": wav_path,
|
142 |
+
"audio": wav_path,
|
143 |
+
"text": transcription_text,
|
144 |
+
"metadata": {
|
145 |
+
"speaker_age": None,
|
146 |
+
"speaker_gender": None,
|
147 |
+
},
|
148 |
+
}
|
149 |
+
yield audio_id, ex
|
150 |
+
|
151 |
+
else:
|
152 |
+
raise ValueError(f"Invalid config: {self.config.name}")
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
seacrowd>=0.2.0
|