Felix
commited on
Commit
•
496fde2
1
Parent(s):
4ab2261
alphabetize task names
Browse files- superlim-2.py +99 -120
superlim-2.py
CHANGED
@@ -117,16 +117,16 @@ _TASKS = {
|
|
117 |
"absabank-imm": "absabank-imm",
|
118 |
"argumentation_sent":"argumentation-sentences",
|
119 |
"dalaj-ged": "dalaj-ged-superlim",
|
120 |
-
"swesim_relatedness": "supersim-superlim-relatedness",
|
121 |
-
"swesim_similarity": "supersim-superlim-similarity",
|
122 |
"sweana": "sweanalogy",
|
|
|
|
|
123 |
"swefaq": "swefaq",
|
|
|
124 |
"swepar": "sweparaphrase",
|
125 |
"swesat": "swesat-synonyms",
|
126 |
-
"
|
127 |
-
"
|
128 |
-
"
|
129 |
-
"swediagnostics": "swediagnostics"
|
130 |
}
|
131 |
|
132 |
class SuperLimConfig(datasets.BuilderConfig):
|
@@ -166,36 +166,44 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
166 |
|
167 |
BUILDER_CONFIGS = [
|
168 |
datasets.BuilderConfig(name="absabank-imm", version=VERSION, description=_DaLAJ_DESCRIPTION),
|
|
|
169 |
datasets.BuilderConfig(name="dalaj-ged", version=VERSION, description=_DaLAJ_DESCRIPTION),
|
170 |
-
datasets.BuilderConfig(name="swesim_relatedness", version=VERSION, description=_SweSim_DESCRIPTION),
|
171 |
-
datasets.BuilderConfig(name="swesim_similarity", version=VERSION, description=_SweSim_DESCRIPTION),
|
172 |
datasets.BuilderConfig(name="sweana", version=VERSION, description=_SweAna_DESCRIPTION),
|
|
|
|
|
173 |
datasets.BuilderConfig(name="swefaq", version=VERSION, description=_SweFaq_DESCRIPTION),
|
|
|
174 |
datasets.BuilderConfig(name="swepar", version=VERSION, description=_SwePar_DESCRIPTION),
|
175 |
datasets.BuilderConfig(name="swesat", version=VERSION, description=_SweSat_DESCRIPTION),
|
176 |
-
datasets.BuilderConfig(name="
|
177 |
-
datasets.BuilderConfig(name="
|
178 |
-
datasets.BuilderConfig(name="
|
179 |
-
datasets.BuilderConfig(name="swemnli", version=VERSION, description=_SweMNLI_DESCRIPTION),
|
180 |
-
datasets.BuilderConfig(name="swediagnostics", version=VERSION, description=_SweDiag_DESCRIPTION)
|
181 |
]
|
182 |
|
183 |
def _info(self):
|
184 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
185 |
-
if self.config.name ==
|
186 |
features = datasets.Features(
|
187 |
{
|
188 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
"label": datasets.Value("string"),
|
190 |
-
"
|
191 |
}
|
192 |
)
|
193 |
-
elif self.config.name ==
|
194 |
features = datasets.Features(
|
195 |
{
|
196 |
-
"
|
197 |
-
"
|
198 |
-
"
|
199 |
}
|
200 |
)
|
201 |
elif self.config.name == "sweana":
|
@@ -208,6 +216,29 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
208 |
"category": datasets.Value("string"),
|
209 |
}
|
210 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
elif self.config.name == "swefaq":
|
212 |
features = datasets.Features(
|
213 |
{
|
@@ -218,6 +249,15 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
218 |
"meta": datasets.Value("string"),
|
219 |
}
|
220 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
elif self.config.name == "swepar":
|
222 |
features = datasets.Features(
|
223 |
{
|
@@ -263,46 +303,6 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
263 |
"label": datasets.Value("string"),
|
264 |
"meta": datasets.Value("string"),
|
265 |
}
|
266 |
-
)
|
267 |
-
elif self.config.name == 'argumentation_sent':
|
268 |
-
features = datasets.Features(
|
269 |
-
{
|
270 |
-
"topic": datasets.Value("string"),
|
271 |
-
"label": datasets.Value("string"),
|
272 |
-
"sentence": datasets.Value("string")
|
273 |
-
}
|
274 |
-
)
|
275 |
-
elif self.config.name == 'swemnli':
|
276 |
-
features = datasets.Features(
|
277 |
-
{
|
278 |
-
"id": datasets.Value("string"),
|
279 |
-
"premise": datasets.Value("string"),
|
280 |
-
"hypothesis": datasets.Value("string"),
|
281 |
-
"label": datasets.Value("string")
|
282 |
-
}
|
283 |
-
)
|
284 |
-
elif self.config.name == 'swediagnostics':
|
285 |
-
features = datasets.Features(
|
286 |
-
{
|
287 |
-
'lexical_semantics': datasets.Value("string"),
|
288 |
-
'predicate_argument_structure': datasets.Value("string"),
|
289 |
-
'logic': datasets.Value("string"),
|
290 |
-
'knowledge': datasets.Value("string"),
|
291 |
-
'domain': datasets.Value("string"),
|
292 |
-
'premise': datasets.Value("string"),
|
293 |
-
'hypothesis': datasets.Value("string"),
|
294 |
-
'label':datasets.Value("string")
|
295 |
-
}
|
296 |
-
)
|
297 |
-
elif self.config.name == 'swedn':
|
298 |
-
features = datasets.Features(
|
299 |
-
{
|
300 |
-
"id": datasets.Value("string"),
|
301 |
-
"headline": datasets.Value("string"),
|
302 |
-
"summary": datasets.Value("string"),
|
303 |
-
"article": datasets.Value("string"),
|
304 |
-
"article_category": datasets.Value("string")
|
305 |
-
}
|
306 |
)
|
307 |
else:
|
308 |
raise ValueError(f"Subset {self.config.name} does not exist.")
|
@@ -362,18 +362,24 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
362 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
363 |
df = pd.read_json(filepath, lines=True)
|
364 |
for key, row in df.iterrows():
|
365 |
-
if self.config.name == "
|
366 |
-
# Yields examples as (key, example) tuples
|
367 |
yield key, {
|
368 |
-
"
|
|
|
369 |
"label": row["label"],
|
370 |
-
"meta": row["meta"],
|
371 |
}
|
372 |
-
elif self.config.name == "
|
373 |
yield key, {
|
374 |
-
"
|
375 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
"label": row["label"],
|
|
|
377 |
}
|
378 |
elif self.config.name == "sweana":
|
379 |
yield key, {
|
@@ -383,6 +389,25 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
383 |
"pair2_element2": row["pair2_element2"],
|
384 |
"category": row["category"],
|
385 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
elif self.config.name == "swefaq":
|
387 |
yield key, {
|
388 |
"category_id": row['category_id'],
|
@@ -391,6 +416,13 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
391 |
"label": row["label"],
|
392 |
"meta": row['meta'],
|
393 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
elif self.config.name == "swepar":
|
395 |
yield key, {
|
396 |
"genre": row["genre"],
|
@@ -419,12 +451,6 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
419 |
"word_2": row["word_2"],
|
420 |
"label": row["label"],
|
421 |
}
|
422 |
-
elif self.config.name == "swewgr":
|
423 |
-
yield key, {
|
424 |
-
"text": row["text"],
|
425 |
-
"challenge": row["challenge"],
|
426 |
-
"responses": row["responses"],
|
427 |
-
}
|
428 |
elif self.config.name == "swewic":
|
429 |
yield key, {
|
430 |
"idx": row["idx"],
|
@@ -433,52 +459,5 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
433 |
"label": row["label"],
|
434 |
"meta": row["meta"],
|
435 |
}
|
436 |
-
elif self.config.name == "swewsc":
|
437 |
-
yield key, {
|
438 |
-
"passage": row["passage"],
|
439 |
-
"challenge_text": row["challenge_text"],
|
440 |
-
"response_text": row["response_text"],
|
441 |
-
"challenge_begin":row["challenge_begin"],
|
442 |
-
"challenge_end":row["challenge_end"],
|
443 |
-
"response_begin":row["response_begin"],
|
444 |
-
"response_end":row["response_end"],
|
445 |
-
"label":row["label"],
|
446 |
-
}
|
447 |
-
|
448 |
-
elif self.config.name == "argumentation_sent":
|
449 |
-
yield key, {
|
450 |
-
"topic": row["topic"],
|
451 |
-
"label": row["label"],
|
452 |
-
"sentence" : row["sentence"],
|
453 |
-
}
|
454 |
-
|
455 |
-
elif self.config.name == "swediagnostics":
|
456 |
-
yield key, {
|
457 |
-
'lexical_semantics': row['lexical_semantics'],
|
458 |
-
'predicate_argument_structure': row['predicate_argument_structure'],
|
459 |
-
'logic': row['logic'],
|
460 |
-
'knowledge': row['knowledge'],
|
461 |
-
'domain': row['domain'],
|
462 |
-
'premise': row['premise'],
|
463 |
-
'hypothesis': row['hypothesis'],
|
464 |
-
'label': row['label']
|
465 |
-
}
|
466 |
-
|
467 |
-
elif self.config.name == "swemnli":
|
468 |
-
yield key, {
|
469 |
-
'id': row['id'],
|
470 |
-
'premise': row['premise'],
|
471 |
-
'hypothesis': row['hypothesis'],
|
472 |
-
'label': row['label']
|
473 |
-
}
|
474 |
-
|
475 |
-
elif self.config.name == "swedn":
|
476 |
-
yield key, {
|
477 |
-
'id': row['id'],
|
478 |
-
'headline': row['headline'],
|
479 |
-
'summary': row['summary'],
|
480 |
-
'article': row['article'],
|
481 |
-
'article_category': row['article_category']
|
482 |
-
}
|
483 |
else:
|
484 |
raise ValueError(f"Subset {self.config.name} does not exist")
|
|
|
117 |
"absabank-imm": "absabank-imm",
|
118 |
"argumentation_sent":"argumentation-sentences",
|
119 |
"dalaj-ged": "dalaj-ged-superlim",
|
|
|
|
|
120 |
"sweana": "sweanalogy",
|
121 |
+
"swediagnostics": "swediagnostics",
|
122 |
+
"swedn": "swedn",
|
123 |
"swefaq": "swefaq",
|
124 |
+
"swemnli": "swemnli",
|
125 |
"swepar": "sweparaphrase",
|
126 |
"swesat": "swesat-synonyms",
|
127 |
+
"swesim_relatedness": "supersim-superlim-relatedness",
|
128 |
+
"swesim_similarity": "supersim-superlim-similarity",
|
129 |
+
"swewic": "swewic"
|
|
|
130 |
}
|
131 |
|
132 |
class SuperLimConfig(datasets.BuilderConfig):
|
|
|
166 |
|
167 |
BUILDER_CONFIGS = [
|
168 |
datasets.BuilderConfig(name="absabank-imm", version=VERSION, description=_DaLAJ_DESCRIPTION),
|
169 |
+
datasets.BuilderConfig(name="argumentation_sent", version=VERSION, description=_argumentation_sentences_DESCRIPTION),
|
170 |
datasets.BuilderConfig(name="dalaj-ged", version=VERSION, description=_DaLAJ_DESCRIPTION),
|
|
|
|
|
171 |
datasets.BuilderConfig(name="sweana", version=VERSION, description=_SweAna_DESCRIPTION),
|
172 |
+
datasets.BuilderConfig(name="swediagnostics", version=VERSION, description=_SweDiag_DESCRIPTION),
|
173 |
+
datasets.BuilderConfig(name="swedn", version=VERSION, description=_SweDN_DESCRIPTION),
|
174 |
datasets.BuilderConfig(name="swefaq", version=VERSION, description=_SweFaq_DESCRIPTION),
|
175 |
+
datasets.BuilderConfig(name="swemnli", version=VERSION, description=_SweMNLI_DESCRIPTION),
|
176 |
datasets.BuilderConfig(name="swepar", version=VERSION, description=_SwePar_DESCRIPTION),
|
177 |
datasets.BuilderConfig(name="swesat", version=VERSION, description=_SweSat_DESCRIPTION),
|
178 |
+
datasets.BuilderConfig(name="swesim_relatedness", version=VERSION, description=_SweSim_DESCRIPTION),
|
179 |
+
datasets.BuilderConfig(name="swesim_similarity", version=VERSION, description=_SweSim_DESCRIPTION),
|
180 |
+
datasets.BuilderConfig(name="swewic", version=VERSION, description=_SweWic_DESCRIPTION)
|
|
|
|
|
181 |
]
|
182 |
|
183 |
def _info(self):
|
184 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
185 |
+
if self.config.name == 'absabank-imm': # This is the name of the configuration selected in BUILDER_CONFIGS above
|
186 |
features = datasets.Features(
|
187 |
{
|
188 |
+
"id": datasets.Value("string"),
|
189 |
+
"text": datasets.Value("string"),
|
190 |
+
"label": datasets.Value(dtype='float32')
|
191 |
+
}
|
192 |
+
)
|
193 |
+
elif self.config.name == 'argumentation_sent':
|
194 |
+
features = datasets.Features(
|
195 |
+
{
|
196 |
+
"topic": datasets.Value("string"),
|
197 |
"label": datasets.Value("string"),
|
198 |
+
"sentence": datasets.Value("string")
|
199 |
}
|
200 |
)
|
201 |
+
elif self.config.name == "dalaj-ged":
|
202 |
features = datasets.Features(
|
203 |
{
|
204 |
+
"sentence": datasets.Value("string"),
|
205 |
+
"label": datasets.Value("string"),
|
206 |
+
"meta": datasets.Value("string")
|
207 |
}
|
208 |
)
|
209 |
elif self.config.name == "sweana":
|
|
|
216 |
"category": datasets.Value("string"),
|
217 |
}
|
218 |
)
|
219 |
+
elif self.config.name == 'swediagnostics':
|
220 |
+
features = datasets.Features(
|
221 |
+
{
|
222 |
+
'lexical_semantics': datasets.Value("string"),
|
223 |
+
'predicate_argument_structure': datasets.Value("string"),
|
224 |
+
'logic': datasets.Value("string"),
|
225 |
+
'knowledge': datasets.Value("string"),
|
226 |
+
'domain': datasets.Value("string"),
|
227 |
+
'premise': datasets.Value("string"),
|
228 |
+
'hypothesis': datasets.Value("string"),
|
229 |
+
'label':datasets.Value("string")
|
230 |
+
}
|
231 |
+
)
|
232 |
+
elif self.config.name == 'swedn':
|
233 |
+
features = datasets.Features(
|
234 |
+
{
|
235 |
+
"id": datasets.Value("string"),
|
236 |
+
"headline": datasets.Value("string"),
|
237 |
+
"summary": datasets.Value("string"),
|
238 |
+
"article": datasets.Value("string"),
|
239 |
+
"article_category": datasets.Value("string")
|
240 |
+
}
|
241 |
+
)
|
242 |
elif self.config.name == "swefaq":
|
243 |
features = datasets.Features(
|
244 |
{
|
|
|
249 |
"meta": datasets.Value("string"),
|
250 |
}
|
251 |
)
|
252 |
+
elif self.config.name == 'swemnli':
|
253 |
+
features = datasets.Features(
|
254 |
+
{
|
255 |
+
"id": datasets.Value("string"),
|
256 |
+
"premise": datasets.Value("string"),
|
257 |
+
"hypothesis": datasets.Value("string"),
|
258 |
+
"label": datasets.Value("string")
|
259 |
+
}
|
260 |
+
)
|
261 |
elif self.config.name == "swepar":
|
262 |
features = datasets.Features(
|
263 |
{
|
|
|
303 |
"label": datasets.Value("string"),
|
304 |
"meta": datasets.Value("string"),
|
305 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
)
|
307 |
else:
|
308 |
raise ValueError(f"Subset {self.config.name} does not exist.")
|
|
|
362 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
363 |
df = pd.read_json(filepath, lines=True)
|
364 |
for key, row in df.iterrows():
|
365 |
+
if self.config.name == "absabank-imm":
|
|
|
366 |
yield key, {
|
367 |
+
"id": row['id'],
|
368 |
+
"text": row["text"],
|
369 |
"label": row["label"],
|
|
|
370 |
}
|
371 |
+
elif self.config.name == "argumentation_sent":
|
372 |
yield key, {
|
373 |
+
"topic": row["topic"],
|
374 |
+
"label": row["label"],
|
375 |
+
"sentence" : row["sentence"],
|
376 |
+
}
|
377 |
+
elif self.config.name == "dalaj-ged":
|
378 |
+
# Yields examples as (key, example) tuples
|
379 |
+
yield key, {
|
380 |
+
"sentence": row["sentence"],
|
381 |
"label": row["label"],
|
382 |
+
"meta": row["meta"],
|
383 |
}
|
384 |
elif self.config.name == "sweana":
|
385 |
yield key, {
|
|
|
389 |
"pair2_element2": row["pair2_element2"],
|
390 |
"category": row["category"],
|
391 |
}
|
392 |
+
elif self.config.name == "swediagnostics":
|
393 |
+
yield key, {
|
394 |
+
'lexical_semantics': row['lexical_semantics'],
|
395 |
+
'predicate_argument_structure': row['predicate_argument_structure'],
|
396 |
+
'logic': row['logic'],
|
397 |
+
'knowledge': row['knowledge'],
|
398 |
+
'domain': row['domain'],
|
399 |
+
'premise': row['premise'],
|
400 |
+
'hypothesis': row['hypothesis'],
|
401 |
+
'label': row['label']
|
402 |
+
}
|
403 |
+
elif self.config.name == "swedn":
|
404 |
+
yield key, {
|
405 |
+
'id': row['id'],
|
406 |
+
'headline': row['headline'],
|
407 |
+
'summary': row['summary'],
|
408 |
+
'article': row['article'],
|
409 |
+
'article_category': row['article_category']
|
410 |
+
}
|
411 |
elif self.config.name == "swefaq":
|
412 |
yield key, {
|
413 |
"category_id": row['category_id'],
|
|
|
416 |
"label": row["label"],
|
417 |
"meta": row['meta'],
|
418 |
}
|
419 |
+
elif self.config.name == "swemnli":
|
420 |
+
yield key, {
|
421 |
+
'id': row['id'],
|
422 |
+
'premise': row['premise'],
|
423 |
+
'hypothesis': row['hypothesis'],
|
424 |
+
'label': row['label']
|
425 |
+
}
|
426 |
elif self.config.name == "swepar":
|
427 |
yield key, {
|
428 |
"genre": row["genre"],
|
|
|
451 |
"word_2": row["word_2"],
|
452 |
"label": row["label"],
|
453 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
elif self.config.name == "swewic":
|
455 |
yield key, {
|
456 |
"idx": row["idx"],
|
|
|
459 |
"label": row["label"],
|
460 |
"meta": row["meta"],
|
461 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
else:
|
463 |
raise ValueError(f"Subset {self.config.name} does not exist")
|