holylovenia commited on
Commit
ab4a840
1 Parent(s): e285530

Upload news_en_id.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. news_en_id.py +12 -12
news_en_id.py CHANGED
@@ -4,13 +4,13 @@ from typing import List
4
  import datasets
5
  import json
6
 
7
- from nusacrowd.utils import schemas
8
- from nusacrowd.utils.configs import NusantaraConfig
9
- from nusacrowd.utils.constants import Tasks, DEFAULT_SOURCE_VIEW_NAME, DEFAULT_NUSANTARA_VIEW_NAME
10
 
11
  _DATASETNAME = "news_en_id"
12
  _SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
13
- _UNIFIED_VIEW_NAME = DEFAULT_NUSANTARA_VIEW_NAME
14
 
15
  _LANGUAGES = ["ind", "eng"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
16
  _LOCAL = False
@@ -45,25 +45,25 @@ _URLs = {"indonlg": "https://storage.googleapis.com/babert-pretraining/IndoNLG_f
45
  _SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
46
 
47
  _SOURCE_VERSION = "1.0.0"
48
- _NUSANTARA_VERSION = "1.0.0"
49
 
50
 
51
  class NewsEnId(datasets.GeneratorBasedBuilder):
52
  """Bible Su-Id is a machine translation dataset containing Indonesian-Sundanese parallel sentences collected from the bible.."""
53
 
54
  BUILDER_CONFIGS = [
55
- NusantaraConfig(
56
  name="news_en_id_source",
57
  version=datasets.Version(_SOURCE_VERSION),
58
  description="News En-Id source schema",
59
  schema="source",
60
  subset_id="news_en_id",
61
  ),
62
- NusantaraConfig(
63
- name="news_en_id_nusantara_t2t",
64
- version=datasets.Version(_NUSANTARA_VERSION),
65
  description="News En-Id Nusantara schema",
66
- schema="nusantara_t2t",
67
  subset_id="news_en_id",
68
  ),
69
  ]
@@ -73,7 +73,7 @@ class NewsEnId(datasets.GeneratorBasedBuilder):
73
  def _info(self):
74
  if self.config.schema == "source":
75
  features = datasets.Features({"id": datasets.Value("string"), "text": datasets.Value("string"), "label": datasets.Value("string")})
76
- elif self.config.schema == "nusantara_t2t":
77
  features = schemas.text2text_features
78
 
79
  return datasets.DatasetInfo(
@@ -113,7 +113,7 @@ class NewsEnId(datasets.GeneratorBasedBuilder):
113
  for row in data:
114
  ex = {"id": row["id"], "text": row["text"], "label": row["label"]}
115
  yield row["id"], ex
116
- elif self.config.schema == "nusantara_t2t":
117
  for row in data:
118
  ex = {
119
  "id": row["id"],
 
4
  import datasets
5
  import json
6
 
7
+ from seacrowd.utils import schemas
8
+ from seacrowd.utils.configs import SEACrowdConfig
9
+ from seacrowd.utils.constants import Tasks, DEFAULT_SOURCE_VIEW_NAME, DEFAULT_SEACROWD_VIEW_NAME
10
 
11
  _DATASETNAME = "news_en_id"
12
  _SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
13
+ _UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
14
 
15
  _LANGUAGES = ["ind", "eng"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
16
  _LOCAL = False
 
45
  _SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
46
 
47
  _SOURCE_VERSION = "1.0.0"
48
+ _SEACROWD_VERSION = "2024.06.20"
49
 
50
 
51
  class NewsEnId(datasets.GeneratorBasedBuilder):
52
  """Bible Su-Id is a machine translation dataset containing Indonesian-Sundanese parallel sentences collected from the bible.."""
53
 
54
  BUILDER_CONFIGS = [
55
+ SEACrowdConfig(
56
  name="news_en_id_source",
57
  version=datasets.Version(_SOURCE_VERSION),
58
  description="News En-Id source schema",
59
  schema="source",
60
  subset_id="news_en_id",
61
  ),
62
+ SEACrowdConfig(
63
+ name="news_en_id_seacrowd_t2t",
64
+ version=datasets.Version(_SEACROWD_VERSION),
65
  description="News En-Id Nusantara schema",
66
+ schema="seacrowd_t2t",
67
  subset_id="news_en_id",
68
  ),
69
  ]
 
73
  def _info(self):
74
  if self.config.schema == "source":
75
  features = datasets.Features({"id": datasets.Value("string"), "text": datasets.Value("string"), "label": datasets.Value("string")})
76
+ elif self.config.schema == "seacrowd_t2t":
77
  features = schemas.text2text_features
78
 
79
  return datasets.DatasetInfo(
 
113
  for row in data:
114
  ex = {"id": row["id"], "text": row["text"], "label": row["label"]}
115
  yield row["id"], ex
116
+ elif self.config.schema == "seacrowd_t2t":
117
  for row in data:
118
  ex = {
119
  "id": row["id"],