colbertv2 commited on
Commit
9c4dbc5
·
1 Parent(s): 234295c

Update lotte_passages.py

Browse files
Files changed (1) hide show
  1. lotte_passages.py +15 -37
lotte_passages.py CHANGED
@@ -1,5 +1,4 @@
1
 
2
-
3
  # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
4
  #
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,6 +23,7 @@ import os
24
  import datasets
25
  import pandas as pd
26
  import zipfile
 
27
 
28
 
29
  # TODO: Add BibTeX citation
@@ -165,12 +165,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
165
 
166
  first_row = True
167
 
168
- with open(filepath, encoding="utf-8") as f:
169
-
170
- #rows = f.readlines()
171
-
172
- #print("Row count")
173
- #print(len(rows))
174
 
175
  for key, row in enumerate(f):
176
  #for row in rows:
@@ -179,46 +174,29 @@ class NewDataset(datasets.GeneratorBasedBuilder):
179
 
180
  for i in range(0, len(data)):
181
 
182
- if len(data) == 268880: #lifestyle dev
183
- current_query = {"doc_id": 0, "author": "Julie Baumler", "text": "In my experience rabbits are very easy to housebreak. They like to pee and poop in the same place every time, so in most cases all you have to do is put a little bit of their waste in the litter box and they will happily use the litter box. It is very important that if they go somewhere else, miss the edge or kick waste out of the box that you clean it up well and immediately as otherwise those spots will become existing places to pee and poop. When you clean the box, save a little bit of waste and put it in the cleaned box so it smells right to them. For a more foolproof method, you can get a piece of wood soaked with their urine and put that in the box along with droppings or cage them so that they are only in their litter box for a week. Generally, if I try the first method and find that they are not using only the box on the first day, I go for the litter box only for a week method. The wood block works well if you are moving from a hutch outdoors to a litter box indoors. If you have an indoor cage, you can use the cage itself as the litter box (or attach a litter box to the section of the cage the rabbit has used for waste.) Be sure to use clay or newsprint litter as the other types aren't necessarily good for rabbits. Wood litter is okay if you are sure it isn't fir. The most important thing is to clean anywhere they have an accident. High sided boxes help with avoiding kicking soiled litter out of the box, which is the biggest cause of failure in my experience."}
184
- elif len(data) == 119458: #lifestyle test
185
- current_query = {"doc_id": 0, "author": "forefinger", "text": "Normal double-acting baking powder makes CO2 (thus giving a rising effect) in two ways: when it gets wet, and when it is heated. Baking soda only makes CO2 when it gets wet. From Wikipedia: The acid in a baking powder can be either fast-acting or slow-acting.[6] A fast-acting acid reacts in a wet mixture with baking soda at room temperature, and a slow-acting acid will not react until heated in an oven. Baking powders that contain both fast- and slow-acting acids are double acting; those that contain only one acid are single acting. By providing a second rise in the oven, double-acting baking powders increase the reliability of baked goods by rendering the time elapsed between mixing and baking less critical, and this is the type most widely available to consumers today."}
186
- elif len(data) == 1276179:
187
- current_query = {"doc_id": 0, "author": "Travis", "text": "You definitely need some sort of software to filter out the noise. Some of the other answers here can address that. If you're still doing the recordings and need to stop the cell phone interference, use ferrite beads near the base of each speaker. By the way, just in case anyone is curious, these can be used for small desktop speakers, too."}
188
- elif len(data) == 638504:
189
- current_query = {"doc_id": 0, "author": "DougC", "text": "One option would be to clone your startup drive to an external disk using something like SuperDuper! or Carbon Copy Cloner. Then you can use System Preferences->Startup Disk to select that external drive as the boot drive. Once you've rebooted and are running the system off the external drive you can use Disk Utility to run the repair. After you're done, re-select the internal drive as the Startup Disk and reboot."}
190
- elif len(data) == 277056:
191
- current_query = {"doc_id": 0, "author": "Liam W", "text": "A native speaker would interpret them as having the same meaning. You could say \"I'm ill,\" or you could say \"I'm sick\". \"I'm ill\" could be classed as more formal language."}
192
- elif len(data) == 199954:
193
- current_query = {"doc_id": 0, "author": "Peter Eisentraut", "text": "It's the fifth element after earth, air, fire, and water, so it is presumably superior to those or completing those."}
194
- elif len(data) == 263021:
195
- current_query = {"doc_id": 0, "author": "Rixius", "text": "Multiclassing no longer takes an XP hit, and your favored class gives you one of two bonuses at every level: +1 hp +1 skill point Advanced Players Guide add other options for specific Race/Class combos"}
196
- elif len(data) == 166966:
197
- current_query = {"doc_id": 0, "author": "lavonardo", "text": "No, you can fight the sword master without knowing all the comebacks. It's all a matter of luck which insults she throws at you."}
198
- elif len(data) == 343623:
199
- current_query = {"doc_id": 0, "author": "LeakyBattery", "text": "As you move from left to right across a period, the number of protons in the nucleus increases. The electrons are thus attracted to the nucleus more strongly, and the atomic radius is smaller (this attraction is much stronger than the relatively weak repulsion between electrons). As you move down a column, there are more protons, but there are also more complete energy levels below the valence electrons. These lower energy levels shield the valence electrons from the attractive effects of the atom's nucleus, so the atomic radius gets larger."}
200
- elif len(data) == 1694040:
201
- current_query = {"doc_id": 0, "author": "Simon Nickerson", "text": "More or Less is a BBC Radio 4 programme about maths and statistics in the news, and there is a free podcast. It's presented by Tim Harford, the Undercover Economist from the Financial Times."}
202
- elif len(data) == 2428763:
203
- current_query = {"doc_id": 0, "author": "", "text": "A native speaker would interpret them as having the same meaning. You could say \"I'm ill,\" or you could say \"I'm sick\". \"I'm ill\" could be classed as more formal language."}
204
- elif len(data) == 2818926:
205
- current_query = {"doc_id": 0, "author": "", "text": "It's the fifth element after earth, air, fire, and water, so it is presumably superior to those or completing those."}
206
 
