cypher-256 commited on
Commit
28c26f0
·
1 Parent(s): 284447c

Agrega script de carga con dos configuraciones: valencia y arousal

Browse files
Files changed (1) hide show
  1. emotional-dataset-chile.py +69 -0
emotional-dataset-chile.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import datasets
3
+
4
+ _CITATION = """\
5
+ @misc{quintero2024emotionaldatasetchile,
6
+ author = {cypher-256},
7
+ title = {Emotional Dataset Chile},
8
+ year = 2025,
9
+ url = {https://huggingface.co/datasets/cypher-256/emotional-dataset-chile}
10
+ }
11
+ """
12
+
13
+ _DESCRIPTION = """\
14
+ Este dataset contiene ejemplos en español chileno etiquetados con valencia o arousal emocional \
15
+ en formato de regresión continua (-1.0 a 1.0). Incluye dos configuraciones independientes: 'valencia' y 'arousal'.
16
+ """
17
+
18
+ _HOMEPAGE = "https://huggingface.co/datasets/cypher-256/emotional-dataset-chile"
19
+
20
+ _LICENSE = "MIT"
21
+
22
+ _DATA_FILES = {
23
+ "valencia": "valencia_dataset.jsonl",
24
+ "arousal": "arousal_dataset.jsonl",
25
+ }
26
+
27
+ class EmotionalDatasetChileConfig(datasets.BuilderConfig):
28
+ def __init__(self, name, **kwargs):
29
+ super().__init__(name=name, **kwargs)
30
+
31
+ class EmotionalDatasetChile(datasets.GeneratorBasedBuilder):
32
+ BUILDER_CONFIGS = [
33
+ EmotionalDatasetChileConfig(
34
+ name="valencia",
35
+ version=datasets.Version("1.0.0"),
36
+ description="Text samples labeled with emotional valence",
37
+ ),
38
+ EmotionalDatasetChileConfig(
39
+ name="arousal",
40
+ version=datasets.Version("1.0.0"),
41
+ description="Text samples labeled with emotional arousal",
42
+ ),
43
+ ]
44
+
45
+ def _info(self):
46
+ features = datasets.Features(
47
+ {
48
+ "texto": datasets.Value("string"),
49
+ self.config.name: datasets.Value("float32"),
50
+ }
51
+ )
52
+ return datasets.DatasetInfo(
53
+ description=_DESCRIPTION,
54
+ features=features,
55
+ homepage=_HOMEPAGE,
56
+ license=_LICENSE,
57
+ citation=_CITATION,
58
+ )
59
+
60
+ def _split_generators(self, dl_manager):
61
+ data_file = _DATA_FILES[self.config.name]
62
+ data_path = dl_manager.download_and_extract(data_file)
63
+ return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_path})]
64
+
65
+ def _generate_examples(self, filepath):
66
+ with open(filepath, encoding="utf-8") as f:
67
+ for idx, line in enumerate(f):
68
+ data = json.loads(line)
69
+ yield idx, data