Datasets:

Modalities:
Text
Languages:
Spanish
Libraries:
Datasets
License:
crodri commited on
Commit
bc8d20b
1 Parent(s): aa7cb52
Files changed (6) hide show
  1. .gitignore +3 -0
  2. WikiCAT_esv2.py +88 -0
  3. hfeval_es.json +0 -0
  4. hfeval_esv5.json +0 -0
  5. hftrain_en.json +0 -3
  6. hftrain_esv5.json +0 -0
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+
2
+ hftrain_en.json
3
+ hfeval_es.json
WikiCAT_esv2.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Loading script for the TeCla dataset.
2
+ import json
3
+ import datasets
4
+
5
+ logger = datasets.logging.get_logger(__name__)
6
+
7
+ _CITATION = """
8
+
9
+ """
10
+
11
+ _DESCRIPTION = """
12
+ WikiCAT: Text Classification Spanish dataset from the Viquipedia
13
+
14
+ """
15
+
16
+ _HOMEPAGE = """ """
17
+
18
+ # TODO: upload datasets to github
19
+ _URL = "https://huggingface.co/datasets/crodri/WikiCAT_esv2/tree/main"
20
+ _TRAINING_FILE = "hftrain_esv5.json"
21
+ _DEV_FILE = "hfeval_esv5.json"
22
+ #_TEST_FILE = "test.json"
23
+
24
+
25
+ class wikiCAT_esConfig(datasets.BuilderConfig):
26
+ """ Builder config for the Topicat dataset """
27
+
28
+ def __init__(self, **kwargs):
29
+ """BuilderConfig for wikiCAT_es.
30
+ Args:
31
+ **kwargs: keyword arguments forwarded to super.
32
+ """
33
+ super(wikiCAT_esConfig, self).__init__(**kwargs)
34
+
35
+
36
+ class wikiCAT_es(datasets.GeneratorBasedBuilder):
37
+ """ wikiCAT_es Dataset """
38
+
39
+ BUILDER_CONFIGS = [
40
+ wikiCAT_esConfig(
41
+ name="wikiCAT_es",
42
+ version=datasets.Version("1.1.0"),
43
+ description="wikiCAT_es",
44
+ ),
45
+ ]
46
+
47
+ def _info(self):
48
+ return datasets.DatasetInfo(
49
+ description=_DESCRIPTION,
50
+ features=datasets.Features(
51
+ {
52
+ "text": datasets.Value("string"),
53
+ "label": datasets.features.ClassLabel
54
+ (names= ['Religión', 'Entretenimiento', 'Música', 'Ciencia_y_Tecnología', 'Política', 'Economía', 'Matemáticas', 'Humanidades', 'Deporte', 'Derecho', 'Historia', 'Filosofía']
55
+ ),
56
+ }
57
+ ),
58
+ homepage=_HOMEPAGE,
59
+ citation=_CITATION,
60
+ )
61
+
62
+ def _split_generators(self, dl_manager):
63
+ """Returns SplitGenerators."""
64
+ urls_to_download = {
65
+ "train": f"{_URL}{_TRAINING_FILE}",
66
+ "dev": f"{_URL}{_DEV_FILE}",
67
+ # "test": f"{_URL}{_TEST_FILE}",
68
+ }
69
+ downloaded_files = dl_manager.download_and_extract(urls_to_download)
70
+
71
+ return [
72
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
73
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
74
+ # datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
75
+ ]
76
+
77
+ def _generate_examples(self, filepath):
78
+ """This function returns the examples in the raw (text) form."""
79
+ logger.info("generating examples from = %s", filepath)
80
+ with open(filepath, encoding="utf-8") as f:
81
+ wikiCAT_es = json.load(f)
82
+ for id_, article in enumerate(wikiCAT_es["data"]):
83
+ text = article["sentence"]
84
+ label = article["label"]
85
+ yield id_, {
86
+ "text": text,
87
+ "label": label,
88
+ }
hfeval_es.json DELETED
The diff for this file is too large to render. See raw diff
 
hfeval_esv5.json ADDED
The diff for this file is too large to render. See raw diff
 
hftrain_en.json DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:1257bce9d7535db27a79b840f91b74a4337f6d990d597ba9371e35625c232f4f
3
- size 20472652
 
 
 
 
hftrain_esv5.json ADDED
The diff for this file is too large to render. See raw diff