holylovenia commited on
Commit
85a549c
1 Parent(s): 22bd3ba

Upload indspeech_newstra_ethnicsr.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. indspeech_newstra_ethnicsr.py +12 -12
indspeech_newstra_ethnicsr.py CHANGED
@@ -21,9 +21,9 @@ from typing import Dict, List, Tuple
21
 
22
  import datasets
23
 
24
- from nusacrowd.utils import schemas
25
- from nusacrowd.utils.configs import NusantaraConfig
26
- from nusacrowd.utils.constants import Tasks
27
 
28
  _CITATION = """\
29
  @inproceedings{sakti-cocosda-2013,
@@ -84,17 +84,17 @@ _URLS = {
84
  _SUPPORTED_TASKS = [Tasks.SPEECH_RECOGNITION]
85
 
86
  _SOURCE_VERSION = "1.0.0"
87
- _NUSANTARA_VERSION = "1.0.0"
88
 
89
 
90
- def nusantara_config_constructor(lang, schema, version, overlap):
91
  if lang == "":
92
  raise ValueError(f"Invalid lang {lang}")
93
 
94
- if schema != "source" and schema != "nusantara_sptext":
95
  raise ValueError(f"Invalid schema: {schema}")
96
 
97
- return NusantaraConfig(
98
  name="indspeech_newstra_ethnicsr_{overlap}_{lang}_{schema}".format(lang=lang, schema=schema, overlap=overlap),
99
  version=datasets.Version(version),
100
  description="indspeech_newstra_ethnicsr {schema} schema for {lang} language with {overlap}ping dataset".format(lang=_lst_LANG[_lst_STD_LANG[lang]], schema=schema, overlap=overlap),
@@ -110,10 +110,10 @@ class INDspeechNEWSTRAEthnicSR(datasets.GeneratorBasedBuilder):
110
  The 'overlap' keyword in the dataset-name combines both sub-datasets, while 'nooverlap' will only use dataset 1
111
  """
112
  SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
113
- NUSANTARA_VERSION = datasets.Version(_NUSANTARA_VERSION)
114
 
115
- BUILDER_CONFIGS = [nusantara_config_constructor(lang, "source", _SOURCE_VERSION, overlap) for lang in _lst_STD_LANG for overlap in ["overlap","nooverlap"]] +\
116
- [nusantara_config_constructor(lang, "nusantara_sptext", _NUSANTARA_VERSION, overlap) for lang in _lst_STD_LANG for overlap in ["overlap","nooverlap"]]
117
 
118
  DEFAULT_CONFIG_NAME = "indspeech_newstra_ethnicsr_jav_source"
119
 
@@ -129,7 +129,7 @@ class INDspeechNEWSTRAEthnicSR(datasets.GeneratorBasedBuilder):
129
  "gender": datasets.Value("string"),
130
  }
131
  )
132
- elif self.config.schema == "nusantara_sptext":
133
  features = schemas.speech_text_features
134
 
135
  return datasets.DatasetInfo(
@@ -204,7 +204,7 @@ class INDspeechNEWSTRAEthnicSR(datasets.GeneratorBasedBuilder):
204
  }
205
  yield id, ex
206
 
207
- elif self.config.schema == "nusantara_sptext":
208
  ex = {
209
  "id": str(id),
210
  "speaker_id": str(Path(row).parent).split("/")[1],
 
21
 
22
  import datasets
23
 
24
+ from seacrowd.utils import schemas
25
+ from seacrowd.utils.configs import SEACrowdConfig
26
+ from seacrowd.utils.constants import Tasks
27
 
28
  _CITATION = """\
29
  @inproceedings{sakti-cocosda-2013,
 
84
  _SUPPORTED_TASKS = [Tasks.SPEECH_RECOGNITION]
85
 
86
  _SOURCE_VERSION = "1.0.0"
87
+ _SEACROWD_VERSION = "2024.06.20"
88
 
89
 
90
+ def seacrowd_config_constructor(lang, schema, version, overlap):
91
  if lang == "":
92
  raise ValueError(f"Invalid lang {lang}")
93
 
94
+ if schema != "source" and schema != "seacrowd_sptext":
95
  raise ValueError(f"Invalid schema: {schema}")
96
 
97
+ return SEACrowdConfig(
98
  name="indspeech_newstra_ethnicsr_{overlap}_{lang}_{schema}".format(lang=lang, schema=schema, overlap=overlap),
99
  version=datasets.Version(version),
100
  description="indspeech_newstra_ethnicsr {schema} schema for {lang} language with {overlap}ping dataset".format(lang=_lst_LANG[_lst_STD_LANG[lang]], schema=schema, overlap=overlap),
 
110
  The 'overlap' keyword in the dataset-name combines both sub-datasets, while 'nooverlap' will only use dataset 1
111
  """
112
  SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
113
+ SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
114
 
115
+ BUILDER_CONFIGS = [seacrowd_config_constructor(lang, "source", _SOURCE_VERSION, overlap) for lang in _lst_STD_LANG for overlap in ["overlap","nooverlap"]] +\
116
+ [seacrowd_config_constructor(lang, "seacrowd_sptext", _SEACROWD_VERSION, overlap) for lang in _lst_STD_LANG for overlap in ["overlap","nooverlap"]]
117
 
118
  DEFAULT_CONFIG_NAME = "indspeech_newstra_ethnicsr_jav_source"
119
 
 
129
  "gender": datasets.Value("string"),
130
  }
131
  )
132
+ elif self.config.schema == "seacrowd_sptext":
133
  features = schemas.speech_text_features
134
 
135
  return datasets.DatasetInfo(
 
204
  }
205
  yield id, ex
206
 
207
+ elif self.config.schema == "seacrowd_sptext":
208
  ex = {
209
  "id": str(id),
210
  "speaker_id": str(Path(row).parent).split("/")[1],