Muennighoff commited on
Commit
1ce71aa
1 Parent(s): a195d8d

Update multi_eurlex.py

Browse files
Files changed (1) hide show
  1. multi_eurlex.py +34 -4
multi_eurlex.py CHANGED
@@ -8186,6 +8186,32 @@ _CONCEPTS = {
8186
  ],
8187
  }
8188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8189
 
8190
  class MultiEURLEXConfig(datasets.BuilderConfig):
8191
  """BuilderConfig for MultiEURLEX."""
@@ -8254,8 +8280,10 @@ class MultiEURLEX(datasets.GeneratorBasedBuilder):
8254
  features = datasets.Features(
8255
  {
8256
  "celex_id": datasets.Value("string"),
8257
- "x1": datasets.Value("string"),
8258
- "x2": datasets.Value("string"),
 
 
8259
  "labels": datasets.features.Sequence(
8260
  datasets.ClassLabel(names=_CONCEPTS[self.config.label_level])
8261
  ),
@@ -8317,8 +8345,10 @@ class MultiEURLEX(datasets.GeneratorBasedBuilder):
8317
  data = json.loads(row)
8318
  yield id_, {
8319
  "celex_id": data["celex_id"],
8320
- "x1": data["text"][lang1],
8321
- "x2": data["text"][lang2],
 
 
8322
  "labels": data["eurovoc_concepts"][self.config.label_level],
8323
  }
8324
  else:
 
8186
  ],
8187
  }
8188
 
8189
+ CODE_TO_LANG = {
8190
+ 'en': 'English',
8191
+ 'de': 'German',
8192
+ 'fr': 'French',
8193
+ 'it': 'Italian',
8194
+ 'es': 'Spanish',
8195
+ 'pl': 'Polish',
8196
+ 'ro': 'Romanian',
8197
+ 'nl': 'Dutch',
8198
+ 'el': 'Greek',
8199
+ 'hu': 'Hungarian',
8200
+ 'pt': 'Portuguese',
8201
+ 'cs': 'Czech',
8202
+ 'sv': 'Swedish',
8203
+ 'bg': 'Bulgarian',
8204
+ 'da': 'Danish',
8205
+ 'fi': 'Finnish',
8206
+ 'sk': 'Slovak',
8207
+ 'lt': 'Lithuanian',
8208
+ 'hr': 'Croatian',
8209
+ 'sl': 'Slovene',
8210
+ 'et': 'Estonian',
8211
+ 'lv': 'Latvian',
8212
+ 'mt': 'Maltese'
8213
+ }
8214
+
8215
 
8216
  class MultiEURLEXConfig(datasets.BuilderConfig):
8217
  """BuilderConfig for MultiEURLEX."""
 
8280
  features = datasets.Features(
8281
  {
8282
  "celex_id": datasets.Value("string"),
8283
+ "l1_name": datasets.Value("string"),
8284
+ "l2_name": datasets.Value("string"),
8285
+ "l1": datasets.Value("string"),
8286
+ "l2": datasets.Value("string"),
8287
  "labels": datasets.features.Sequence(
8288
  datasets.ClassLabel(names=_CONCEPTS[self.config.label_level])
8289
  ),
 
8345
  data = json.loads(row)
8346
  yield id_, {
8347
  "celex_id": data["celex_id"],
8348
+ "l1_name": CODE_TO_LANG[lang1],
8349
+ "l2_name": CODE_TO_LANG[lang2],
8350
+ "l1": data["text"][lang1],
8351
+ "l2": data["text"][lang2],
8352
  "labels": data["eurovoc_concepts"][self.config.label_level],
8353
  }
8354
  else: