holylovenia commited on
Commit
7b0dc20
1 Parent(s): 0bec6f3

Upload ted_en_id.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. ted_en_id.py +12 -16
ted_en_id.py CHANGED
@@ -4,14 +4,14 @@ from typing import List
4
 
5
  import datasets
6
 
7
- from nusacrowd.utils import schemas
8
- from nusacrowd.utils.configs import NusantaraConfig
9
- from nusacrowd.utils.constants import (DEFAULT_NUSANTARA_VIEW_NAME,
10
  DEFAULT_SOURCE_VIEW_NAME, Tasks)
11
 
12
  _DATASETNAME = "ted_en_id"
13
  _SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
14
- _UNIFIED_VIEW_NAME = DEFAULT_NUSANTARA_VIEW_NAME
15
 
16
  _LANGUAGES = ["ind", "eng"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
17
  _LOCAL = False
@@ -63,25 +63,25 @@ _URLs = {"indonlg": "https://storage.googleapis.com/babert-pretraining/IndoNLG_f
63
  _SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
64
 
65
  _SOURCE_VERSION = "1.0.0"
66
- _NUSANTARA_VERSION = "1.0.0"
67
 
68
 
69
  class TEDEnId(datasets.GeneratorBasedBuilder):
70
  """TED En-Id is a machine translation dataset containing Indonesian-English parallel sentences collected from the TED talk transcripts."""
71
 
72
  BUILDER_CONFIGS = [
73
- NusantaraConfig(
74
  name="ted_en_id_source",
75
  version=datasets.Version(_SOURCE_VERSION),
76
  description="TED En-Id source schema",
77
  schema="source",
78
  subset_id="ted_en_id",
79
  ),
80
- NusantaraConfig(
81
- name="ted_en_id_nusantara_t2t",
82
- version=datasets.Version(_NUSANTARA_VERSION),
83
  description="TED En-Id Nusantara schema",
84
- schema="nusantara_t2t",
85
  subset_id="ted_en_id",
86
  ),
87
  ]
@@ -91,7 +91,7 @@ class TEDEnId(datasets.GeneratorBasedBuilder):
91
  def _info(self):
92
  if self.config.schema == "source":
93
  features = datasets.Features({"id": datasets.Value("string"), "text": datasets.Value("string"), "label": datasets.Value("string")})
94
- elif self.config.schema == "nusantara_t2t":
95
  features = schemas.text2text_features
96
 
97
  return datasets.DatasetInfo(
@@ -131,7 +131,7 @@ class TEDEnId(datasets.GeneratorBasedBuilder):
131
  for row in data:
132
  ex = {"id": row["id"], "text": row["text"], "label": row["label"]}
133
  yield row["id"], ex
134
- elif self.config.schema == "nusantara_t2t":
135
  for row in data:
136
  ex = {
137
  "id": row["id"],
@@ -143,7 +143,3 @@ class TEDEnId(datasets.GeneratorBasedBuilder):
143
  yield row["id"], ex
144
  else:
145
  raise ValueError(f"Invalid config: {self.config.name}")
146
-
147
-
148
- if __name__ == "__main__":
149
- datasets.load_dataset(__file__)
 
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 = "ted_en_id"
13
  _SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
14
+ _UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
15
 
16
  _LANGUAGES = ["ind", "eng"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
17
  _LOCAL = False
 
63
  _SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
64
 
65
  _SOURCE_VERSION = "1.0.0"
66
+ _SEACROWD_VERSION = "2024.06.20"
67
 
68
 
69
  class TEDEnId(datasets.GeneratorBasedBuilder):
70
  """TED En-Id is a machine translation dataset containing Indonesian-English parallel sentences collected from the TED talk transcripts."""
71
 
72
  BUILDER_CONFIGS = [
73
+ SEACrowdConfig(
74
  name="ted_en_id_source",
75
  version=datasets.Version(_SOURCE_VERSION),
76
  description="TED En-Id source schema",
77
  schema="source",
78
  subset_id="ted_en_id",
79
  ),
80
+ SEACrowdConfig(
81
+ name="ted_en_id_seacrowd_t2t",
82
+ version=datasets.Version(_SEACROWD_VERSION),
83
  description="TED En-Id Nusantara schema",
84
+ schema="seacrowd_t2t",
85
  subset_id="ted_en_id",
86
  ),
87
  ]
 
91
  def _info(self):
92
  if self.config.schema == "source":
93
  features = datasets.Features({"id": datasets.Value("string"), "text": datasets.Value("string"), "label": datasets.Value("string")})
94
+ elif self.config.schema == "seacrowd_t2t":
95
  features = schemas.text2text_features
96
 
97
  return datasets.DatasetInfo(
 
131
  for row in data:
132
  ex = {"id": row["id"], "text": row["text"], "label": row["label"]}
133
  yield row["id"], ex
134
+ elif self.config.schema == "seacrowd_t2t":
135
  for row in data:
136
  ex = {
137
  "id": row["id"],
 
143
  yield row["id"], ex
144
  else:
145
  raise ValueError(f"Invalid config: {self.config.name}")