amphora commited on
Commit
cccb20f
1 Parent(s): d2c0e70

Update csatqa.py

Browse files
Files changed (1) hide show
  1. csatqa.py +11 -11
csatqa.py CHANGED
@@ -62,18 +62,18 @@ class CSATQA(datasets.GeneratorBasedBuilder):
62
  ),
63
  ]
64
 
65
- # def _generate_examples(self, filepath):
66
- # with open(filepath, encoding="utf-8") as f:
67
- # buffer = []
68
- # for key, row in enumerate(f):
69
- # data = json.loads(row)
70
- # buffer.append({"context":data["context"]})
71
- # for idx, dat in enumerate(buffer):
72
- # yield idx,dat
73
-
74
  def _generate_examples(self, filepath):
75
  with open(filepath, encoding="utf-8") as f:
 
76
  for key, row in enumerate(f):
77
  data = json.loads(row)
78
- if data["Category"] == self.config.name:
79
- yield key, data
 
 
 
 
 
 
 
 
 
62
  ),
63
  ]
64
 
 
 
 
 
 
 
 
 
 
65
  def _generate_examples(self, filepath):
66
  with open(filepath, encoding="utf-8") as f:
67
+ buffer = []
68
  for key, row in enumerate(f):
69
  data = json.loads(row)
70
+ buffer.append({"question":data["question"]})
71
+ for idx, dat in enumerate(buffer):
72
+ yield idx,dat
73
+
74
+ # def _generate_examples(self, filepath):
75
+ # with open(filepath, encoding="utf-8") as f:
76
+ # for key, row in enumerate(f):
77
+ # data = json.loads(row)
78
+ # if data["Category"] == self.config.name:
79
+ # yield key, data