Datasets:

Modalities:
Text
Formats:
parquet
Languages:
Catalan
ArXiv:
Libraries:
Datasets
pandas
License:
AnnaSallesRius commited on
Commit
fa61910
·
verified ·
1 Parent(s): 910b0e9

Delete teca.py

Browse files
Files changed (1) hide show
  1. teca.py +0 -116
teca.py DELETED
@@ -1,116 +0,0 @@
1
- # Loading script for the TECA dataset.
2
- import json
3
- import datasets
4
-
5
- logger = datasets.logging.get_logger(__name__)
6
-
7
- _CITATION = """
8
- @inproceedings{armengol-estape-etal-2021-multilingual,
9
- title = "Are Multilingual Models the Best Choice for Moderately Under-resourced Languages? {A} Comprehensive Assessment for {C}atalan",
10
- author = "Armengol-Estap{\'e}, Jordi and
11
- Carrino, Casimiro Pio and
12
- Rodriguez-Penagos, Carlos and
13
- de Gibert Bonet, Ona and
14
- Armentano-Oller, Carme and
15
- Gonzalez-Agirre, Aitor and
16
- Melero, Maite and
17
- Villegas, Marta",
18
- booktitle = "Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021",
19
- month = aug,
20
- year = "2021",
21
- address = "Online",
22
- publisher = "Association for Computational Linguistics",
23
- url = "https://aclanthology.org/2021.findings-acl.437",
24
- doi = "10.18653/v1/2021.findings-acl.437",
25
- pages = "4933--4946",
26
- }
27
- """
28
-
29
- _DESCRIPTION = """
30
- TECA consists of two subsets of textual entailment in Catalan, *catalan_TE1* and *vilaweb_TE*, which contain 14997 and 6166 pairs of premises and hypotheses, annotated according to the inference relation they have (implication, contradiction or neutral). This dataset was developed by BSC TeMU as part of the AINA project and intended as part of the Catalan Language Understanding Benchmark (CLUB).
31
- """
32
-
33
- _HOMEPAGE = """https://zenodo.org/record/4621378"""
34
-
35
- # TODO: upload datasets to github
36
- _URL = "https://huggingface.co/datasets/projecte-aina/teca/resolve/main/"
37
- _TRAINING_FILE = "train.json"
38
- _DEV_FILE = "dev.json"
39
- _TEST_FILE = "test.json"
40
-
41
-
42
- class tecaConfig(datasets.BuilderConfig):
43
- """ Builder config for the TECA dataset """
44
-
45
- def __init__(self, **kwargs):
46
- """BuilderConfig for TECA.
47
- Args:
48
- **kwargs: keyword arguments forwarded to super.
49
- """
50
- super(tecaConfig, self).__init__(**kwargs)
51
-
52
-
53
- class teca(datasets.GeneratorBasedBuilder):
54
- """ TECA Dataset """
55
-
56
- BUILDER_CONFIGS = [
57
- tecaConfig(
58
- name="teca",
59
- version=datasets.Version("1.0.1"),
60
- description="teca dataset",
61
- ),
62
- ]
63
-
64
- def _info(self):
65
- return datasets.DatasetInfo(
66
- description=_DESCRIPTION,
67
- features=datasets.Features(
68
- {
69
- "id": datasets.Value("string"),
70
- "premise": datasets.Value("string"),
71
- "hypothesis": datasets.Value("string"),
72
- "label": datasets.features.ClassLabel
73
- (names=
74
- [
75
- "entailment",
76
- "neutral",
77
- "contradiction"
78
- ]
79
- ),
80
- }
81
- ),
82
- homepage=_HOMEPAGE,
83
- citation=_CITATION,
84
- )
85
-
86
- def _split_generators(self, dl_manager):
87
- """Returns SplitGenerators."""
88
- urls_to_download = {
89
- "train": f"{_URL}{_TRAINING_FILE}",
90
- "dev": f"{_URL}{_DEV_FILE}",
91
- "test": f"{_URL}{_TEST_FILE}",
92
- }
93
- downloaded_files = dl_manager.download_and_extract(urls_to_download)
94
-
95
- return [
96
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
97
- datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
98
- datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
99
- ]
100
-
101
- def _generate_examples(self, filepath):
102
- """This function returns the examples in the raw (text) form."""
103
- logger.info("generating examples from = %s", filepath)
104
- with open(filepath, encoding="utf-8") as f:
105
- data_dict = json.load(f)
106
- for id_, article in enumerate(data_dict["data"]):
107
- original_id = article["id"]
108
- premise = article["premise"]
109
- hypothesis = article["hypothesis"]
110
- label = article["label"]
111
- yield id_, {
112
- "id": original_id,
113
- "premise": premise,
114
- "hypothesis": hypothesis,
115
- "label": label,
116
- }