muhammadravi251001 commited on
Commit
c7d5afe
·
verified ·
1 Parent(s): 0151312

Update idkmrc-nli.py

Browse files
Files changed (1) hide show
  1. idkmrc-nli.py +8 -9
idkmrc-nli.py CHANGED
@@ -16,7 +16,7 @@
16
 
17
 
18
  import json
19
-
20
  import datasets
21
 
22
 
@@ -99,12 +99,11 @@ class IDKMRCNLI(datasets.GeneratorBasedBuilder):
99
 
100
  def _generate_examples(self, filepath):
101
  """Yields examples."""
102
-
103
- with open(filepath, encoding="utf-8") as jsonl_file:
104
- for id_, row in enumerate(jsonl_file):
105
- row_jsonl = json.loads(row)
106
  yield id_, {
107
- "premise": row_jsonl["premise"],
108
- "hypothesis": row_jsonl["hypothesis"],
109
- "label": {"e": "entailment", "n": "neutral", "c": "contradiction"}[row_jsonl["label"]],
110
- }
 
16
 
17
 
18
  import json
19
+ import csv
20
  import datasets
21
 
22
 
 
99
 
100
  def _generate_examples(self, filepath):
101
  """Yields examples."""
102
+ with open(filepath, encoding="utf-8") as csv_file:
103
+ csv_reader = csv.DictReader(csv_file)
104
+ for id_, row in enumerate(csv_reader):
 
105
  yield id_, {
106
+ "premise": row["premise"],
107
+ "hypothesis": row["hypothesis"],
108
+ "label": {"e": "entailment", "n": "neutral", "c": "contradiction"}[row["label"]],
109
+ }