harkon commited on
Commit
c7d466a
·
1 Parent(s): 36c00be

catch errors

Browse files
Files changed (1) hide show
  1. massive-dataset.py +328 -75
massive-dataset.py CHANGED
@@ -35,7 +35,59 @@ _CITATION = """
35
  }
36
  """
37
 
38
- _LANGUAGE_PAIRS = ['af-ZA', 'am-ET', 'ar-SA', 'az-AZ', 'bn-BD', 'cy-GB', 'da-DK', 'de-DE', 'el-GR', 'en-US', 'es-ES', 'fa-IR', 'fi-FI', 'fr-FR', 'he-IL', 'hi-IN', 'hu-HU', 'hy-AM', 'id-ID', 'is-IS', 'it-IT', 'ja-JP', 'jv-ID', 'ka-GE', 'km-KH', 'kn-IN', 'ko-KR', 'lv-LV', 'ml-IN', 'mn-MN', 'ms-MY', 'my-MM', 'nb-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ro-RO', 'ru-RU', 'sl-SL', 'sq-AL', 'sv-SE', 'sw-KE', 'ta-IN', 'te-IN', 'th-TH', 'tl-PH', 'tr-TR', 'ur-PK', 'vi-VN', 'zh-CN', 'zh-TW']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
 
41
  _DESCRIPTION = """
@@ -47,30 +99,227 @@ the SLURP dataset, composed of general Intelligent Voice Assistant single-shot i
47
 
48
  _URL = "https://github.com/timworks/massive-raw/raw/main/massive-raw.tar.gz"
49
 
50
- _SCENARIOS = ['calendar', 'recommendation', 'social', 'general', 'news', 'cooking', 'iot', 'email', 'weather', 'alarm', 'transport', 'lists', 'takeaway', 'play', 'audio', 'music', 'qa', 'datetime']
51
-
52
- _INTENTS = ['audio_volume_other', 'play_music', 'iot_hue_lighton', 'general_greet', 'calendar_set', 'audio_volume_down', 'social_query', 'audio_volume_mute', 'iot_wemo_on', 'iot_hue_lightup', 'audio_volume_up', 'iot_coffee', 'takeaway_query', 'qa_maths', 'play_game', 'cooking_query', 'iot_hue_lightdim', 'iot_wemo_off', 'music_settings', 'weather_query', 'news_query', 'alarm_remove', 'social_post', 'recommendation_events', 'transport_taxi', 'takeaway_order', 'music_query', 'calendar_query', 'lists_query', 'qa_currency', 'recommendation_movies', 'general_joke', 'recommendation_locations', 'email_querycontact', 'lists_remove', 'play_audiobook', 'email_addcontact', 'lists_createoradd', 'play_radio', 'qa_stock', 'alarm_query', 'email_sendemail', 'general_quirky', 'music_likeness', 'cooking_recipe', 'email_query', 'datetime_query', 'transport_traffic', 'play_podcasts', 'iot_hue_lightchange', 'calendar_remove', 'transport_query', 'transport_ticket', 'qa_factoid', 'iot_cleaning', 'alarm_set', 'datetime_convert', 'iot_hue_lightoff', 'qa_definition', 'music_dislikeness', 'email_summarize']
53
-
54
- _TAGS = ['O', 'B-food_type', 'B-movie_type', 'B-person', 'B-change_amount', 'I-relation', 'I-game_name', 'B-date', 'B-movie_name', 'I-person', 'I-place_name', 'I-podcast_descriptor', 'I-audiobook_name', 'B-email_folder', 'B-coffee_type', 'B-app_name', 'I-time', 'I-coffee_type', 'B-transport_agency', 'B-podcast_descriptor', 'I-playlist_name', 'B-media_type', 'B-song_name', 'I-music_descriptor', 'I-song_name', 'B-event_name', 'I-timeofday', 'B-alarm_type', 'B-cooking_type', 'I-business_name', 'I-color_type', 'B-podcast_name', 'I-personal_info', 'B-weather_descriptor', 'I-list_name', 'B-transport_descriptor', 'I-game_type', 'I-date', 'B-place_name', 'B-color_type', 'B-game_name', 'I-artist_name', 'I-drink_type', 'B-business_name', 'B-timeofday', 'B-sport_type', 'I-player_setting', 'I-transport_agency', 'B-game_type', 'B-player_setting', 'I-music_album', 'I-event_name', 'I-general_frequency', 'I-podcast_name', 'I-cooking_type', 'I-radio_name', 'I-joke_type', 'I-meal_type', 'I-transport_type', 'B-joke_type', 'B-time', 'B-order_type', 'B-business_type', 'B-general_frequency', 'I-food_type', 'I-time_zone', 'B-currency_name', 'B-time_zone', 'B-ingredient', 'B-house_place', 'B-audiobook_name', 'I-ingredient', 'I-media_type', 'I-news_topic', 'B-music_genre', 'I-definition_word', 'B-list_name', 'B-playlist_name', 'B-email_address', 'I-currency_name', 'I-movie_name', 'I-device_type', 'I-weather_descriptor', 'B-audiobook_author', 'I-audiobook_author', 'I-app_name', 'I-order_type', 'I-transport_name', 'B-radio_name', 'I-business_type', 'B-definition_word', 'B-artist_name', 'I-movie_type', 'B-transport_name', 'I-email_folder', 'B-music_album', 'I-house_place', 'I-music_genre', 'B-drink_type', 'I-alarm_type', 'B-music_descriptor', 'B-news_topic', 'B-meal_type', 'I-transport_descriptor', 'I-email_address', 'I-change_amount', 'B-device_type', 'B-transport_type', 'B-relation', 'I-sport_type', 'B-personal_info']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  _ALL = "all"
57
 
 
58
  class MassiveIntents(datasets.GeneratorBasedBuilder):
59
  """MASSIVE: A 1M-Example Multilingual Natural Language Understanding Dataset with 51 Typologically-Diverse Languages"""
60
 
61
  BUILDER_CONFIGS = [
62
  datasets.BuilderConfig(
63
- name = name,
64
- version = datasets.Version("1.0.0"),
65
- description = f"The MASSIVE corpora for {name}",
66
- ) for name in _LANGUAGE_PAIRS
 
67
  ]
68
 
69
- BUILDER_CONFIGS.append(datasets.BuilderConfig(
70
- name = _ALL,
71
- version = datasets.Version("1.0.0"),
72
- description = f"The MASSIVE corpora for entire corpus",
73
- ))
 
 
74
 
75
  DEFAULT_CONFIG_NAME = _ALL
76
 
@@ -88,23 +337,25 @@ class MassiveIntents(datasets.GeneratorBasedBuilder):
88
  "annot_utt": datasets.Value("string"),
89
  "tokens": datasets.Sequence(datasets.Value("string")),
90
  "ner_tags": datasets.Sequence(
91
- datasets.features.ClassLabel(
92
- names = _TAGS
93
- )
94
  ),
95
  "worker_id": datasets.Value("string"),
96
- "slot_method": datasets.Sequence({
97
- "slot": datasets.Value("string"),
98
- "method": datasets.Value("string"),
99
- }),
100
- "judgments": datasets.Sequence({
101
- "worker_id": datasets.Value("string"),
102
- "intent_score": datasets.Value("int8"), # [0, 1, 2]
103
- "slots_score": datasets.Value("int8"), # [0, 1, 2]
104
- "grammar_score": datasets.Value("int8"), # [0, 1, 2, 3, 4]
105
- "spelling_score": datasets.Value("int8"), # [0, 1, 2]
106
- "language_identification": datasets.Value("string"),
107
- }),
 
 
 
 
108
  },
109
  ),
110
  supervised_keys=None,
@@ -114,7 +365,6 @@ class MassiveIntents(datasets.GeneratorBasedBuilder):
114
  )
115
 
116
  def _split_generators(self, dl_manager):
117
-
118
  archive = dl_manager.download(_URL)
119
 
120
  return [
@@ -124,7 +374,7 @@ class MassiveIntents(datasets.GeneratorBasedBuilder):
124
  "files": dl_manager.iter_archive(archive),
125
  "split": "train",
126
  "lang": self.config.name,
127
- }
128
  ),
129
  datasets.SplitGenerator(
130
  name=datasets.Split.VALIDATION,
@@ -132,7 +382,7 @@ class MassiveIntents(datasets.GeneratorBasedBuilder):
132
  "files": dl_manager.iter_archive(archive),
133
  "split": "dev",
134
  "lang": self.config.name,
135
- }
136
  ),
137
  datasets.SplitGenerator(
138
  name=datasets.Split.TEST,
@@ -140,74 +390,74 @@ class MassiveIntents(datasets.GeneratorBasedBuilder):
140
  "files": dl_manager.iter_archive(archive),
141
  "split": "test",
142
  "lang": self.config.name,
143
- }
144
  ),
145
  ]
146
 
147
  def _getBioFormat(self, text):
148
-
149
  tags, tokens = [], []
150
 
151
  bio_mode = False
152
  cpt_bio = 0
153
  current_tag = None
154
-
155
- split_iter = iter(text.split(" "))
156
 
157
- for s in split_iter:
158
-
159
- if s.startswith("["):
160
- current_tag = s.strip("[")
161
- bio_mode = True
162
- cpt_bio += 1
163
- next(split_iter)
164
- continue
165
-
166
- elif s.endswith("]"):
167
- bio_mode = False
168
- if cpt_bio == 1:
169
- prefix = "B-"
170
- else:
171
- prefix = "I-"
172
- token = prefix + current_tag
173
- word = s.strip("]")
174
- current_tag = None
175
- cpt_bio = 0
176
-
177
- else:
178
 
179
- if bio_mode == True:
 
180
  if cpt_bio == 1:
181
  prefix = "B-"
182
  else:
183
  prefix = "I-"
184
  token = prefix + current_tag
185
- word = s
186
- cpt_bio += 1
 
 
187
  else:
188
- token = "O"
189
- word = s
190
-
191
- tags.append(token)
192
- tokens.append(word)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
  return tokens, tags
195
 
196
  def _generate_examples(self, files, split, lang):
197
-
198
  key_ = 0
199
 
200
  if lang == "all":
201
  lang = _LANGUAGE_PAIRS.copy()
202
  else:
203
  lang = [lang]
204
-
205
  logger.info("⏳ Generating examples from = %s", ", ".join(lang))
206
 
207
  for path, f in files:
208
-
209
  l = path.split("1.1/data/")[-1].split(".jsonl")[0]
210
-
211
  if not lang:
212
  break
213
  elif l in lang:
@@ -219,7 +469,6 @@ class MassiveIntents(datasets.GeneratorBasedBuilder):
219
  lines = f.read().decode(encoding="utf-8").split("\n")
220
 
221
  for line in lines:
222
-
223
  data = json.loads(line)
224
 
225
  if data["partition"] != split:
@@ -231,7 +480,8 @@ class MassiveIntents(datasets.GeneratorBasedBuilder):
231
  {
232
  "slot": s["slot"],
233
  "method": s["method"],
234
- } for s in data["slot_method"]
 
235
  ]
236
  else:
237
  slot_method = []
@@ -245,8 +495,11 @@ class MassiveIntents(datasets.GeneratorBasedBuilder):
245
  "slots_score": j["slots_score"],
246
  "grammar_score": j["grammar_score"],
247
  "spelling_score": j["spelling_score"],
248
- "language_identification": j["language_identification"] if "language_identification" in j else "target",
249
- } for j in data["judgments"]
 
 
 
250
  ]
251
  else:
252
  judgments = []
@@ -268,4 +521,4 @@ class MassiveIntents(datasets.GeneratorBasedBuilder):
268
  "judgments": judgments,
269
  }
270
 
271
- key_ += 1
 
35
  }
36
  """
