ma2za commited on
Commit
0c13041
·
1 Parent(s): e556142

🐛 first final fixes

Browse files
Files changed (1) hide show
  1. many_emotions.py +6 -7
many_emotions.py CHANGED
@@ -4,8 +4,7 @@ from typing import List
4
  import datasets
5
  from datasets import ClassLabel, Value, load_dataset
6
 
7
- _URLS = {
8
- }
9
 
10
  _SUB_CLASSES = [
11
  "anger",
@@ -64,7 +63,7 @@ class EmotionsDataset(datasets.GeneratorBasedBuilder):
64
  EmotionsDatasetConfig(
65
  name="raw",
66
  label_classes=_SUB_CLASSES,
67
- features=["text", "label", "dataset", "license", "language"]
68
  ),
69
  EmotionsDatasetConfig(
70
  name="split",
@@ -73,7 +72,7 @@ class EmotionsDataset(datasets.GeneratorBasedBuilder):
73
  )
74
  ]
75
 
76
- DEFAULT_CONFIG_NAME = "all"
77
 
78
  def _info(self):
79
  return datasets.DatasetInfo(
@@ -84,7 +83,7 @@ class EmotionsDataset(datasets.GeneratorBasedBuilder):
84
  'label': ClassLabel(names=_SUB_CLASSES, id=None),
85
  'dataset': Value(dtype='string', id=None),
86
  'license': Value(dtype='string', id=None),
87
- 'language': Value(dtype='string', id=None)
88
  }
89
  )
90
  )
@@ -93,7 +92,7 @@ class EmotionsDataset(datasets.GeneratorBasedBuilder):
93
  splits = []
94
  if self.config.name == "raw":
95
  downloaded_files = dl_manager.download_and_extract(["data/many_emotions.json.gz"])
96
- for lang in ["en", "fr", "it", "es", "de"]:
97
  splits.append(datasets.SplitGenerator(name=lang,
98
  gen_kwargs={"filepaths": downloaded_files,
99
  "language": lang,
@@ -138,5 +137,5 @@ class EmotionsDataset(datasets.GeneratorBasedBuilder):
138
 
139
 
140
  if __name__ == "__main__":
141
- dataset = load_dataset("ma2za/many_emotions", name="raw")
142
  print()
 
4
  import datasets
5
  from datasets import ClassLabel, Value, load_dataset
6
 
7
+ _LANGUAGES = ["en", "fr", "it", "es", "de"]
 
8
 
9
  _SUB_CLASSES = [
10
  "anger",
 
63
  EmotionsDatasetConfig(
64
  name="raw",
65
  label_classes=_SUB_CLASSES,
66
+ features=["text", "label", "dataset", "license"]
67
  ),
68
  EmotionsDatasetConfig(
69
  name="split",
 
72
  )
73
  ]
74
 
75
+ DEFAULT_CONFIG_NAME = "split"
76
 
77
  def _info(self):
78
  return datasets.DatasetInfo(
 
83
  'label': ClassLabel(names=_SUB_CLASSES, id=None),
84
  'dataset': Value(dtype='string', id=None),
85
  'license': Value(dtype='string', id=None),
86
+ 'language': ClassLabel(names=_LANGUAGES, id=None)
87
  }
88
  )
89
  )
 
92
  splits = []
93
  if self.config.name == "raw":
94
  downloaded_files = dl_manager.download_and_extract(["data/many_emotions.json.gz"])
95
+ for lang in _LANGUAGES:
96
  splits.append(datasets.SplitGenerator(name=lang,
97
  gen_kwargs={"filepaths": downloaded_files,
98
  "language": lang,
 
137
 
138
 
139
  if __name__ == "__main__":
140
+ dataset = load_dataset("ma2za/many_emotions", name="split")
141
  print()