Update wnli.py
Browse files
wnli.py
CHANGED
@@ -84,24 +84,22 @@ class Winograd(datasets.GeneratorBasedBuilder):
|
|
84 |
def _generate_examples(self, filepath):
|
85 |
"""This function returns the examples in the raw (text) form."""
|
86 |
logger.info("generating examples from = %s", filepath)
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
for id_,
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
"label": -1,
|
105 |
-
}
|
106 |
|
107 |
|
|
|
84 |
def _generate_examples(self, filepath):
|
85 |
"""This function returns the examples in the raw (text) form."""
|
86 |
logger.info("generating examples from = %s", filepath)
|
87 |
+
df = pd.read_csv(filepath, sep='\t')
|
88 |
+
header = df.keys()
|
89 |
+
process_label = {0: "not_entailment", 1: "entailment"}
|
90 |
+
if "label" in header:
|
91 |
+
for id_, (ref, sentence1, sentence2, score) in df.iterrows():
|
92 |
+
yield id_, {
|
93 |
+
"sentence1": sentence1,
|
94 |
+
"sentence2": sentence2,
|
95 |
+
"label": process_label[score],
|
96 |
+
}
|
97 |
+
else:
|
98 |
+
for id_, (ref, sentence1, sentence2) in df.iterrows():
|
99 |
+
yield id_, {
|
100 |
+
"sentence1": sentence1,
|
101 |
+
"sentence2": sentence2,
|
102 |
+
"label": -1,
|
103 |
+
}
|
|
|
|
|
104 |
|
105 |
|