holylovenia commited on
Commit
8cdd422
1 Parent(s): e30d0ee

Upload id_hoax_news.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. id_hoax_news.py +12 -12
id_hoax_news.py CHANGED
@@ -4,13 +4,13 @@ from typing import List
4
  import datasets
5
  import pandas as pd
6
 
7
- from nusacrowd.utils import schemas
8
- from nusacrowd.utils.configs import NusantaraConfig
9
- from nusacrowd.utils.constants import DEFAULT_NUSANTARA_VIEW_NAME, DEFAULT_SOURCE_VIEW_NAME, Tasks
10
 
11
  _DATASETNAME = "id_hoax_news"
12
  _SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
13
- _UNIFIED_VIEW_NAME = DEFAULT_NUSANTARA_VIEW_NAME
14
 
15
  _LANGUAGES = ["ind"] # We follow ISO639-3 langauge code (https://iso639-3.sil.org/code_tables/639/data)
16
  _LOCAL = False
@@ -34,24 +34,24 @@ _URLs = {
34
  _SUPPORTED_TASKS = [Tasks.HOAX_NEWS_CLASSIFICATION]
35
 
36
  _SOURCE_VERSION = "1.0.0"
37
- _NUSANTARA_VERSION = "1.0.0"
38
 
39
 
40
  class IdHoaxNews(datasets.GeneratorBasedBuilder):
41
 
42
  BUILDER_CONFIGS = [
43
- NusantaraConfig(
44
  name="id_hoax_news_source",
45
  version=datasets.Version(_SOURCE_VERSION),
46
  description="Hoax News source schema",
47
  schema="source",
48
  subset_id="id_hoax_news",
49
  ),
50
- NusantaraConfig(
51
- name="id_hoax_news_nusantara_text",
52
- version=datasets.Version(_NUSANTARA_VERSION),
53
  description="Hoax News Nusantara schema",
54
- schema="nusantara_text",
55
  subset_id="id_hoax_news",
56
  ),
57
  ]
@@ -67,7 +67,7 @@ class IdHoaxNews(datasets.GeneratorBasedBuilder):
67
  "label": datasets.Value("string"),
68
  }
69
  )
70
- elif self.config.schema == "nusantara_text":
71
  features = schemas.text_features(["Valid", "Hoax"])
72
 
73
  return datasets.DatasetInfo(
@@ -117,7 +117,7 @@ class IdHoaxNews(datasets.GeneratorBasedBuilder):
117
  for i in range(len(news)):
118
  ex = {"index": str(i), "news": news[i], "label": labels[i]}
119
  yield i, ex
120
- elif self.config.schema == "nusantara_text":
121
  for i in range(len(news)):
122
  ex = {"id": str(i), "text": news[i], "label": labels[i]}
123
  yield i, ex
 
4
  import datasets
5
  import pandas as pd
6
 
7
+ from seacrowd.utils import schemas
8
+ from seacrowd.utils.configs import SEACrowdConfig
9
+ from seacrowd.utils.constants import DEFAULT_SEACROWD_VIEW_NAME, DEFAULT_SOURCE_VIEW_NAME, Tasks
10
 
11
  _DATASETNAME = "id_hoax_news"
12
  _SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
13
+ _UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
14
 
15
  _LANGUAGES = ["ind"] # We follow ISO639-3 langauge code (https://iso639-3.sil.org/code_tables/639/data)
16
  _LOCAL = False
 
34
  _SUPPORTED_TASKS = [Tasks.HOAX_NEWS_CLASSIFICATION]
35
 
36
  _SOURCE_VERSION = "1.0.0"
37
+ _SEACROWD_VERSION = "2024.06.20"
38
 
39
 
40
  class IdHoaxNews(datasets.GeneratorBasedBuilder):
41
 
42
  BUILDER_CONFIGS = [
43
+ SEACrowdConfig(
44
  name="id_hoax_news_source",
45
  version=datasets.Version(_SOURCE_VERSION),
46
  description="Hoax News source schema",
47
  schema="source",
48
  subset_id="id_hoax_news",
49
  ),
50
+ SEACrowdConfig(
51
+ name="id_hoax_news_seacrowd_text",
52
+ version=datasets.Version(_SEACROWD_VERSION),
53
  description="Hoax News Nusantara schema",
54
+ schema="seacrowd_text",
55
  subset_id="id_hoax_news",
56
  ),
57
  ]
 
67
  "label": datasets.Value("string"),
68
  }
69
  )
70
+ elif self.config.schema == "seacrowd_text":
71
  features = schemas.text_features(["Valid", "Hoax"])
72
 
73
  return datasets.DatasetInfo(
 
117
  for i in range(len(news)):
118
  ex = {"index": str(i), "news": news[i], "label": labels[i]}
119
  yield i, ex
120
+ elif self.config.schema == "seacrowd_text":
121
  for i in range(len(news)):
122
  ex = {"id": str(i), "text": news[i], "label": labels[i]}
123
  yield i, ex