ma2za commited on
Commit
c06e3bd
·
1 Parent(s): 5e677e7

Upload emotions_dataset.py

Browse files
Files changed (1) hide show
  1. emotions_dataset.py +4 -1
emotions_dataset.py CHANGED
@@ -172,6 +172,8 @@ class EmotionsDataset(datasets.GeneratorBasedBuilder):
172
  for d in self.process_daily_dialog(filepaths, dataset):
173
  yield d
174
  elif dataset == "emotion":
 
 
175
  for i, filepath in enumerate(filepaths):
176
  with open(filepath, encoding="utf-8") as f:
177
  for idx, line in enumerate(f):
@@ -180,6 +182,7 @@ class EmotionsDataset(datasets.GeneratorBasedBuilder):
180
  example.update({
181
  "id": uid,
182
  "dataset": dataset,
183
- "license": license
 
184
  })
185
  yield uid, example
 
172
  for d in self.process_daily_dialog(filepaths, dataset):
173
  yield d
174
  elif dataset == "emotion":
175
+ emo_mapping = {0: "sadness", 1: "joy", 2: "love",
176
+ 3: "anger", 4: "fear", 5: "surprise"}
177
  for i, filepath in enumerate(filepaths):
178
  with open(filepath, encoding="utf-8") as f:
179
  for idx, line in enumerate(f):
 
182
  example.update({
183
  "id": uid,
184
  "dataset": dataset,
185
+ "license": license,
186
+ "label": emo_mapping[example["label"]]
187
  })
188
  yield uid, example