Datasets:
Commit
·
2207f36
1
Parent(s):
16af6a7
Update snli-zh.py
Browse files- snli-zh.py +11 -6
snli-zh.py
CHANGED
@@ -88,10 +88,15 @@ class Snli(datasets.GeneratorBasedBuilder):
|
|
88 |
"""This function returns the examples in the raw (text) form."""
|
89 |
with open(filepath, encoding="utf-8") as f:
|
90 |
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
|
|
91 |
for idx, row in enumerate(reader):
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
|
88 |
"""This function returns the examples in the raw (text) form."""
|
89 |
with open(filepath, encoding="utf-8") as f:
|
90 |
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
91 |
+
c = 0
|
92 |
for idx, row in enumerate(reader):
|
93 |
+
premise = row['sentence1']
|
94 |
+
hypothesis = row['sentence2']
|
95 |
+
label = row["gold_label"]
|
96 |
+
if len(premise) > 1 and len(hypothesis) > 1 and label in ["entailment", "neutral", "contradiction"]:
|
97 |
+
yield c, {
|
98 |
+
"premise": premise,
|
99 |
+
"hypothesis": hypothesis,
|
100 |
+
"label": label,
|
101 |
+
}
|
102 |
+
c += 1
|