Datasets:
Commit
•
80a2ede
1
Parent(s):
4ad5136
feat: set spans to remote location
Browse files- faquad-nli.py +7 -3
faquad-nli.py
CHANGED
@@ -11,7 +11,8 @@ _DESCRIPTION = """
|
|
11 |
"""
|
12 |
|
13 |
_URLS = {
|
14 |
-
"data": "https://raw.githubusercontent.com/liafacom/faquad/6ad978f20672bb41625b3b71fbe4a88b893d0a86/data/dataset.json"
|
|
|
15 |
}
|
16 |
|
17 |
def check_overlap(interval1, interval2):
|
@@ -46,6 +47,7 @@ class Faquad(datasets.GeneratorBasedBuilder):
|
|
46 |
name=datasets.Split.TRAIN,
|
47 |
gen_kwargs={
|
48 |
"data": downloaded_files["data"],
|
|
|
49 |
"split": "train"
|
50 |
}
|
51 |
),
|
@@ -53,6 +55,7 @@ class Faquad(datasets.GeneratorBasedBuilder):
|
|
53 |
name=datasets.Split.VALIDATION,
|
54 |
gen_kwargs={
|
55 |
"data": downloaded_files["data"],
|
|
|
56 |
"split": "validation"
|
57 |
}
|
58 |
),
|
@@ -60,17 +63,18 @@ class Faquad(datasets.GeneratorBasedBuilder):
|
|
60 |
name=datasets.Split.TEST,
|
61 |
gen_kwargs={
|
62 |
"data": downloaded_files["data"],
|
|
|
63 |
"split": "test"
|
64 |
}
|
65 |
)
|
66 |
]
|
67 |
|
68 |
-
def _generate_examples(self, data, split):
|
69 |
|
70 |
with open(data, 'r') as f:
|
71 |
json_data = json.load(f)
|
72 |
|
73 |
-
spans = pd.read_csv(
|
74 |
counter = 0
|
75 |
for span_row in spans:
|
76 |
if span_row["split"] != split:
|
|
|
11 |
"""
|
12 |
|
13 |
_URLS = {
|
14 |
+
"data": "https://raw.githubusercontent.com/liafacom/faquad/6ad978f20672bb41625b3b71fbe4a88b893d0a86/data/dataset.json",
|
15 |
+
"spans": "https://huggingface.co/datasets/ruanchaves/faquad-nli/raw/main/spans.csv"
|
16 |
}
|
17 |
|
18 |
def check_overlap(interval1, interval2):
|
|
|
47 |
name=datasets.Split.TRAIN,
|
48 |
gen_kwargs={
|
49 |
"data": downloaded_files["data"],
|
50 |
+
"spans": downloaded_files["spans"],
|
51 |
"split": "train"
|
52 |
}
|
53 |
),
|
|
|
55 |
name=datasets.Split.VALIDATION,
|
56 |
gen_kwargs={
|
57 |
"data": downloaded_files["data"],
|
58 |
+
"spans": downloaded_files["spans"],
|
59 |
"split": "validation"
|
60 |
}
|
61 |
),
|
|
|
63 |
name=datasets.Split.TEST,
|
64 |
gen_kwargs={
|
65 |
"data": downloaded_files["data"],
|
66 |
+
"spans": downloaded_files["spans"],
|
67 |
"split": "test"
|
68 |
}
|
69 |
)
|
70 |
]
|
71 |
|
72 |
+
def _generate_examples(self, data, spans, split):
|
73 |
|
74 |
with open(data, 'r') as f:
|
75 |
json_data = json.load(f)
|
76 |
|
77 |
+
spans = pd.read_csv(spans).to_dict("records")
|
78 |
counter = 0
|
79 |
for span_row in spans:
|
80 |
if span_row["split"] != split:
|