holylovenia commited on
Commit
736c175
1 Parent(s): 7638409

Upload emotcmt.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. emotcmt.py +12 -12
emotcmt.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 Tasks, DEFAULT_SOURCE_VIEW_NAME, DEFAULT_NUSANTARA_VIEW_NAME
10
 
11
  _DATASETNAME = "emotcmt"
12
  _SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
13
- _UNIFIED_VIEW_NAME = DEFAULT_NUSANTARA_VIEW_NAME
14
 
15
  _LANGUAGES = ["ind"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
16
  _LOCAL = False
@@ -53,23 +53,23 @@ _URLs = {
53
  _SUPPORTED_TASKS = [Tasks.EMOTION_CLASSIFICATION]
54
 
55
  _SOURCE_VERSION = "1.0.0"
56
- _NUSANTARA_VERSION = "1.0.0"
57
 
58
 
59
  class EmotCMT(datasets.GeneratorBasedBuilder):
60
  BUILDER_CONFIGS = [
61
- NusantaraConfig(
62
  name="emotcmt_source",
63
  version=datasets.Version(_SOURCE_VERSION),
64
  description="EmotCMT source schema",
65
  schema="source",
66
  subset_id="emotcmt",
67
  ),
68
- NusantaraConfig(
69
- name="emotcmt_nusantara_text",
70
- version=datasets.Version(_NUSANTARA_VERSION),
71
  description="EmotCMT Nusantara schema",
72
- schema="nusantara_text",
73
  subset_id="emotcmt",
74
  ),
75
  ]
@@ -79,7 +79,7 @@ class EmotCMT(datasets.GeneratorBasedBuilder):
79
  def _info(self):
80
  if self.config.schema == "source":
81
  features = datasets.Features({"tweet": datasets.Value("string"), "label": datasets.Value("string")})
82
- elif self.config.schema == "nusantara_text":
83
  features = schemas.text_features(["cinta", "takut", "sedih", "senang", "marah"])
84
 
85
  return datasets.DatasetInfo(
@@ -111,7 +111,7 @@ class EmotCMT(datasets.GeneratorBasedBuilder):
111
  for row in df.itertuples():
112
  ex = {"tweet": row.sentence, "label": row.label}
113
  yield row.id, ex
114
- elif self.config.schema == "nusantara_text":
115
  for row in df.itertuples():
116
  ex = {
117
  "id": str(row.id),
 
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 Tasks, DEFAULT_SOURCE_VIEW_NAME, DEFAULT_SEACROWD_VIEW_NAME
10
 
11
  _DATASETNAME = "emotcmt"
12
  _SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
13
+ _UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
14
 
15
  _LANGUAGES = ["ind"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
16
  _LOCAL = False
 
53
  _SUPPORTED_TASKS = [Tasks.EMOTION_CLASSIFICATION]
54
 
55
  _SOURCE_VERSION = "1.0.0"
56
+ _SEACROWD_VERSION = "2024.06.20"
57
 
58
 
59
  class EmotCMT(datasets.GeneratorBasedBuilder):
60
  BUILDER_CONFIGS = [
61
+ SEACrowdConfig(
62
  name="emotcmt_source",
63
  version=datasets.Version(_SOURCE_VERSION),
64
  description="EmotCMT source schema",
65
  schema="source",
66
  subset_id="emotcmt",
67
  ),
68
+ SEACrowdConfig(
69
+ name="emotcmt_seacrowd_text",
70
+ version=datasets.Version(_SEACROWD_VERSION),
71
  description="EmotCMT Nusantara schema",
72
+ schema="seacrowd_text",
73
  subset_id="emotcmt",
74
  ),
75
  ]
 
79
  def _info(self):
80
  if self.config.schema == "source":
81
  features = datasets.Features({"tweet": datasets.Value("string"), "label": datasets.Value("string")})
82
+ elif self.config.schema == "seacrowd_text":
83
  features = schemas.text_features(["cinta", "takut", "sedih", "senang", "marah"])
84
 
85
  return datasets.DatasetInfo(
 
111
  for row in df.itertuples():
112
  ex = {"tweet": row.sentence, "label": row.label}
113
  yield row.id, ex
114
+ elif self.config.schema == "seacrowd_text":
115
  for row in df.itertuples():
116
  ex = {
117
  "id": str(row.id),