davebulaval commited on
Commit
ba920fe
1 Parent(s): 8026157

Upload riscbac.py

Browse files
Files changed (1) hide show
  1. riscbac.py +7 -8
riscbac.py CHANGED
@@ -89,7 +89,7 @@ class RISCBAC(datasets.GeneratorBasedBuilder):
89
  datasets.SplitGenerator(
90
  name=datasets.Split.TRAIN,
91
  gen_kwargs={
92
- "files_dir_path": os.path.join(data_dir, "en"),
93
  "split": "full",
94
  },
95
  )
@@ -99,15 +99,14 @@ class RISCBAC(datasets.GeneratorBasedBuilder):
99
  datasets.SplitGenerator(
100
  name=datasets.Split.TRAIN,
101
  gen_kwargs={
102
- "files_dir_path": os.path.join(data_dir, "fr"),
103
  "split": "full",
104
  },
105
  ),
106
  ]
107
 
108
- def _generate_examples(self, files_dir_path, split):
109
- files = os.listdir(files_dir_path)
110
- for key, file in enumerate(files):
111
- with open(os.path.join(files_dir_path, file), "r", encoding="utf-8") as f:
112
- text = "".join(f.readlines()).strip()
113
- yield key, {"text": text}
 
89
  datasets.SplitGenerator(
90
  name=datasets.Split.TRAIN,
91
  gen_kwargs={
92
+ "filepath": os.path.join(data_dir, "en", "en.jsonl"),
93
  "split": "full",
94
  },
95
  )
 
99
  datasets.SplitGenerator(
100
  name=datasets.Split.TRAIN,
101
  gen_kwargs={
102
+ "filepath": os.path.join(data_dir, "fr", "fr.jsonl"),
103
  "split": "full",
104
  },
105
  ),
106
  ]
107
 
108
+ def _generate_examples(self, filepath, split):
109
+ with open(filepath, "r", encoding="utf-8") as f:
110
+ for key, line in enumerate(f):
111
+ d = json.loads(line)
112
+ yield key, {"text": d}