KennethEnevoldsen
commited on
Commit
•
376ba61
1
Parent(s):
0faf63d
Delete loading script
Browse files- ctkfacts_nli.py +0 -92
ctkfacts_nli.py
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import pathlib
|
3 |
-
from typing import overload
|
4 |
-
import datasets
|
5 |
-
import json
|
6 |
-
|
7 |
-
from datasets.info import DatasetInfo
|
8 |
-
|
9 |
-
_VERSION = "0.0.6"
|
10 |
-
|
11 |
-
_URL= "data/"
|
12 |
-
|
13 |
-
_URLS = {
|
14 |
-
"train": _URL + "train.jsonl",
|
15 |
-
"validation": _URL + "validation.jsonl",
|
16 |
-
"test": _URL + "test.jsonl"
|
17 |
-
}
|
18 |
-
|
19 |
-
_DESCRIPTION = """\
|
20 |
-
CtkFactsNLI is a NLI version of the Czech CTKFacts dataset
|
21 |
-
"""
|
22 |
-
|
23 |
-
_CITATION = """\
|
24 |
-
@article{DBLP:journals/corr/abs-2201-11115,
|
25 |
-
author = {Jan Drchal and
|
26 |
-
Herbert Ullrich and
|
27 |
-
Martin R{\'{y}}par and
|
28 |
-
Hana Vincourov{\'{a}} and
|
29 |
-
V{\'{a}}clav Moravec},
|
30 |
-
title = {CsFEVER and CTKFacts: Czech Datasets for Fact Verification},
|
31 |
-
journal = {CoRR},
|
32 |
-
volume = {abs/2201.11115},
|
33 |
-
year = {2022},
|
34 |
-
url = {https://arxiv.org/abs/2201.11115},
|
35 |
-
eprinttype = {arXiv},
|
36 |
-
eprint = {2201.11115},
|
37 |
-
timestamp = {Tue, 01 Feb 2022 14:59:01 +0100},
|
38 |
-
biburl = {https://dblp.org/rec/journals/corr/abs-2201-11115.bib},
|
39 |
-
bibsource = {dblp computer science bibliography, https://dblp.org}
|
40 |
-
}
|
41 |
-
"""
|
42 |
-
|
43 |
-
datasets.utils.version.Version
|
44 |
-
class CtkfactsNli(datasets.GeneratorBasedBuilder):
|
45 |
-
def _info(self):
|
46 |
-
return datasets.DatasetInfo(
|
47 |
-
description=_DESCRIPTION,
|
48 |
-
features=datasets.Features(
|
49 |
-
{
|
50 |
-
"id": datasets.Value("int32"),
|
51 |
-
"label": datasets.ClassLabel(names=["REFUTES", "NOT ENOUGH INFO", "SUPPORTS"]),
|
52 |
-
# datasets.features.Sequence({"text": datasets.Value("string"),"answer_start": datasets.Value("int32"),})
|
53 |
-
"evidence": datasets.Value("string"),
|
54 |
-
"claim": datasets.Value("string"),
|
55 |
-
}
|
56 |
-
),
|
57 |
-
# No default supervised_keys (as we have to pass both question
|
58 |
-
# and context as input).
|
59 |
-
supervised_keys=None,
|
60 |
-
version=_VERSION,
|
61 |
-
homepage="https://fcheck.fel.cvut.cz/dataset/",
|
62 |
-
citation=_CITATION,
|
63 |
-
)
|
64 |
-
|
65 |
-
def _split_generators(self, dl_manager: datasets.DownloadManager):
|
66 |
-
downloaded_files = dl_manager.download_and_extract(_URLS)
|
67 |
-
|
68 |
-
return [
|
69 |
-
datasets.SplitGenerator(datasets.Split.TRAIN, {
|
70 |
-
"filepath": downloaded_files["train"]
|
71 |
-
}),
|
72 |
-
datasets.SplitGenerator(datasets.Split.VALIDATION, {
|
73 |
-
"filepath": downloaded_files["validation"]
|
74 |
-
}),
|
75 |
-
datasets.SplitGenerator(datasets.Split.TEST, {
|
76 |
-
"filepath": downloaded_files["test"]
|
77 |
-
}),
|
78 |
-
]
|
79 |
-
|
80 |
-
def _generate_examples(self, filepath):
|
81 |
-
"""This function returns the examples in the raw (text) form."""
|
82 |
-
key = 0
|
83 |
-
with open(filepath, encoding="utf-8") as f:
|
84 |
-
for line in f:
|
85 |
-
datapoint = json.loads(line)
|
86 |
-
yield key, {
|
87 |
-
"id": datapoint["id"],
|
88 |
-
"evidence": " ".join(datapoint["evidence"]),
|
89 |
-
"claim": datapoint["claim"],
|
90 |
-
"label": datapoint["label"]
|
91 |
-
}
|
92 |
-
key += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|