Miguel Gómez Prieto commited on
Commit
3f56c9b
·
1 Parent(s): fba5c96

data split

Browse files
{train → data}/empleos-espanoles-eures-2025.csv RENAMED
File without changes
dataset_script.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split
3
+
4
+ class JobOffersESP(GeneratorBasedBuilder):
5
+ VERSION = "1.0.0"
6
+
7
+ def _info(self):
8
+ return DatasetInfo(
9
+ description="Dataset de ofertas laborales en español extraídas de EURES y fuentes autonómicas.",
10
+ features={
11
+ "url": {"dtype": "string"},
12
+ "fecha_publicacion": {"dtype": "string"},
13
+ "fecha_limite": {"dtype": "string"},
14
+ "titulo": {"dtype": "string"},
15
+ "empresa": {"dtype": "string"},
16
+ "ocupacion": {"dtype": "string"},
17
+ "descripcion": {"dtype": "string"},
18
+ "pais": {"dtype": "string"},
19
+ "region": {"dtype": "string"},
20
+ "tipo_contrato": {"dtype": "string"},
21
+ },
22
+ supervised_keys=None,
23
+ )
24
+
25
+ def _split_generators(self, dl_manager):
26
+ data_path = dl_manager.download_and_extract("data/job_offers.csv")
27
+ return [
28
+ SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": data_path}),
29
+ ]
30
+
31
+ def _generate_examples(self, filepath):
32
+ with open(filepath, encoding="utf-8") as f:
33
+ reader = csv.DictReader(f, delimiter=";")
34
+ for idx, row in enumerate(reader):
35
+ yield idx, {
36
+ "url": row["url"],
37
+ "fecha_publicacion": row["fecha_publicacion"],
38
+ "fecha_limite": row["fecha_limite"],
39
+ "titulo": row["titulo"],
40
+ "empresa": row["empresa"],
41
+ "ocupacion": row["ocupacion"],
42
+ "descripcion": row["descripcion"],
43
+ "pais": row["pais"],
44
+ "region": row["region"],
45
+ "tipo_contrato": row["tipo_contrato"],
46
+ }