Upload titml_idn.py with huggingface_hub
Browse files- titml_idn.py +14 -14
titml_idn.py
CHANGED
|
@@ -5,13 +5,13 @@ import datasets
|
|
| 5 |
import json
|
| 6 |
import os
|
| 7 |
|
| 8 |
-
from
|
| 9 |
-
from
|
| 10 |
-
from
|
| 11 |
|
| 12 |
_DATASETNAME = "titml_idn"
|
| 13 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
| 14 |
-
_UNIFIED_VIEW_NAME =
|
| 15 |
|
| 16 |
_LANGUAGES = ["ind"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
|
| 17 |
_LOCAL = False
|
|
@@ -31,32 +31,32 @@ TITML-IDN (Tokyo Institute of Technology Multilingual - Indonesian) is collected
|
|
| 31 |
|
| 32 |
_HOMEPAGE = "http://research.nii.ac.jp/src/en/TITML-IDN.html"
|
| 33 |
|
| 34 |
-
_LICENSE = "For research purposes only. If you use this corpus, you have to cite (Lestari et al, 2006)."
|
| 35 |
|
| 36 |
_URLs = {"titml-idn": "https://huggingface.co/datasets/holylovenia/TITML-IDN/resolve/main/IndoLVCSR.zip"}
|
| 37 |
|
| 38 |
_SUPPORTED_TASKS = [Tasks.SPEECH_RECOGNITION]
|
| 39 |
|
| 40 |
_SOURCE_VERSION = "1.0.0"
|
| 41 |
-
|
| 42 |
|
| 43 |
|
| 44 |
class TitmlIdn(datasets.GeneratorBasedBuilder):
|
| 45 |
"""TITML-IDN is a speech recognition dataset containing Indonesian speech collected with transcriptions from newpaper and magazine articles."""
|
| 46 |
|
| 47 |
BUILDER_CONFIGS = [
|
| 48 |
-
|
| 49 |
name="titml_idn_source",
|
| 50 |
version=datasets.Version(_SOURCE_VERSION),
|
| 51 |
description="TITML-IDN source schema",
|
| 52 |
schema="source",
|
| 53 |
subset_id="titml_idn",
|
| 54 |
),
|
| 55 |
-
|
| 56 |
-
name="
|
| 57 |
-
version=datasets.Version(
|
| 58 |
description="TITML-IDN Nusantara schema",
|
| 59 |
-
schema="
|
| 60 |
subset_id="titml_idn",
|
| 61 |
),
|
| 62 |
]
|
|
@@ -74,7 +74,7 @@ class TitmlIdn(datasets.GeneratorBasedBuilder):
|
|
| 74 |
"text": datasets.Value("string"),
|
| 75 |
}
|
| 76 |
)
|
| 77 |
-
elif self.config.schema == "
|
| 78 |
features = schemas.speech_text_features
|
| 79 |
|
| 80 |
return datasets.DatasetInfo(
|
|
@@ -98,7 +98,7 @@ class TitmlIdn(datasets.GeneratorBasedBuilder):
|
|
| 98 |
|
| 99 |
def _generate_examples(self, filepath: Path, n_speakers=20):
|
| 100 |
|
| 101 |
-
if self.config.schema == "source" or self.config.schema == "
|
| 102 |
|
| 103 |
for speaker_id in range(1, n_speakers + 1):
|
| 104 |
speaker_id = str(speaker_id).zfill(2)
|
|
@@ -121,7 +121,7 @@ class TitmlIdn(datasets.GeneratorBasedBuilder):
|
|
| 121 |
"text": text,
|
| 122 |
}
|
| 123 |
yield audio_id, ex
|
| 124 |
-
elif self.config.schema == "
|
| 125 |
ex = {
|
| 126 |
"id": audio_id,
|
| 127 |
"speaker_id": speaker_id,
|
|
|
|
| 5 |
import json
|
| 6 |
import os
|
| 7 |
|
| 8 |
+
from seacrowd.utils import schemas
|
| 9 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
| 10 |
+
from seacrowd.utils.constants import Licenses, Tasks, DEFAULT_SOURCE_VIEW_NAME, DEFAULT_SEACROWD_VIEW_NAME
|
| 11 |
|
| 12 |
_DATASETNAME = "titml_idn"
|
| 13 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
| 14 |
+
_UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
|
| 15 |
|
| 16 |
_LANGUAGES = ["ind"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
|
| 17 |
_LOCAL = False
|
|
|
|
| 31 |
|
| 32 |
_HOMEPAGE = "http://research.nii.ac.jp/src/en/TITML-IDN.html"
|
| 33 |
|
| 34 |
+
_LICENSE = Licenses.OTHERS.value + " | For research purposes only. If you use this corpus, you have to cite (Lestari et al, 2006)."
|
| 35 |
|
| 36 |
_URLs = {"titml-idn": "https://huggingface.co/datasets/holylovenia/TITML-IDN/resolve/main/IndoLVCSR.zip"}
|
| 37 |
|
| 38 |
_SUPPORTED_TASKS = [Tasks.SPEECH_RECOGNITION]
|
| 39 |
|
| 40 |
_SOURCE_VERSION = "1.0.0"
|
| 41 |
+
_SEACROWD_VERSION = "2024.06.20"
|
| 42 |
|
| 43 |
|
| 44 |
class TitmlIdn(datasets.GeneratorBasedBuilder):
|
| 45 |
"""TITML-IDN is a speech recognition dataset containing Indonesian speech collected with transcriptions from newpaper and magazine articles."""
|
| 46 |
|
| 47 |
BUILDER_CONFIGS = [
|
| 48 |
+
SEACrowdConfig(
|
| 49 |
name="titml_idn_source",
|
| 50 |
version=datasets.Version(_SOURCE_VERSION),
|
| 51 |
description="TITML-IDN source schema",
|
| 52 |
schema="source",
|
| 53 |
subset_id="titml_idn",
|
| 54 |
),
|
| 55 |
+
SEACrowdConfig(
|
| 56 |
+
name="titml_idn_seacrowd_sptext",
|
| 57 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
| 58 |
description="TITML-IDN Nusantara schema",
|
| 59 |
+
schema="seacrowd_sptext",
|
| 60 |
subset_id="titml_idn",
|
| 61 |
),
|
| 62 |
]
|
|
|
|
| 74 |
"text": datasets.Value("string"),
|
| 75 |
}
|
| 76 |
)
|
| 77 |
+
elif self.config.schema == "seacrowd_sptext":
|
| 78 |
features = schemas.speech_text_features
|
| 79 |
|
| 80 |
return datasets.DatasetInfo(
|
|
|
|
| 98 |
|
| 99 |
def _generate_examples(self, filepath: Path, n_speakers=20):
|
| 100 |
|
| 101 |
+
if self.config.schema == "source" or self.config.schema == "seacrowd_sptext":
|
| 102 |
|
| 103 |
for speaker_id in range(1, n_speakers + 1):
|
| 104 |
speaker_id = str(speaker_id).zfill(2)
|
|
|
|
| 121 |
"text": text,
|
| 122 |
}
|
| 123 |
yield audio_id, ex
|
| 124 |
+
elif self.config.schema == "seacrowd_sptext":
|
| 125 |
ex = {
|
| 126 |
"id": audio_id,
|
| 127 |
"speaker_id": speaker_id,
|