colbertv2 commited on
Commit
de4333d
·
1 Parent(s): f371112

Update lotte_passages.py

Browse files
Files changed (1) hide show
  1. lotte_passages.py +16 -20
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(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,34 +225,30 @@ class NewDataset(datasets.GeneratorBasedBuilder):
225
 
226
  ###########################################################################
227
 
228
- if i + 1 not in [119593, 119594, 119595, 119596, 119597]:
229
-
230
- if first_row:
231
- if "author" in current_query.keys():
232
- author = current_query['author']
233
- else:
234
- author = ""
235
-
236
- yield i, {
237
- "doc_id": current_query["doc_id"],
238
- "author": author,
239
- "text": current_query["text"]
240
- }
241
- first_row = False
242
-
243
- current_query = data[i]
244
-
245
  if "author" in current_query.keys():
246
  author = current_query['author']
247
  else:
248
  author = ""
249
-
250
  yield i + 1, {
251
  "doc_id": current_query["doc_id"],
252
  "author": author,
253
  "text": current_query["text"]
254
  }
255
 
 
 
 
 
 
 
 
 
 
 
 
 
256
 
257
 
258
 
 
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(-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
 
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
+
242
+ if "author" in current_query.keys():
243
+ author = current_query['author']
244
+ else:
245
+ author = ""
246
+
247
+ yield i + 1, {
248
+ "doc_id": current_query["doc_id"] + 1,
249
+ "author": author,
250
+ "text": current_query["text"]
251
+ }
252
 
253
 
254