Datasets:
Convert BIO tags to HuggingFace classes.
Browse files- MASSIVE.py +15 -8
- README.md +11 -13
MASSIVE.py
CHANGED
@@ -260,6 +260,8 @@ _SCENARIOS = ['social', 'transport', 'calendar', 'play', 'news', 'datetime', 're
|
|
260 |
|
261 |
_INTENTS = ['datetime_query', 'iot_hue_lightchange', 'transport_ticket', 'takeaway_query', 'qa_stock', 'general_greet', 'recommendation_events', 'music_dislikeness', 'iot_wemo_off', 'cooking_recipe', 'qa_currency', 'transport_traffic', 'general_quirky', 'weather_query', 'audio_volume_up', 'email_addcontact', 'takeaway_order', 'email_querycontact', 'iot_hue_lightup', 'recommendation_locations', 'play_audiobook', 'lists_createoradd', 'news_query', 'alarm_query', 'iot_wemo_on', 'general_joke', 'qa_definition', 'social_query', 'music_settings', 'audio_volume_other', 'calendar_remove', 'iot_hue_lightdim', 'calendar_query', 'email_sendemail', 'iot_cleaning', 'audio_volume_down', 'play_radio', 'cooking_query', 'datetime_convert', 'qa_maths', 'iot_hue_lightoff', 'iot_hue_lighton', 'transport_query', 'music_likeness', 'email_query', 'play_music', 'audio_volume_mute', 'social_post', 'alarm_set', 'qa_factoid', 'calendar_set', 'play_game', 'alarm_remove', 'lists_remove', 'transport_taxi', 'recommendation_movies', 'iot_coffee', 'music_query', 'play_podcasts', 'lists_query']
|
262 |
|
|
|
|
|
263 |
class MASSIVE(datasets.GeneratorBasedBuilder):
|
264 |
"""MASSIVE: A 1M-Example Multilingual Natural Language Understanding Dataset with 51 Typologically-Diverse Languages"""
|
265 |
|
@@ -285,10 +287,12 @@ class MASSIVE(datasets.GeneratorBasedBuilder):
|
|
285 |
"intent": datasets.features.ClassLabel(names=_INTENTS),
|
286 |
"utt": datasets.Value("string"),
|
287 |
"annot_utt": datasets.Value("string"),
|
288 |
-
"
|
289 |
-
|
290 |
-
|
291 |
-
|
|
|
|
|
292 |
"worker_id": datasets.Value("string"),
|
293 |
"slot_method": datasets.Sequence({
|
294 |
"slot": datasets.Value("string"),
|
@@ -343,7 +347,7 @@ class MASSIVE(datasets.GeneratorBasedBuilder):
|
|
343 |
|
344 |
def _getBioFormat(self, text):
|
345 |
|
346 |
-
tags,
|
347 |
|
348 |
bio_mode = False
|
349 |
cpt_bio = 0
|
@@ -386,9 +390,9 @@ class MASSIVE(datasets.GeneratorBasedBuilder):
|
|
386 |
word = s
|
387 |
|
388 |
tags.append(token)
|
389 |
-
|
390 |
|
391 |
-
return
|
392 |
|
393 |
def _generate_examples(self, filepath, split, lang):
|
394 |
|
@@ -436,6 +440,8 @@ class MASSIVE(datasets.GeneratorBasedBuilder):
|
|
436 |
else:
|
437 |
judgments = []
|
438 |
|
|
|
|
|
439 |
yield key_, {
|
440 |
"id": data["id"],
|
441 |
"locale": data["locale"],
|
@@ -444,7 +450,8 @@ class MASSIVE(datasets.GeneratorBasedBuilder):
|
|
444 |
"intent": data["intent"],
|
445 |
"utt": data["utt"],
|
446 |
"annot_utt": data["annot_utt"],
|
447 |
-
"
|
|
|
448 |
"worker_id": data["worker_id"],
|
449 |
"slot_method": slot_method,
|
450 |
"judgments": judgments,
|
|
|
260 |
|
261 |
_INTENTS = ['datetime_query', 'iot_hue_lightchange', 'transport_ticket', 'takeaway_query', 'qa_stock', 'general_greet', 'recommendation_events', 'music_dislikeness', 'iot_wemo_off', 'cooking_recipe', 'qa_currency', 'transport_traffic', 'general_quirky', 'weather_query', 'audio_volume_up', 'email_addcontact', 'takeaway_order', 'email_querycontact', 'iot_hue_lightup', 'recommendation_locations', 'play_audiobook', 'lists_createoradd', 'news_query', 'alarm_query', 'iot_wemo_on', 'general_joke', 'qa_definition', 'social_query', 'music_settings', 'audio_volume_other', 'calendar_remove', 'iot_hue_lightdim', 'calendar_query', 'email_sendemail', 'iot_cleaning', 'audio_volume_down', 'play_radio', 'cooking_query', 'datetime_convert', 'qa_maths', 'iot_hue_lightoff', 'iot_hue_lighton', 'transport_query', 'music_likeness', 'email_query', 'play_music', 'audio_volume_mute', 'social_post', 'alarm_set', 'qa_factoid', 'calendar_set', 'play_game', 'alarm_remove', 'lists_remove', 'transport_taxi', 'recommendation_movies', 'iot_coffee', 'music_query', 'play_podcasts', 'lists_query']
|
262 |
|
263 |
+
_TAGS = ['I-playlist_name', 'I-general_frequency', 'B-audiobook_name', 'I-player_setting', 'I-business_type', 'I-time', 'I-place_name', 'I-date', 'B-device_type', 'I-song_name', 'B-timeofday', 'B-movie_type', 'B-order_type', 'B-date', 'B-news_topic', 'I-music_descriptor', 'B-media_type', 'B-cooking_type', 'B-meal_type', 'I-movie_name', 'B-joke_type', 'I-media_type', 'B-list_name', 'I-podcast_descriptor', 'I-meal_type', 'I-transport_descriptor', 'I-transport_agency', 'B-player_setting', 'B-house_place', 'B-music_genre', 'I-timeofday', 'I-personal_info', 'I-definition_word', 'B-podcast_name', 'I-podcast_name', 'I-music_album', 'I-transport_type', 'B-business_name', 'B-transport_name', 'B-sport_type', 'I-house_place', 'I-movie_type', 'B-transport_descriptor', 'B-artist_name', 'O', 'I-email_folder', 'I-event_name', 'B-email_folder', 'I-cooking_type', 'B-music_album', 'I-coffee_type', 'I-alarm_type', 'B-game_type', 'I-audiobook_name', 'B-playlist_name', 'B-alarm_type', 'B-place_name', 'I-relation', 'B-drink_type', 'I-drink_type', 'I-business_name', 'I-artist_name', 'B-music_descriptor', 'B-change_amount', 'I-weather_descriptor', 'I-game_name', 'I-app_name', 'I-ingredient', 'B-song_name', 'B-weather_descriptor', 'I-email_address', 'B-time', 'B-color_type', 'B-food_type', 'I-person', 'B-transport_type', 'B-radio_name', 'I-change_amount', 'B-transport_agency', 'B-movie_name', 'B-general_frequency', 'B-event_name', 'I-joke_type', 'B-relation', 'B-coffee_type', 'I-order_type', 'B-email_address', 'B-app_name', 'B-podcast_descriptor', 'B-definition_word', 'I-list_name', 'B-audiobook_author', 'I-audiobook_author', 'I-sport_type', 'I-news_topic', 'B-personal_info', 'I-radio_name', 'B-person', 'I-color_type', 'I-food_type', 'I-device_type', 'B-time_zone', 'I-music_genre', 'B-business_type', 'B-currency_name', 'I-currency_name', 'B-ingredient', 'I-transport_name', 'B-game_name', 'I-time_zone']
|
264 |
+
|
265 |
class MASSIVE(datasets.GeneratorBasedBuilder):
|
266 |
"""MASSIVE: A 1M-Example Multilingual Natural Language Understanding Dataset with 51 Typologically-Diverse Languages"""
|
267 |
|
|
|
287 |
"intent": datasets.features.ClassLabel(names=_INTENTS),
|
288 |
"utt": datasets.Value("string"),
|
289 |
"annot_utt": datasets.Value("string"),
|
290 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
291 |
+
"ner_tags": datasets.Sequence(
|
292 |
+
datasets.features.ClassLabel(
|
293 |
+
names = _TAGS
|
294 |
+
)
|
295 |
+
),
|
296 |
"worker_id": datasets.Value("string"),
|
297 |
"slot_method": datasets.Sequence({
|
298 |
"slot": datasets.Value("string"),
|
|
|
347 |
|
348 |
def _getBioFormat(self, text):
|
349 |
|
350 |
+
tags, tokens = [], []
|
351 |
|
352 |
bio_mode = False
|
353 |
cpt_bio = 0
|
|
|
390 |
word = s
|
391 |
|
392 |
tags.append(token)
|
393 |
+
tokens.append(word)
|
394 |
|
395 |
+
return tokens, tags
|
396 |
|
397 |
def _generate_examples(self, filepath, split, lang):
|
398 |
|
|
|
440 |
else:
|
441 |
judgments = []
|
442 |
|
443 |
+
tokens, tags = self._getBioFormat(data["annot_utt"])
|
444 |
+
|
445 |
yield key_, {
|
446 |
"id": data["id"],
|
447 |
"locale": data["locale"],
|
|
|
450 |
"intent": data["intent"],
|
451 |
"utt": data["utt"],
|
452 |
"annot_utt": data["annot_utt"],
|
453 |
+
"tokens": tokens,
|
454 |
+
"ner_tags": tags,
|
455 |
"worker_id": data["worker_id"],
|
456 |
"slot_method": slot_method,
|
457 |
"judgments": judgments,
|
README.md
CHANGED
@@ -265,19 +265,17 @@ print(dataset[0])
|
|
265 |
"intent": 48,
|
266 |
"utt": "réveille-moi à neuf heures du matin le vendredi",
|
267 |
"annot_utt": "réveille-moi à [time : neuf heures du matin] le [date : vendredi]",
|
268 |
-
"
|
269 |
-
"
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
"tag": ["O", "O", "B-time", "I-time", "I-time", "I-time", "O", "B-date"]
|
280 |
-
},
|
281 |
"worker_id": "22",
|
282 |
"slot_method": {
|
283 |
"slot": ["time", "date"],
|
|
|
265 |
"intent": 48,
|
266 |
"utt": "réveille-moi à neuf heures du matin le vendredi",
|
267 |
"annot_utt": "réveille-moi à [time : neuf heures du matin] le [date : vendredi]",
|
268 |
+
"tokens": [
|
269 |
+
"réveille-moi",
|
270 |
+
"à",
|
271 |
+
"neuf",
|
272 |
+
"heures",
|
273 |
+
"du",
|
274 |
+
"matin",
|
275 |
+
"le",
|
276 |
+
"vendredi"
|
277 |
+
],
|
278 |
+
"ner_tags": [44, 44, 71, 5, 5, 5, 44, 13],
|
|
|
|
|
279 |
"worker_id": "22",
|
280 |
"slot_method": {
|
281 |
"slot": ["time", "date"],
|