gabrielaltay commited on
Commit
11716e7
1 Parent(s): 8146982
Files changed (1) hide show
  1. hacdc-wikipedia.py +3 -6
hacdc-wikipedia.py CHANGED
@@ -141,7 +141,7 @@ class HacdcWikimedia20220901(datasets.GeneratorBasedBuilder):
141
 
142
  def _split_generators(self, dl_manager):
143
 
144
- paths = [os.path.join("data", filename) for filename in _FILES[0:3]]
145
  downloaded_files = dl_manager.download_and_extract(paths)
146
  return [
147
  datasets.SplitGenerator(name="every", gen_kwargs={"filepaths": downloaded_files}),
@@ -159,11 +159,8 @@ class HacdcWikimedia20220901(datasets.GeneratorBasedBuilder):
159
  for filepath in filepaths:
160
  logger.info("generating examples from = %s", filepath)
161
  with open(filepath, "r") as fp:
162
- lines = [line.strip() for line in fp.readlines()]
163
- big_string = '[{}]'.format(','.join(lines))
164
- datas = orjson.loads(big_string)
165
- for data in datas:
166
- #data = orjson.loads(line)
167
 
168
  if self.config.name == "all":
169
  yield _id, data
 
141
 
142
  def _split_generators(self, dl_manager):
143
 
144
+ paths = [os.path.join("data", filename) for filename in _FILES]
145
  downloaded_files = dl_manager.download_and_extract(paths)
146
  return [
147
  datasets.SplitGenerator(name="every", gen_kwargs={"filepaths": downloaded_files}),
 
159
  for filepath in filepaths:
160
  logger.info("generating examples from = %s", filepath)
161
  with open(filepath, "r") as fp:
162
+ for line in fp:
163
+ data = orjson.loads(line)
 
 
 
164
 
165
  if self.config.name == "all":
166
  yield _id, data