Remove duplicate claims
#1
by
azhx
- opened
fever.py
CHANGED
@@ -46,7 +46,6 @@ class FeverConfig(datasets.BuilderConfig):
|
|
46 |
|
47 |
class Fever(datasets.GeneratorBasedBuilder):
|
48 |
"""Fact Extraction and VERification Dataset."""
|
49 |
-
|
50 |
BUILDER_CONFIGS = [
|
51 |
FeverConfig(
|
52 |
name="v1.0",
|
@@ -134,14 +133,21 @@ class Fever(datasets.GeneratorBasedBuilder):
|
|
134 |
),
|
135 |
]
|
136 |
|
|
|
|
|
|
|
|
|
137 |
def _info(self):
|
138 |
-
if
|
|
|
139 |
features = {
|
140 |
"id": datasets.Value("string"),
|
141 |
"text": datasets.Value("string"),
|
142 |
"lines": datasets.Value("string"),
|
143 |
}
|
144 |
-
elif
|
|
|
|
|
145 |
features = {
|
146 |
"id": datasets.Value("int32"),
|
147 |
"label": datasets.ClassLabel(names=["REFUTES", "SUPPORTS"]),
|
@@ -152,10 +158,13 @@ class Fever(datasets.GeneratorBasedBuilder):
|
|
152 |
"evidence_sentence_id": datasets.Value("int32"),
|
153 |
}
|
154 |
return datasets.DatasetInfo(
|
155 |
-
description=
|
|
|
156 |
features=datasets.Features(features),
|
157 |
-
homepage=
|
158 |
-
|
|
|
|
|
159 |
)
|
160 |
|
161 |
def _split_generators(self, dl_manager):
|
@@ -187,6 +196,10 @@ class Fever(datasets.GeneratorBasedBuilder):
|
|
187 |
continue
|
188 |
|
189 |
claim = data["claim"]
|
|
|
|
|
|
|
|
|
190 |
evidences = data.get("evidence", [])
|
191 |
if len(evidences) > 0:
|
192 |
for i in range(len(evidences)):
|
|
|
46 |
|
47 |
class Fever(datasets.GeneratorBasedBuilder):
|
48 |
"""Fact Extraction and VERification Dataset."""
|
|
|
49 |
BUILDER_CONFIGS = [
|
50 |
FeverConfig(
|
51 |
name="v1.0",
|
|
|
133 |
),
|
134 |
]
|
135 |
|
136 |
+
def __init__(self, *args, **kwargs):
|
137 |
+
super().__init__(*args, **kwargs)
|
138 |
+
self.seen_claims= set()
|
139 |
+
|
140 |
def _info(self):
|
141 |
+
if
|
142 |
+
config.name == "wiki_pages":
|
143 |
features = {
|
144 |
"id": datasets.Value("string"),
|
145 |
"text": datasets.Value("string"),
|
146 |
"lines": datasets.Value("string"),
|
147 |
}
|
148 |
+
elif
|
149 |
+
config.name == "v1.0" or
|
150 |
+
config.name == "v2.0":
|
151 |
features = {
|
152 |
"id": datasets.Value("int32"),
|
153 |
"label": datasets.ClassLabel(names=["REFUTES", "SUPPORTS"]),
|
|
|
158 |
"evidence_sentence_id": datasets.Value("int32"),
|
159 |
}
|
160 |
return datasets.DatasetInfo(
|
161 |
+
description=
|
162 |
+
config.description,
|
163 |
features=datasets.Features(features),
|
164 |
+
homepage=
|
165 |
+
config.homepage,
|
166 |
+
citation=
|
167 |
+
config.citation,
|
168 |
)
|
169 |
|
170 |
def _split_generators(self, dl_manager):
|
|
|
196 |
continue
|
197 |
|
198 |
claim = data["claim"]
|
199 |
+
if claim in self.seen_claims:
|
200 |
+
continue
|
201 |
+
else:
|
202 |
+
self.seen_claims.add(claim)
|
203 |
evidences = data.get("evidence", [])
|
204 |
if len(evidences) > 0:
|
205 |
for i in range(len(evidences)):
|