207
- ########################################################
208
 
209
- if first_row:
 
 
 
 
210
  if "author" in current_query.keys():
211
  author = current_query['author']
212
  else:
213
  author = ""
214
 
215
- yield i, {
216
  "doc_id": current_query["doc_id"],
217
  "author": author,
218
  "text": current_query["text"]
219
  }
220
- first_row = False
221
-
222
 
223
  ########################################################
224
 
@@ -229,7 +207,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
229
  else:
230
  author = ""
231
 
232
- yield (i + 1), {
233
  "doc_id": current_query["doc_id"],
234
  "author": author,
235
  "text": current_query["text"]
 
1
 
 
2
  # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
  #
4
  # Licensed under the Apache License, Version 2.0 (the "License");
 
23
  import datasets
24
  import pandas as pd
25
  import zipfile
26
+ import ast
27
 
28
 
29
  # TODO: Add BibTeX citation
 
165
 
166
  first_row = True
167
 
168
+ with open(filepath, 'r', encoding="utf-8") as f:
 
 
 
 
 
169
 
170
  for key, row in enumerate(f):
171
  #for row in rows:
 
174
 
175
  for i in range(0, len(data)):
176
 
177
+ current_index = i
178
+ if len(data) == 268880 or len(data) == 119458:
179
+ current_index = i + 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
 
181
+ if first_row and (len(data) == 268880 or len(data) == 119458):
182
 
183
+ if len(data) == 268880: #lifestyle dev
184
+ current_query = {"doc_id": 0, "author": "Julie Baumler", "text": "In my experience rabbits are very easy to housebreak. They like to pee and poop in the same place every time, so in most cases all you have to do is put a little bit of their waste in the litter box and they will happily use the litter box. It is very important that if they go somewhere else, miss the edge or kick waste out of the box that you clean it up well and immediately as otherwise those spots will become existing places to pee and poop. When you clean the box, save a little bit of waste and put it in the cleaned box so it smells right to them. For a more foolproof method, you can get a piece of wood soaked with their urine and put that in the box along with droppings or cage them so that they are only in their litter box for a week. Generally, if I try the first method and find that they are not using only the box on the first day, I go for the litter box only for a week method. The wood block works well if you are moving from a hutch outdoors to a litter box indoors. If you have an indoor cage, you can use the cage itself as the litter box (or attach a litter box to the section of the cage the rabbit has used for waste.) Be sure to use clay or newsprint litter as the other types aren't necessarily good for rabbits. Wood litter is okay if you are sure it isn't fir. The most important thing is to clean anywhere they have an accident. High sided boxes help with avoiding kicking soiled litter out of the box, which is the biggest cause of failure in my experience."}
185
+ elif len(data) == 119458: #lifestyle test
186
+ current_query = {"doc_id": 0, "author": "forefinger", "text": "Normal double-acting baking powder makes CO2 (thus giving a rising effect) in two ways: when it gets wet, and when it is heated. Baking soda only makes CO2 when it gets wet. From Wikipedia: The acid in a baking powder can be either fast-acting or slow-acting.[6] A fast-acting acid reacts in a wet mixture with baking soda at room temperature, and a slow-acting acid will not react until heated in an oven. Baking powders that contain both fast- and slow-acting acids are double acting; those that contain only one acid are single acting. By providing a second rise in the oven, double-acting baking powders increase the reliability of baked goods by rendering the time elapsed between mixing and baking less critical, and this is the type most widely available to consumers today."}
187
+
188
  if "author" in current_query.keys():
189
  author = current_query['author']
190
  else:
191
  author = ""
192
 
193
+ yield current_index, {
194
  "doc_id": current_query["doc_id"],
195
  "author": author,
196
  "text": current_query["text"]
197
  }
198
+
199
+ first_row = False
200
 
201
  ########################################################
202
 
 
207
  else:
208
  author = ""
209
 
210
+ yield current_index, {
211
  "doc_id": current_query["doc_id"],
212
  "author": author,
213
  "text": current_query["text"]