jfrenz commited on
Commit
536bc16
1 Parent(s): e55c633

split generator test

Browse files
Files changed (1) hide show
  1. legalglue.py +36 -38
legalglue.py CHANGED
@@ -158,49 +158,47 @@ class LegalGLUE(datasets.GeneratorBasedBuilder):
158
  name=datasets.Split.TRAIN,
159
  # These kwargs will be passed to _generate_examples
160
  gen_kwargs={
161
- "filepath": self.config.data_files,
162
  "split": "train",
163
- "archive": archive,
164
  },
165
  )
166
- else:
167
- return [
168
- datasets.SplitGenerator(
169
- name=datasets.Split.TRAIN,
170
- # These kwargs will be passed to _generate_examples
171
- gen_kwargs={
172
- "filepath": self.config.data_files,
173
- "split": "train",
174
- "files": dl_manager.iter_archive(archive),
175
- },
176
- ),
177
- datasets.SplitGenerator(
178
- name=datasets.Split.TEST,
179
- # These kwargs will be passed to _generate_examples
180
- gen_kwargs={
181
- "filepath": self.config.data_files,
182
- "split": "test",
183
- "files": dl_manager.iter_archive(archive),
184
- },
185
- ),
186
- datasets.SplitGenerator(
187
- name=datasets.Split.VALIDATION,
188
- # These kwargs will be passed to _generate_examples
189
- gen_kwargs={
190
- "filepath": self.config.data_files,
191
- "split": "validation",
192
- "files": dl_manager.iter_archive(archive),
193
- },
194
- ),
195
- ]
196
-
197
- def _generate_examples(self, filepath, split, archive):
198
  if self.config_name == "german_ler":
199
-
200
  texts, labels = [], []
201
- for file in filepath:
202
- path = os.path.join(archive,file)
203
- with open (path, encoding="utf-8") as f:
204
  tokens = []
205
  tags = []
206
  for line in f:
 
158
  name=datasets.Split.TRAIN,
159
  # These kwargs will be passed to _generate_examples
160
  gen_kwargs={
161
+ "filepath": [os.path.join(archive, file) for file in self.config.data_files],
162
  "split": "train",
163
+ #"files": dl_manager.iter_archive(archive),
164
  },
165
  )
166
+ # else:
167
+ # return [
168
+ # datasets.SplitGenerator(
169
+ # name=datasets.Split.TRAIN,
170
+ # # These kwargs will be passed to _generate_examples
171
+ # gen_kwargs={
172
+ # "filepath": self.config.data_files,
173
+ # "split": "train",
174
+ # "files": dl_manager.iter_archive(archive),
175
+ # },
176
+ # ),
177
+ # datasets.SplitGenerator(
178
+ # name=datasets.Split.TEST,
179
+ # # These kwargs will be passed to _generate_examples
180
+ # gen_kwargs={
181
+ # "filepath": self.config.data_files,
182
+ # "split": "test",
183
+ # "files": dl_manager.iter_archive(archive),
184
+ # },
185
+ # ),
186
+ # datasets.SplitGenerator(
187
+ # name=datasets.Split.VALIDATION,
188
+ # # These kwargs will be passed to _generate_examples
189
+ # gen_kwargs={
190
+ # "filepath": self.config.data_files,
191
+ # "split": "validation",
192
+ # "files": dl_manager.iter_archive(archive),
193
+ # },
194
+ # ),
195
+ # ]
196
+
197
+ def _generate_examples(self, filepath, split):
198
  if self.config_name == "german_ler":
 
199
  texts, labels = [], []
200
+ for path in filepath:
201
+ with open(path, encoding="utf-8") as f:
 
202
  tokens = []
203
  tags = []
204
  for line in f: