holylovenia commited on
Commit
2d6c79a
1 Parent(s): 2d75368

Upload id_clickbait.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. id_clickbait.py +12 -12
id_clickbait.py CHANGED
@@ -4,9 +4,9 @@ from typing import Dict, List, Tuple
4
 
5
  import datasets
6
 
7
- from nusacrowd.utils import schemas
8
- from nusacrowd.utils.configs import NusantaraConfig
9
- from nusacrowd.utils.constants import Tasks
10
 
11
  _CITATION = """\
12
  @article{WILLIAM2020106231,
@@ -42,28 +42,28 @@ _URLS = {
42
  }
43
  _SUPPORTED_TASKS = [Tasks.SENTIMENT_ANALYSIS]
44
  _SOURCE_VERSION = "1.0.0"
45
- _NUSANTARA_VERSION = "1.0.0"
46
 
47
 
48
  class IdClickbait(datasets.GeneratorBasedBuilder):
49
  """The CLICK-ID dataset is a collection of Indonesian news headlines that was collected from 12 local online news, annotated with a label whether each is a clickbait"""
50
 
51
  SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
52
- NUSANTARA_VERSION = datasets.Version(_NUSANTARA_VERSION)
53
 
54
  BUILDER_CONFIGS = [
55
- NusantaraConfig(
56
  name="id_clickbait_source",
57
  version=SOURCE_VERSION,
58
  description="CLICK-ID source schema",
59
  schema="source",
60
  subset_id="id_clickbait",
61
  ),
62
- NusantaraConfig(
63
- name="id_clickbait_nusantara_text",
64
- version=NUSANTARA_VERSION,
65
  description="CLICK-ID Nusantara schema",
66
- schema="nusantara_text",
67
  subset_id="id_clickbait",
68
  ),
69
  ]
@@ -73,7 +73,7 @@ class IdClickbait(datasets.GeneratorBasedBuilder):
73
  def _info(self) -> datasets.DatasetInfo:
74
  if self.config.schema == "source":
75
  features = datasets.Features({"title": datasets.Value("string"), "label": datasets.Value("string"), "label_score": datasets.Value("int8")})
76
- elif self.config.schema == "nusantara_text":
77
  features = schemas.text_features(["non-clickbait", "clickbait"])
78
 
79
  return datasets.DatasetInfo(
@@ -115,7 +115,7 @@ class IdClickbait(datasets.GeneratorBasedBuilder):
115
  }
116
  yield row_index, ex
117
 
118
- elif self.config.schema == "nusantara_text":
119
  for row_index, row in enumerate(data):
120
  ex = {
121
  "id": str(row_index),
 
4
 
5
  import datasets
6
 
7
+ from seacrowd.utils import schemas
8
+ from seacrowd.utils.configs import SEACrowdConfig
9
+ from seacrowd.utils.constants import Tasks
10
 
11
  _CITATION = """\
12
  @article{WILLIAM2020106231,
 
42
  }
43
  _SUPPORTED_TASKS = [Tasks.SENTIMENT_ANALYSIS]
44
  _SOURCE_VERSION = "1.0.0"
45
+ _SEACROWD_VERSION = "2024.06.20"
46
 
47
 
48
  class IdClickbait(datasets.GeneratorBasedBuilder):
49
  """The CLICK-ID dataset is a collection of Indonesian news headlines that was collected from 12 local online news, annotated with a label whether each is a clickbait"""
50
 
51
  SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
52
+ SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
53
 
54
  BUILDER_CONFIGS = [
55
+ SEACrowdConfig(
56
  name="id_clickbait_source",
57
  version=SOURCE_VERSION,
58
  description="CLICK-ID source schema",
59
  schema="source",
60
  subset_id="id_clickbait",
61
  ),
62
+ SEACrowdConfig(
63
+ name="id_clickbait_seacrowd_text",
64
+ version=SEACROWD_VERSION,
65
  description="CLICK-ID Nusantara schema",
66
+ schema="seacrowd_text",
67
  subset_id="id_clickbait",
68
  ),
69
  ]
 
73
  def _info(self) -> datasets.DatasetInfo:
74
  if self.config.schema == "source":
75
  features = datasets.Features({"title": datasets.Value("string"), "label": datasets.Value("string"), "label_score": datasets.Value("int8")})
76
+ elif self.config.schema == "seacrowd_text":
77
  features = schemas.text_features(["non-clickbait", "clickbait"])
78
 
79
  return datasets.DatasetInfo(
 
115
  }
116
  yield row_index, ex
117
 
118
+ elif self.config.schema == "seacrowd_text":
119
  for row_index, row in enumerate(data):
120
  ex = {
121
  "id": str(row_index),