37
 
38
+ _LANGUAGE_PAIRS = [
39
+ "af-ZA",
40
+ "am-ET",
41
+ "ar-SA",
42
+ "az-AZ",
43
+ "bn-BD",
44
+ "cy-GB",
45
+ "da-DK",
46
+ "de-DE",
47
+ "el-GR",
48
+ "en-US",
49
+ "es-ES",
50
+ "fa-IR",
51
+ "fi-FI",
52
+ "fr-FR",
53
+ "he-IL",
54
+ "hi-IN",
55
+ "hu-HU",
56
+ "hy-AM",
57
+ "id-ID",
58
+ "is-IS",
59
+ "it-IT",
60
+ "ja-JP",
61
+ "jv-ID",
62
+ "ka-GE",
63
+ "km-KH",
64
+ "kn-IN",
65
+ "ko-KR",
66
+ "lv-LV",
67
+ "ml-IN",
68
+ "mn-MN",
69
+ "ms-MY",
70
+ "my-MM",
71
+ "nb-NO",
72
+ "nl-NL",
73
+ "pl-PL",
74
+ "pt-PT",
75
+ "ro-RO",
76
+ "ru-RU",
77
+ "sl-SL",
78
+ "sq-AL",
79
+ "sv-SE",
80
+ "sw-KE",
81
+ "ta-IN",
82
+ "te-IN",
83
+ "th-TH",
84
+ "tl-PH",
85
+ "tr-TR",
86
+ "ur-PK",
87
+ "vi-VN",
88
+ "zh-CN",
89
+ "zh-TW",
90
+ ]
91
 
