colbertv2 commited on
Commit
7511d3a
·
1 Parent(s): 093d023

Update lotte_passages.py

Browse files
Files changed (1) hide show
  1. lotte_passages.py +5 -7
lotte_passages.py CHANGED
@@ -164,7 +164,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
164
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
165
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
166
 
167
- #first_row = True
168
 
169
  with open(filepath, 'r', encoding="utf-8") as f:
170
 
@@ -190,7 +190,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
190
 
191
  else:
192
 
193
- for i in range(-1, len(data)):
194
 
195
  assert len(data) == 268880 or len(data) == 119458 or len(data) == 2428763 or len(data) == 2818926 #lifestyle and pooled bug
196
 
@@ -225,17 +225,18 @@ class NewDataset(datasets.GeneratorBasedBuilder):
225
 
226
  ###########################################################################
227
 
228
- if i == -1:
229
  if "author" in current_query.keys():
230
  author = current_query['author']
231
  else:
232
  author = ""
233
 
234
- yield i + 1, {
235
  "doc_id": current_query["doc_id"],
236
  "author": author,
237
  "text": current_query["text"]
238
  }
 
239
 
240
  current_query = data[i]
241
 
@@ -250,6 +251,3 @@ class NewDataset(datasets.GeneratorBasedBuilder):
250
  "text": current_query["text"]
251
  }
252
 
253
-
254
-
255
-
 
164
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
165
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
166
 
167
+ first_row = True
168
 
169
  with open(filepath, 'r', encoding="utf-8") as f:
170
 
 
190
 
191
  else:
192
 
193
+ for i in range(0, len(data)):
194
 
195
  assert len(data) == 268880 or len(data) == 119458 or len(data) == 2428763 or len(data) == 2818926 #lifestyle and pooled bug
196
 
 
225
 
226
  ###########################################################################
227
 
228
+ if first_row:
229
  if "author" in current_query.keys():
230
  author = current_query['author']
231
  else:
232
  author = ""
233
 
234
+ yield i, {
235
  "doc_id": current_query["doc_id"],
236
  "author": author,
237
  "text": current_query["text"]
238
  }
239
+ first_row = False
240
 
241
  current_query = data[i]
242
 
 
251
  "text": current_query["text"]
252
  }
253