holylovenia commited on
Commit
695b700
·
verified ·
1 Parent(s): c3d1093

Upload id_wiki_parallel.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. id_wiki_parallel.py +12 -12
id_wiki_parallel.py CHANGED
@@ -19,9 +19,9 @@ from typing import Dict, List, Tuple
19
  import datasets
20
  import pandas as pd
21
 
22
- from nusacrowd.utils import schemas
23
- from nusacrowd.utils.configs import NusantaraConfig
24
- from nusacrowd.utils.constants import DEFAULT_NUSANTARA_VIEW_NAME, DEFAULT_SOURCE_VIEW_NAME, Tasks
25
 
26
  _CITATION = """\
27
  @INPROCEEDINGS{
@@ -38,7 +38,7 @@ doi={10.1109/ICACSIS.2014.7065828}}
38
 
39
  _DATASETNAME = "id_wiki_parallel"
40
  _SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
41
- _UNIFIED_VIEW_NAME = DEFAULT_NUSANTARA_VIEW_NAME
42
 
43
  _LANGUAGES = ["ind", "jav", "min", "sun"]
44
  _LOCAL = False
@@ -72,7 +72,7 @@ _URLS = {
72
  _SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
73
 
74
  _SOURCE_VERSION = "1.0.0"
75
- _NUSANTARA_VERSION = "1.0.0"
76
 
77
 
78
  class IdWikiParallel(datasets.GeneratorBasedBuilder):
@@ -82,7 +82,7 @@ class IdWikiParallel(datasets.GeneratorBasedBuilder):
82
 
83
  ETHNIC_LANGUAGES = [lang for lang in _LANGUAGES if lang != "ind"]
84
  BUILDER_CONFIGS = [
85
- NusantaraConfig(
86
  name="{dataset_name}_{src}_ind_source".format(dataset_name=_DATASETNAME, src=src),
87
  version=datasets.Version(_SOURCE_VERSION),
88
  description="ID Wiki Parallel source schema for {src} to ind and ind to {src}".format(src=src),
@@ -91,11 +91,11 @@ class IdWikiParallel(datasets.GeneratorBasedBuilder):
91
  )
92
  for src in ETHNIC_LANGUAGES
93
  ] + [
94
- NusantaraConfig(
95
- name="{dataset_name}_{src}_ind_nusantara_t2t".format(dataset_name=_DATASETNAME, src=src),
96
- version=datasets.Version(_NUSANTARA_VERSION),
97
  description="ID Wiki Parallel Nusantara schema for {src} to ind and ind to {src}".format(src=src),
98
- schema="nusantara_t2t",
99
  subset_id="{dataset_name}_{src}_ind".format(dataset_name=_DATASETNAME, src=src),
100
  )
101
  for src in ETHNIC_LANGUAGES
@@ -106,7 +106,7 @@ class IdWikiParallel(datasets.GeneratorBasedBuilder):
106
  def _info(self) -> datasets.DatasetInfo:
107
  if self.config.schema == "source":
108
  features = datasets.Features({"id": datasets.Value("string"), "text_1": datasets.Value("string"), "text_2": datasets.Value("string")})
109
- elif self.config.schema == "nusantara_t2t":
110
  features = schemas.text2text_features
111
 
112
  return datasets.DatasetInfo(
@@ -143,5 +143,5 @@ class IdWikiParallel(datasets.GeneratorBasedBuilder):
143
  tgt_txt = row[2]
144
  if self.config.schema == "source":
145
  yield id, {"id": str(id), "text_1": src_txt, "text_2": tgt_txt}
146
- elif self.config.schema == "nusantara_t2t":
147
  yield id, {"id": str(id), "text_1": src_txt, "text_2": tgt_txt, "text_1_name": src, "text_2_name": "ind"}
 
19
  import datasets
20
  import pandas as pd
21
 
22
+ from seacrowd.utils import schemas
23
+ from seacrowd.utils.configs import SEACrowdConfig
24
+ from seacrowd.utils.constants import DEFAULT_SEACROWD_VIEW_NAME, DEFAULT_SOURCE_VIEW_NAME, Tasks
25
 
26
  _CITATION = """\
27
  @INPROCEEDINGS{
 
38
 
39
  _DATASETNAME = "id_wiki_parallel"
40
  _SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
41
+ _UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
42
 
43
  _LANGUAGES = ["ind", "jav", "min", "sun"]
44
  _LOCAL = False
 
72
  _SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
73
 
74
  _SOURCE_VERSION = "1.0.0"
75
+ _SEACROWD_VERSION = "2024.06.20"
76
 
77
 
78
  class IdWikiParallel(datasets.GeneratorBasedBuilder):
 
82
 
83
  ETHNIC_LANGUAGES = [lang for lang in _LANGUAGES if lang != "ind"]
84
  BUILDER_CONFIGS = [
85
+ SEACrowdConfig(
86
  name="{dataset_name}_{src}_ind_source".format(dataset_name=_DATASETNAME, src=src),
87
  version=datasets.Version(_SOURCE_VERSION),
88
  description="ID Wiki Parallel source schema for {src} to ind and ind to {src}".format(src=src),
 
91
  )
92
  for src in ETHNIC_LANGUAGES
93
  ] + [
94
+ SEACrowdConfig(
95
+ name="{dataset_name}_{src}_ind_seacrowd_t2t".format(dataset_name=_DATASETNAME, src=src),
96
+ version=datasets.Version(_SEACROWD_VERSION),
97
  description="ID Wiki Parallel Nusantara schema for {src} to ind and ind to {src}".format(src=src),
98
+ schema="seacrowd_t2t",
99
  subset_id="{dataset_name}_{src}_ind".format(dataset_name=_DATASETNAME, src=src),
100
  )
101
  for src in ETHNIC_LANGUAGES
 
106
  def _info(self) -> datasets.DatasetInfo:
107
  if self.config.schema == "source":
108
  features = datasets.Features({"id": datasets.Value("string"), "text_1": datasets.Value("string"), "text_2": datasets.Value("string")})
109
+ elif self.config.schema == "seacrowd_t2t":
110
  features = schemas.text2text_features
111
 
112
  return datasets.DatasetInfo(
 
143
  tgt_txt = row[2]
144
  if self.config.schema == "source":
145
  yield id, {"id": str(id), "text_1": src_txt, "text_2": tgt_txt}
146
+ elif self.config.schema == "seacrowd_t2t":
147
  yield id, {"id": str(id), "text_1": src_txt, "text_2": tgt_txt, "text_1_name": src, "text_2_name": "ind"}