92
 
93
  _DESCRIPTION = """
 
99
 
100
  _URL = "https://github.com/timworks/massive-raw/raw/main/massive-raw.tar.gz"
101
 
102
+ _SCENARIOS = [
103
+ "calendar",
104
+ "recommendation",
105
+ "social",
106
+ "general",
107
+ "news",
108
+ "cooking",
109
+ "iot",
110
+ "email",
111
+ "weather",
112
+ "alarm",
113
+ "transport",
114
+ "lists",
115
+ "takeaway",
116
+ "play",
117
+ "audio",
118
+ "music",
119
+ "qa",
120
+ "datetime",
121
+ ]
122
+
123
+ _INTENTS = [
124
+ "audio_volume_other",
125
+ "play_music",
126
+ "iot_hue_lighton",
127
+ "general_greet",
128
+ "calendar_set",
129
+ "audio_volume_down",
130
+ "social_query",
131
+ "audio_volume_mute",
132
+ "iot_wemo_on",
133
+ "iot_hue_lightup",
134
+ "audio_volume_up",
135
+ "iot_coffee",
136
+ "takeaway_query",
137
+ "qa_maths",
138
+ "play_game",
139
+ "cooking_query",
140
+ "iot_hue_lightdim",
141
+ "iot_wemo_off",
142
+ "music_settings",
143
+ "weather_query",
144
+ "news_query",
145
+ "alarm_remove",
146
+ "social_post",
147
+ "recommendation_events",
148
+ "transport_taxi",
149
+ "takeaway_order",
150
+ "music_query",
151
+ "calendar_query",
152
+ "lists_query",
153
+ "qa_currency",
154
+ "recommendation_movies",
155
+ "general_joke",
156
+ "recommendation_locations",
157
+ "email_querycontact",
158
+ "lists_remove",
159
+ "play_audiobook",
160
+ "email_addcontact",
161
+ "lists_createoradd",
162
+ "play_radio",
163
+ "qa_stock",
164
+ "alarm_query",
165
+ "email_sendemail",
166
+ "general_quirky",
167
+ "music_likeness",
168
+ "cooking_recipe",
169
+ "email_query",
170
+ "datetime_query",
171
+ "transport_traffic",
172
+ "play_podcasts",
173
+ "iot_hue_lightchange",
174
+ "calendar_remove",
175
+ "transport_query",
176
+ "transport_ticket",
177
+ "qa_factoid",
178
+ "iot_cleaning",
179
+ "alarm_set",
180
+ "datetime_convert",
181
+ "iot_hue_lightoff",
182
+ "qa_definition",
183
+ "music_dislikeness",
184
+ "email_summarize",
185
+ ]
186
+
187
+ _TAGS = [
188
+ "O",
189
+ "B-food_type",
190
+ "B-movie_type",
191
+ "B-person",
192
+ "B-change_amount",
193
+ "I-relation",
194
+ "I-game_name",
195
+ "B-date",
196
+ "B-movie_name",
197
+ "I-person",
198
+ "I-place_name",
199
+ "I-podcast_descriptor",
200
+ "I-audiobook_name",
201
+ "B-email_folder",
202
+ "B-coffee_type",
203
+ "B-app_name",
204
+ "I-time",
205
+ "I-coffee_type",
206
+ "B-transport_agency",
207
+ "B-podcast_descriptor",
208
+ "I-playlist_name",
209
+ "B-media_type",
210
+ "B-song_name",
211
+ "I-music_descriptor",
212
+ "I-song_name",
213
+ "B-event_name",
214
+ "I-timeofday",
215
+ "B-alarm_type",
216
+ "B-cooking_type",
217
+ "I-business_name",
218
+ "I-color_type",
219
+ "B-podcast_name",
220
+ "I-personal_info",
221
+ "B-weather_descriptor",
222
+ "I-list_name",
223
+ "B-transport_descriptor",
224
+ "I-game_type",
225
+ "I-date",
226
+ "B-place_name",
227
+ "B-color_type",
228
+ "B-game_name",
229
+ "I-artist_name",
230
+ "I-drink_type",
231
+ "B-business_name",
232
+ "B-timeofday",
233
+ "B-sport_type",
234
+ "I-player_setting",
235
+ "I-transport_agency",
236
+ "B-game_type",
237
+ "B-player_setting",
238
+ "I-music_album",
239
+ "I-event_name",
240
+ "I-general_frequency",
241
+ "I-podcast_name",
242
+ "I-cooking_type",
243
+ "I-radio_name",
244
+ "I-joke_type",
245
+ "I-meal_type",
246
+ "I-transport_type",
247
+ "B-joke_type",
248
+ "B-time",
249
+ "B-order_type",
250
+ "B-business_type",
251
+ "B-general_frequency",
252
+ "I-food_type",
253
+ "I-time_zone",
254
+ "B-currency_name",
255
+ "B-time_zone",
256
+ "B-ingredient",
257
+ "B-house_place",
258
+ "B-audiobook_name",
259
+ "I-ingredient",
260
+ "I-media_type",
261
+ "I-news_topic",
262
+ "B-music_genre",
263
+ "I-definition_word",
264
+ "B-list_name",
265
+ "B-playlist_name",
266
+ "B-email_address",
267
+ "I-currency_name",
268
+ "I-movie_name",
269
+ "I-device_type",
270
+ "I-weather_descriptor",
271
+ "B-audiobook_author",
272
+ "I-audiobook_author",
273
+ "I-app_name",
274
+ "I-order_type",
275
+ "I-transport_name",
276
+ "B-radio_name",
277
+ "I-business_type",
278
+ "B-definition_word",
279
+ "B-artist_name",
280
+ "I-movie_type",
281
+ "B-transport_name",
282
+ "I-email_folder",
283
+ "B-music_album",
284
+ "I-house_place",
285
+ "I-music_genre",
286
+ "B-drink_type",
287
+ "I-alarm_type",
288
+ "B-music_descriptor",
289
+ "B-news_topic",
290
+ "B-meal_type",
291
+ "I-transport_descriptor",
292
+ "I-email_address",
293
+ "I-change_amount",
294
+ "B-device_type",
295
+ "B-transport_type",
296
+ "B-relation",
297
+ "I-sport_type",
298
+ "B-personal_info",
299
+ ]
300
 
301
  _ALL = "all"
302
 
303
+
304
  class MassiveIntents(datasets.GeneratorBasedBuilder):
305
  """MASSIVE: A 1M-Example Multilingual Natural Language Understanding Dataset with 51 Typologically-Diverse Languages"""
306
 
307
  BUILDER_CONFIGS = [
308
  datasets.BuilderConfig(
309
+ name=name,
310
+ version=datasets.Version("1.0.0"),
311
+ description=f"The MASSIVE corpora for {name}",
312
+ )
313
+ for name in _LANGUAGE_PAIRS
314
  ]
315
 
316
+ BUILDER_CONFIGS.append(
317
+ datasets.BuilderConfig(
318
+ name=_ALL,
319
+ version=datasets.Version("1.0.0"),
320
+ description=f"The MASSIVE corpora for entire corpus",
321
+ )
322
+ )
323
 
324
  DEFAULT_CONFIG_NAME = _ALL
325
 
 
337
  "annot_utt": datasets.Value("string"),
338
  "tokens": datasets.Sequence(datasets.Value("string")),
339
  "ner_tags": datasets.Sequence(
340
+ datasets.features.ClassLabel(names=_TAGS)
 
 
341
  ),
342
  "worker_id": datasets.Value("string"),
343
+ "slot_method": datasets.Sequence(
344
+ {
345
+ "slot": datasets.Value("string"),
346
+ "method": datasets.Value("string"),
347
+ }
348
+ ),
349
+ "judgments": datasets.Sequence(
350
+ {
351
+ "worker_id": datasets.Value("string"),
352
+ "intent_score": datasets.Value("int8"), # [0, 1, 2]
353
+ "slots_score": datasets.Value("int8"), # [0, 1, 2]
354
+ "grammar_score": datasets.Value("int8"), # [0, 1, 2, 3, 4]
355
+ "spelling_score": datasets.Value("int8"), # [0, 1, 2]
356
+ "language_identification": datasets.Value("string"),
357
+ }
358
+ ),
359
  },
360
  ),
361
  supervised_keys=None,
 
365
  )
366
 
367
  def _split_generators(self, dl_manager):
 
368
  archive = dl_manager.download(_URL)
369
 
370
  return [
 
374
  "files": dl_manager.iter_archive(archive),
375
  "split": "train",
376
  "lang": self.config.name,
377
+ },
378
  ),
379
  datasets.SplitGenerator(
380
  name=datasets.Split.VALIDATION,
 
382
  "files": dl_manager.iter_archive(archive),
383
  "split": "dev",
384
  "lang": self.config.name,
385
+ },
386
  ),
387
  datasets.SplitGenerator(
388
  name=datasets.Split.TEST,
 
390
  "files": dl_manager.iter_archive(archive),
391
  "split": "test",
392
  "lang": self.config.name,
393
+ },
394
  ),
395
  ]
396
 
397
  def _getBioFormat(self, text):
 
398
  tags, tokens = [], []
399
 
400
  bio_mode = False
401
  cpt_bio = 0
402
  current_tag = None
 
 
403
 
404
+ split_iter = iter(text.split(" "))
405
+ try:
406
+ for s in split_iter:
407
+ if s.startswith("["):
408
+ current_tag = s.strip("[")
409
+ bio_mode = True
410
+ cpt_bio += 1
411
+ next(split_iter)
412
+ continue
 
 
 
 
 
 
 
 
 
 
 
 
413
 
414
+ elif s.endswith("]"):
415
+ bio_mode = False
416
  if cpt_bio == 1:
417
  prefix = "B-"
418
  else:
419
  prefix = "I-"
420
  token = prefix + current_tag
421
+ word = s.strip("]")
422
+ current_tag = None
423
+ cpt_bio = 0
424
+
425
  else:
426
+ if bio_mode == True:
427
+ if cpt_bio == 1:
428
+ prefix = "B-"
429
+ else:
430
+ prefix = "I-"
431
+ token = prefix + current_tag
432
+ word = s
433
+ cpt_bio += 1
434
+ else:
435
+ token = "O"
436
+ word = s
437
+
438
+ tags.append(token)
439
+ tokens.append(word)
440
+ except Exception as e:
441
+ print(e)
442
+ print(text)
443
+ print(tags)
444
+ print(tokens)
445
 
446
  return tokens, tags
447
 
448
  def _generate_examples(self, files, split, lang):
 
449
  key_ = 0
450
 
451
  if lang == "all":
452
  lang = _LANGUAGE_PAIRS.copy()
453
  else:
454
  lang = [lang]
455
+
456
  logger.info("⏳ Generating examples from = %s", ", ".join(lang))
457
 
458
  for path, f in files:
 
459
  l = path.split("1.1/data/")[-1].split(".jsonl")[0]
460
+
461
  if not lang:
462
  break
463
  elif l in lang:
 
469
  lines = f.read().decode(encoding="utf-8").split("\n")
470
 
471
  for line in lines:
 
472
  data = json.loads(line)
473
 
474
  if data["partition"] != split:
 
480
  {
481
  "slot": s["slot"],
482
  "method": s["method"],
483
+ }
484
+ for s in data["slot_method"]
485
  ]
486
  else:
487
  slot_method = []
 
495
  "slots_score": j["slots_score"],
496
  "grammar_score": j["grammar_score"],
497
  "spelling_score": j["spelling_score"],
498
+ "language_identification": j["language_identification"]
499
+ if "language_identification" in j
500
+ else "target",
501
+ }
502
+ for j in data["judgments"]
503
  ]
504
  else:
505
  judgments = []
 
521
  "judgments": judgments,
522
  }
523
 
524
+ key_ += 1