holylovenia commited on
Commit
0530837
1 Parent(s): 52577b6

Upload librivox_indonesia.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. librivox_indonesia.py +17 -17
librivox_indonesia.py CHANGED
@@ -19,9 +19,9 @@ from typing import Dict, List, Tuple
19
 
20
  import datasets
21
 
22
- from nusacrowd.utils import schemas
23
- from nusacrowd.utils.configs import NusantaraConfig
24
- from nusacrowd.utils.constants import Tasks, DEFAULT_SOURCE_VIEW_NAME, DEFAULT_NUSANTARA_VIEW_NAME
25
 
26
  import pandas as pd
27
 
@@ -68,7 +68,7 @@ _LOCAL = False
68
  _SUPPORTED_TASKS = [Tasks.SPEECH_RECOGNITION] # example: [Tasks.TRANSLATION, Tasks.NAMED_ENTITY_RECOGNITION, Tasks.RELATION_EXTRACTION]
69
 
70
  _SOURCE_VERSION = "1.0.0"
71
- _NUSANTARA_VERSION = "1.0.0"
72
 
73
 
74
  class LibrivoxIndonesia(datasets.GeneratorBasedBuilder):
@@ -78,35 +78,35 @@ class LibrivoxIndonesia(datasets.GeneratorBasedBuilder):
78
  """
79
 
80
  SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
81
- NUSANTARA_VERSION = datasets.Version(_NUSANTARA_VERSION)
82
 
83
  BUILDER_CONFIGS = [
84
- NusantaraConfig(
85
  name="librivox_indonesia_source",
86
  version=_SOURCE_VERSION,
87
  description="Librivox-Indonesia source schema for all languages",
88
  schema="source",
89
  subset_id="librivox_indonesia",
90
  )] + [
91
- NusantaraConfig(
92
  name="librivox_indonesia_{lang}_source".format(lang=lang),
93
  version=_SOURCE_VERSION,
94
  description="Librivox-Indonesia source schema for {lang} languages".format(lang=_LANG_CODE[lang][1]),
95
  schema="source",
96
  subset_id="librivox_indonesia_{lang}".format(lang=lang),
97
  ) for lang in _LANGUAGES] + [
98
- NusantaraConfig(
99
- name="librivox_indonesia_nusantara_sptext",
100
- version=_NUSANTARA_VERSION,
101
  description="Librivox-Indonesia Nusantara schema for all languages",
102
- schema="nusantara_sptext",
103
  subset_id="librivox_indonesia",
104
  )] + [
105
- NusantaraConfig(
106
- name="librivox_indonesia_{lang}_nusantara_sptext".format(lang=lang),
107
- version=_NUSANTARA_VERSION,
108
  description="Librivox-Indonesia Nusantara schema for {lang} languages".format(lang=_LANG_CODE[lang][1]),
109
- schema="nusantara_sptext",
110
  subset_id="librivox_indonesia_{lang}".format(lang=lang),
111
  )for lang in _LANGUAGES]
112
 
@@ -123,7 +123,7 @@ class LibrivoxIndonesia(datasets.GeneratorBasedBuilder):
123
  "audio": datasets.features.Audio(sampling_rate=44100)
124
  }
125
  )
126
- elif self.config.schema == "nusantara_sptext":
127
  features = schemas.speech_text_features
128
 
129
  return datasets.DatasetInfo(
@@ -198,7 +198,7 @@ class LibrivoxIndonesia(datasets.GeneratorBasedBuilder):
198
  "sentence": row["sentence"],
199
  "audio": path,
200
  }
201
- elif self.config.schema == "nusantara_sptext":
202
  yield row["id"], {
203
  "id": row["id"],
204
  "speaker_id": row["reader"],
 
19
 
20
  import datasets
21
 
22
+ from seacrowd.utils import schemas
23
+ from seacrowd.utils.configs import SEACrowdConfig
24
+ from seacrowd.utils.constants import Tasks, DEFAULT_SOURCE_VIEW_NAME, DEFAULT_SEACROWD_VIEW_NAME
25
 
26
  import pandas as pd
27
 
 
68
  _SUPPORTED_TASKS = [Tasks.SPEECH_RECOGNITION] # example: [Tasks.TRANSLATION, Tasks.NAMED_ENTITY_RECOGNITION, Tasks.RELATION_EXTRACTION]
69
 
70
  _SOURCE_VERSION = "1.0.0"
71
+ _SEACROWD_VERSION = "2024.06.20"
72
 
73
 
74
  class LibrivoxIndonesia(datasets.GeneratorBasedBuilder):
 
78
  """
79
 
80
  SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
81
+ SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
82
 
83
  BUILDER_CONFIGS = [
84
+ SEACrowdConfig(
85
  name="librivox_indonesia_source",
86
  version=_SOURCE_VERSION,
87
  description="Librivox-Indonesia source schema for all languages",
88
  schema="source",
89
  subset_id="librivox_indonesia",
90
  )] + [
91
+ SEACrowdConfig(
92
  name="librivox_indonesia_{lang}_source".format(lang=lang),
93
  version=_SOURCE_VERSION,
94
  description="Librivox-Indonesia source schema for {lang} languages".format(lang=_LANG_CODE[lang][1]),
95
  schema="source",
96
  subset_id="librivox_indonesia_{lang}".format(lang=lang),
97
  ) for lang in _LANGUAGES] + [
98
+ SEACrowdConfig(
99
+ name="librivox_indonesia_seacrowd_sptext",
100
+ version=_SEACROWD_VERSION,
101
  description="Librivox-Indonesia Nusantara schema for all languages",
102
+ schema="seacrowd_sptext",
103
  subset_id="librivox_indonesia",
104
  )] + [
105
+ SEACrowdConfig(
106
+ name="librivox_indonesia_{lang}_seacrowd_sptext".format(lang=lang),
107
+ version=_SEACROWD_VERSION,
108
  description="Librivox-Indonesia Nusantara schema for {lang} languages".format(lang=_LANG_CODE[lang][1]),
109
+ schema="seacrowd_sptext",
110
  subset_id="librivox_indonesia_{lang}".format(lang=lang),
111
  )for lang in _LANGUAGES]
112
 
 
123
  "audio": datasets.features.Audio(sampling_rate=44100)
124
  }
125
  )
126
+ elif self.config.schema == "seacrowd_sptext":
127
  features = schemas.speech_text_features
128
 
129
  return datasets.DatasetInfo(
 
198
  "sentence": row["sentence"],
199
  "audio": path,
200
  }
201
+ elif self.config.schema == "seacrowd_sptext":
202
  yield row["id"], {
203
  "id": row["id"],
204
  "speaker_id": row["reader"],