herbievore commited on
Commit
d591260
1 Parent(s): 1ca40ba

Data added

Browse files
Files changed (3) hide show
  1. csfever_nli.py +76 -0
  2. data/dev.jsonl +0 -0
  3. data/paper_test.jsonl +0 -0
csfever_nli.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.1"
10
+
11
+ _URL= "data/"
12
+
13
+ _URLS = {
14
+ "train": _URL + "train.jsonl",
15
+ "validation": _URL + "paper_dev.jsonl",
16
+ "test": _URL + "paper_test.jsonl"
17
+ }
18
+
19
+ _DESCRIPTION = """\
20
+ CsfeverNLI is a NLI version of the Czech Csfever dataset
21
+ """
22
+
23
+ _CITATION = """\
24
+ todo
25
+ """
26
+
27
+ datasets.utils.version.Version
28
+ class CsfeverNli(datasets.GeneratorBasedBuilder):
29
+ def _info(self):
30
+ return datasets.DatasetInfo(
31
+ description=_DESCRIPTION,
32
+ features=datasets.Features(
33
+ {
34
+ "id": datasets.Value("string"),
35
+ "label": datasets.ClassLabel(names=["REFUTES", "NOT ENOUGH INFO", "SUPPORTS"]),
36
+ # datasets.features.Sequence({"text": datasets.Value("string"),"answer_start": datasets.Value("int32"),})
37
+ "evidence": datasets.Value("string"),
38
+ "claim": datasets.Value("string"),
39
+ }
40
+ ),
41
+ # No default supervised_keys (as we have to pass both question
42
+ # and context as input).
43
+ supervised_keys=None,
44
+ version=_VERSION,
45
+ homepage="https://fcheck.fel.cvut.cz/dataset/",
46
+ citation=_CITATION,
47
+ )
48
+
49
+ def _split_generators(self, dl_manager: datasets.DownloadManager):
50
+ downloaded_files = dl_manager.download_and_extract(_URLS)
51
+
52
+ return [
53
+ datasets.SplitGenerator(datasets.Split.TRAIN, {
54
+ "filepath": downloaded_files["train"]
55
+ }),
56
+ datasets.SplitGenerator(datasets.Split.VALIDATION, {
57
+ "filepath": downloaded_files["validation"]
58
+ }),
59
+ datasets.SplitGenerator(datasets.Split.TEST, {
60
+ "filepath": downloaded_files["test"]
61
+ }),
62
+ ]
63
+
64
+ def _generate_examples(self, filepath):
65
+ """This function returns the examples in the raw (text) form."""
66
+ key = 0
67
+ with open(filepath, encoding="utf-8") as f:
68
+ for line in f:
69
+ datapoint = json.loads(line)
70
+ yield key, {
71
+ "id": datapoint["cid"],
72
+ "evidence": datapoint["context"],
73
+ "claim": datapoint["query"],
74
+ "label": datapoint["label"]
75
+ }
76
+ key += 1
data/dev.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/paper_test.jsonl ADDED
The diff for this file is too large to render. See raw diff