mariosasko commited on
Commit
8dda700
1 Parent(s): e23c8d3

Make RedCaps streamable (again) (#3737)

Browse files

Commit from https://github.com/huggingface/datasets/commit/5f52561f6c35d4e3ccad87ff949a729b34d2d0d2

Files changed (1) hide show
  1. newsqa.py +4 -5
newsqa.py CHANGED
@@ -244,7 +244,7 @@ class Newsqa(datasets.GeneratorBasedBuilder):
244
  _ = next(csv_reader)
245
  for id_, row in enumerate(csv_reader):
246
  if row:
247
- yield row[0], {
248
  "story_id": row[0],
249
  "story_text": row[-1],
250
  "question": row[1],
@@ -256,7 +256,7 @@ class Newsqa(datasets.GeneratorBasedBuilder):
256
  d = json.load(f)
257
  data = d["data"]
258
 
259
- for iter in data:
260
 
261
  questions = []
262
 
@@ -306,7 +306,7 @@ class Newsqa(datasets.GeneratorBasedBuilder):
306
  dict1["validated_answers"] = validated_answers
307
  questions.append(dict1)
308
 
309
- yield iter["storyId"], {
310
  "storyId": iter["storyId"],
311
  "text": iter["text"],
312
  "type": iter["type"],
@@ -321,8 +321,7 @@ class Newsqa(datasets.GeneratorBasedBuilder):
321
  _ = next(csv_reader)
322
  for id_, row in enumerate(csv_reader):
323
  if row:
324
- # print (row)
325
- yield row[0], {
326
  "story_id": row[0],
327
  "story_text": row[1],
328
  "question": row[2],
 
244
  _ = next(csv_reader)
245
  for id_, row in enumerate(csv_reader):
246
  if row:
247
+ yield id_, {
248
  "story_id": row[0],
249
  "story_text": row[-1],
250
  "question": row[1],
 
256
  d = json.load(f)
257
  data = d["data"]
258
 
259
+ for id_, iter in enumerate(data):
260
 
261
  questions = []
262
 
 
306
  dict1["validated_answers"] = validated_answers
307
  questions.append(dict1)
308
 
309
+ yield id_, {
310
  "storyId": iter["storyId"],
311
  "text": iter["text"],
312
  "type": iter["type"],
 
321
  _ = next(csv_reader)
322
  for id_, row in enumerate(csv_reader):
323
  if row:
324
+ yield id_, {
 
325
  "story_id": row[0],
326
  "story_text": row[1],
327
  "question": row[2],