Oleg Somov commited on
Commit
199a5db
1 Parent(s): 9c6f885

fix splits

Browse files
Files changed (1) hide show
  1. pauq.py +38 -25
pauq.py CHANGED
@@ -139,21 +139,13 @@ class Pauq(datasets.GeneratorBasedBuilder):
139
 
140
  def _split_generators(self, dl_manager):
141
  downloaded_filepath = dl_manager.download_and_extract(_URL)
142
-
143
- return [
144
- datasets.SplitGenerator(
145
- name=datasets.Split.TRAIN,
146
- gen_kwargs={
147
- "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/ru_iid_train.json"),
148
- },
149
- ),
150
- datasets.SplitGenerator(
151
- name=datasets.Split.TEST,
152
- gen_kwargs={
153
- "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/ru_iid_test.json"),
154
- },
155
- ),
156
- datasets.SplitGenerator(
157
  name=datasets.Split.TRAIN,
158
  gen_kwargs={
159
  "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/ru_tl_train.json"),
@@ -164,32 +156,53 @@ class Pauq(datasets.GeneratorBasedBuilder):
164
  gen_kwargs={
165
  "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/ru_tl_test.json"),
166
  },
167
- ),
168
- datasets.SplitGenerator(
 
 
 
169
  name=datasets.Split.TRAIN,
170
  gen_kwargs={
171
- "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/en_iid_train.json"),
172
  },
173
  ),
174
  datasets.SplitGenerator(
175
  name=datasets.Split.TEST,
176
  gen_kwargs={
177
- "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/en_iid_test.json"),
178
  },
179
- ),
180
- datasets.SplitGenerator(
 
 
181
  name=datasets.Split.TRAIN,
182
  gen_kwargs={
183
- "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/en_tl_train.json"),
184
  },
185
  ),
186
  datasets.SplitGenerator(
187
  name=datasets.Split.TEST,
188
  gen_kwargs={
189
- "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/en_tl_test.json"),
190
  },
191
- ),
192
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
  def _generate_examples(self, data_filepath):
195
  """This function returns the examples in the raw (text) form."""
 
139
 
140
  def _split_generators(self, dl_manager):
141
  downloaded_filepath = dl_manager.download_and_extract(_URL)
142
+
143
+ dataset_name = self.config.name
144
+
145
+ splits = []
146
+ if dataset_name == 'ru_pauq_tl':
147
+ splits = [
148
+ datasets.SplitGenerator(
 
 
 
 
 
 
 
 
149
  name=datasets.Split.TRAIN,
150
  gen_kwargs={
151
  "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/ru_tl_train.json"),
 
156
  gen_kwargs={
157
  "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/ru_tl_test.json"),
158
  },
159
+ )
160
+ ]
161
+ elif dataset_name == 'en_pauq_tl':
162
+ splits = [
163
+ datasets.SplitGenerator(
164
  name=datasets.Split.TRAIN,
165
  gen_kwargs={
166
+ "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/en_tl_train.json"),
167
  },
168
  ),
169
  datasets.SplitGenerator(
170
  name=datasets.Split.TEST,
171
  gen_kwargs={
172
+ "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/en_tl_test.json"),
173
  },
174
+ )]
175
+ elif dataset_name == 'ru_pauq_iid':
176
+ splits = [
177
+ datasets.SplitGenerator(
178
  name=datasets.Split.TRAIN,
179
  gen_kwargs={
180
+ "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/ru_iid_train.json"),
181
  },
182
  ),
183
  datasets.SplitGenerator(
184
  name=datasets.Split.TEST,
185
  gen_kwargs={
186
+ "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/ru_iid_test.json"),
187
  },
188
+ )
189
+ ]
190
+ elif dataset_name == 'en_pauq_iid':
191
+ splits = [
192
+ datasets.SplitGenerator(
193
+ name=datasets.Split.TRAIN,
194
+ gen_kwargs={
195
+ "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/en_iid_train.json"),
196
+ },
197
+ ),
198
+ datasets.SplitGenerator(
199
+ name=datasets.Split.TEST,
200
+ gen_kwargs={
201
+ "data_filepath": os.path.join(downloaded_filepath, "formatted_pauq/splits/en_iid_test.json"),
202
+ },
203
+ )
204
+ ]
205
+ return splits
206
 
207
  def _generate_examples(self, data_filepath):
208
  """This function returns the examples in the raw (text) form."""