Datasets:
Commit ·
b1cec41
1
Parent(s): 74792d6
add custom loading script
Browse files- README.md +16 -0
- leyzer-fedcsis-translated.py +229 -0
README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-classification
|
| 5 |
+
language:
|
| 6 |
+
- pl
|
| 7 |
+
tags:
|
| 8 |
+
- natural-language-understanding
|
| 9 |
+
size_categories:
|
| 10 |
+
- 10K<n<100K
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Leyzer: A Dataset for Multilingual Virtual Assistants
|
| 14 |
+
Leyzer is a multilingual text corpus designed to study multilingual and cross-lingual natural language understanding (NLU) models and the strategies of localization of
|
| 15 |
+
virtual assistants. It consists of 20 domains across three languages: English, Spanish and Polish, with 186 intents and a wide range of samples, ranging from 1 to 672
|
| 16 |
+
sentences per intent. For more stats please refer to wiki.
|
leyzer-fedcsis-translated.py
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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leyzer"""
|
| 4 |
+
|
| 5 |
+
import json
|
| 6 |
+
import datasets
|
| 7 |
+
import pandas as pd
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
_DESCRIPTION = """\
|
| 11 |
+
Leyzer is a multilingual text corpus designed to study multilingual and cross-lingual natural language
|
| 12 |
+
understanding (NLU) models and the strategies of localization of virtual assistants. It consists of 20
|
| 13 |
+
domains across three languages: English, Spanish and Polish, with 186 intents and a wide range of
|
| 14 |
+
samples, ranging from 1 to 672 sentences per intent.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
_CITATION = """\
|
| 18 |
+
@inproceedings{sowanski2020leyzer,
|
| 19 |
+
title={Leyzer: A Dataset for Multilingual Virtual Assistants},
|
| 20 |
+
author={Sowa{\'n}ski, Marcin and Janicki, Artur},
|
| 21 |
+
booktitle={International Conference on Text, Speech, and Dialogue},
|
| 22 |
+
pages={477--486},
|
| 23 |
+
year={2020},
|
| 24 |
+
organization={Springer}
|
| 25 |
+
}
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
_LICENSE = """\
|
| 29 |
+
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
_URL = "https://github.com/cartesinus/leyzer/raw/0.2.0/corpora/0.2.0/leyzer-0.2.0-fedcsis_translated.tar.gz"
|
| 33 |
+
|
| 34 |
+
_LANGUAGES = ['pl-PL']
|
| 35 |
+
|
| 36 |
+
_DOMAINS = ['Airconditioner', 'Calendar', 'Console', 'Contacts', 'Email', 'Facebook', 'Fitbit',
|
| 37 |
+
'Gdrive', 'Instagram', 'News', 'Phone', 'Slack', 'Speaker', 'Spotify', 'Translate',
|
| 38 |
+
'Twitter', 'Weather', 'Websearch', 'Wikipedia', 'Yelp', 'Youtube']
|
| 39 |
+
|
| 40 |
+
_INTENTS = ["AddAlbumToPlaylist", "AddEventOnDateWithName", "AddEventWithName",
|
| 41 |
+
"AddSongToPlaylist", "AddSongToPlaylistWithName", "AddSongWithNameToPlaylistWithName",
|
| 42 |
+
"AddWeight", "CallContact", "CallEmergency", "CallNumber", "ChangeLanguageToLanguage",
|
| 43 |
+
"ChangeTemperature", "CheckCalendarEventName", "CheckCalendarOnDate", "CheckChannelHistory",
|
| 44 |
+
"CheckLastMessages", "CheckMessagesFromUser", "CheckMessagesInChannel",
|
| 45 |
+
"CheckUserStatus", "ConsoleCD", "ConsoleCP", "ConsoleEdit", "ConsoleLS",
|
| 46 |
+
"ConsoleMV", "ConsoleRM", "CreateContactWithNameAndWithNumberAndWithType",
|
| 47 |
+
"CreateFile", "CreateFileWithName", "CreatePlaylist", "CreatePlaylistWithName",
|
| 48 |
+
"DecreaseVolume", "DecreaseVolumeByPercent", "DetectLanguage", "DownloadAsPdf",
|
| 49 |
+
"EditContactWithName", "EditContactWithNumber", "EditNumberInContactWithName",
|
| 50 |
+
"EditNumberInContactWithNameToNumberAndToType", "FindChannelWithQuery",
|
| 51 |
+
"FindQuery", "FindQueryOnChannel", "FollowUser", "GetHumidity", "GetTemperature",
|
| 52 |
+
"GetTemperatureFromDevice", "GoToElementNumber", "IncreaseVolume",
|
| 53 |
+
"IncreaseVolumeByPercent", "MoonphaseInLocation", "MoonphaseInLocationOnDate",
|
| 54 |
+
"MuteOff", "MuteOn", "NextSong", "NextVideo", "NotifyOnEventInLocation",
|
| 55 |
+
"NotifyOnEventStart", "NotifyOnNewFromFollowing", "NotifyOnWeight", "NotifyWhenEventNameStart",
|
| 56 |
+
"NotifyWhenPortalUpdates", "NotifyWhenPortalUpdatesInSection", "NotNotifyOnEventInLocation",
|
| 57 |
+
"NotNotifyOnEventStart", "OpenCalendar", "OpenContacts", "OpenEmail", "OpenEngine",
|
| 58 |
+
"OpenFacebook", "OpenFileWithName", "OpenGdrive", "OpenInstagram", "OpenMyContact",
|
| 59 |
+
"OpenRestaurants", "OpenRestaurantsInLocation", "OpenSlack", "OpenSpotify",
|
| 60 |
+
"OpenTwitter", "OpenWeather", "OpenWikipedia", "OpenYT", "Pause",
|
| 61 |
+
"PlayAlbumOfTypeByArtist", "PlayPlaylist", "PlaySong", "PlaySongByArtist",
|
| 62 |
+
"PostPicture", "PostPictureWithCaption", "PostPictureWithUrl",
|
| 63 |
+
"PostPictureWithUrlAndWithCaption", "PostStatus", "PostWithLastPictureWithLocationAndWithHashtag",
|
| 64 |
+
"PostWithPicturesFromDateAndWithLocation", "PreviousSong", "RandomPage",
|
| 65 |
+
"RepeatOnOff", "ReplyToEmailFromAddress", "ScrollDown", "ScrollUp",
|
| 66 |
+
"SearchByCategory", "SearchByCategoryInLocation", "SearchByQuery",
|
| 67 |
+
"SearchByQueryInLocation", "SearchByRating", "SearchByRatingInLocation",
|
| 68 |
+
"SearchByReviewCount", "SearchByReviewCountInLocation", "SearchImagesOnEngine",
|
| 69 |
+
"SearchImagesWithTextOnEngine", "SearchImagesWithTextOnEngineWithWidthAndWithHeight",
|
| 70 |
+
"SearchImagesWithTextOnEngineWithWidthAndWithHeightAndWithCondition", "SearchInLocation", "SearchQuery",
|
| 71 |
+
"SearchRestaurant", "SearchText", "SearchTextOnEngine", "SeekByTime", "SendEmail",
|
| 72 |
+
"SendEmailToAddress", "SendEmailToAddressWithSubject", "SendEmailToAddressWithSubjectAndWithMessage",
|
| 73 |
+
"SendMessageToChannel", "SendMessageToUser", "SendPictureToChannel", "SendPictureToChannelWithCaption",
|
| 74 |
+
"SendPictureWithUrlToChannel", "SendSlackMessage", "SendTwitterMessage", "SetDefaultLanguage",
|
| 75 |
+
"SetDefaultLanguageToLanguage", "SetPurposeOnChannel", "SetStatusAway", "SetTemperatureBetweenValues",
|
| 76 |
+
"SetTemperatureOnDevice", "SetTemperatureToValue", "SetTemperatureToValueOnDevice", "SetTopicInChannel",
|
| 77 |
+
"ShareFileWithNameToAddress", "ShowAlbumWithName", "ShowBMI", "ShowChannelWithCategory",
|
| 78 |
+
"ShowChannelWithName", "ShowContactWithEmail", "ShowContactWithName", "ShowContactWithNumber",
|
| 79 |
+
"ShowContactWithNumberAndWithEmail", "ShowDanceability", "ShowEmailFromSender", "ShowEmailFromTime",
|
| 80 |
+
"ShowEmailWithLabel", "ShowEmailWithPriority", "ShowEmailWithSubject", "ShowFilesFromTime",
|
| 81 |
+
"ShowFilesWithSize", "ShowFilesWithStar", "ShowFilesWithType", "ShowLastNumberPictures",
|
| 82 |
+
"ShowNewestFiles", "ShowNews", "ShowNewsFromSection", "ShowOldestFiles", "ShowPictures",
|
| 83 |
+
"ShowPicturesFromDate", "ShowPicturesWithFilter", "ShowPicturesWithHashtag",
|
| 84 |
+
"ShowPicturesWithLocation", "ShowSMS", "ShowSteps", "ShowStepsOnDate", "ShowSubscribedChannels",
|
| 85 |
+
"ShowTwittsWithHashtag", "ShuffleOnOff", "SMSToContact", "SMSToContactWithMessage",
|
| 86 |
+
"SortAlphabetical", "SortReverseAlphabetical", "SunriseAndSunsetInLocation",
|
| 87 |
+
"SunriseAndSunsetInLocationAndOnDate", "SunriseInLocation", "SunsetInLocation",
|
| 88 |
+
"TakePicture", "TranslateText", "TranslateTextFromLanguage", "TranslateTextFromLanguageToLanguage",
|
| 89 |
+
"TranslateTextFromLanguageToLanguageWithEngine", "TranslateTextToLanguage",
|
| 90 |
+
"TranslateToLanguage", "TurnOff", "TurnOn", "TurnOnOrOff", "UnfollowUser",
|
| 91 |
+
"WeatherInLocation", "WeatherTomorrow", "WeatherTomorrowInLocation",
|
| 92 |
+
"NotifyOnNewOnChannel"
|
| 93 |
+
]
|
| 94 |
+
|
| 95 |
+
_LEVELS = ['L0TC', 'L1TC', 'L2TC', 'REPHRASE']
|
| 96 |
+
|
| 97 |
+
_VPS = ['verb_pattern_01', 'verb_pattern_02', 'verb_pattern_03', 'verb_pattern_04',
|
| 98 |
+
'verb_pattern_05', 'verb_pattern_06', 'verb_pattern_07', 'verb_pattern_08',
|
| 99 |
+
'verb_pattern_09', 'verb_pattern_10', 'verb_pattern_11', 'verb_pattern_12', 'verb_pattern_13']
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class LeyzerConfig(datasets.BuilderConfig):
|
| 103 |
+
"""BuilderConfig for Leyzer."""
|
| 104 |
+
|
| 105 |
+
def __init__(self, dataset_version=None, *args, **kwargs):
|
| 106 |
+
"""BuilderConfig for Leyzer.
|
| 107 |
+
Args:
|
| 108 |
+
**kwargs: keyword arguments forwarded to super.
|
| 109 |
+
"""
|
| 110 |
+
super(LeyzerConfig, self).__init__(*args, **kwargs)
|
| 111 |
+
self.dataset_version = dataset_version if dataset_version else "1.0"
|
| 112 |
+
self.data_url = _URL
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
class Leyzer(datasets.GeneratorBasedBuilder):
|
| 116 |
+
"""Leyzer"""
|
| 117 |
+
|
| 118 |
+
# All individual locale datasets are served from the latest version.
|
| 119 |
+
BUILDER_CONFIGS = [
|
| 120 |
+
LeyzerConfig(
|
| 121 |
+
name = name,
|
| 122 |
+
dataset_version = '0.2.0',
|
| 123 |
+
version = datasets.Version("0.2.0"),
|
| 124 |
+
description = f"The Leyzer v0.2.0 corpora for {name}",
|
| 125 |
+
) for name in _LANGUAGES
|
| 126 |
+
]
|
| 127 |
+
# Version 1.0
|
| 128 |
+
BUILDER_CONFIGS.append(LeyzerConfig(
|
| 129 |
+
name = "all",
|
| 130 |
+
dataset_version = '0.2.0',
|
| 131 |
+
version = datasets.Version("0.2.0"),
|
| 132 |
+
description = f"The Leyzer v0.2.0 corpora for entire corpus",
|
| 133 |
+
)
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
DEFAULT_CONFIG_NAME = "all"
|
| 137 |
+
|
| 138 |
+
def _info(self):
|
| 139 |
+
return datasets.DatasetInfo(
|
| 140 |
+
description=_DESCRIPTION,
|
| 141 |
+
features=datasets.Features(
|
| 142 |
+
{
|
| 143 |
+
"id": datasets.Value("string"),
|
| 144 |
+
"locale": datasets.Value("string"),
|
| 145 |
+
"partition": datasets.Value("string"),
|
| 146 |
+
"domain": datasets.features.ClassLabel(names=_DOMAINS),
|
| 147 |
+
"intent": datasets.features.ClassLabel(names=_INTENTS),
|
| 148 |
+
"utterance": datasets.Value("string"),
|
| 149 |
+
"bio": datasets.Value("string"),
|
| 150 |
+
},
|
| 151 |
+
),
|
| 152 |
+
supervised_keys=None,
|
| 153 |
+
homepage="https://github.com/cartesinus/leyzer/",
|
| 154 |
+
citation=_CITATION,
|
| 155 |
+
license=_LICENSE,
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
def _split_generators(self, dl_manager):
|
| 159 |
+
|
| 160 |
+
archive = dl_manager.download(self.config.data_url)
|
| 161 |
+
return [
|
| 162 |
+
datasets.SplitGenerator(
|
| 163 |
+
name=datasets.Split.TRAIN,
|
| 164 |
+
gen_kwargs={
|
| 165 |
+
"files": dl_manager.iter_archive(archive),
|
| 166 |
+
"split": "train",
|
| 167 |
+
"lang": self.config.name,
|
| 168 |
+
}
|
| 169 |
+
),
|
| 170 |
+
datasets.SplitGenerator(
|
| 171 |
+
name=datasets.Split.VALIDATION,
|
| 172 |
+
gen_kwargs={
|
| 173 |
+
"files": dl_manager.iter_archive(archive),
|
| 174 |
+
"split": "valid",
|
| 175 |
+
"lang": self.config.name,
|
| 176 |
+
}
|
| 177 |
+
),
|
| 178 |
+
datasets.SplitGenerator(
|
| 179 |
+
name=datasets.Split.TEST,
|
| 180 |
+
gen_kwargs={
|
| 181 |
+
"files": dl_manager.iter_archive(archive),
|
| 182 |
+
"split": "test",
|
| 183 |
+
"lang": self.config.name,
|
| 184 |
+
}
|
| 185 |
+
),
|
| 186 |
+
]
|
| 187 |
+
|
| 188 |
+
def _generate_examples(self, files, split, lang):
|
| 189 |
+
|
| 190 |
+
key_ = 0
|
| 191 |
+
|
| 192 |
+
if lang == "all":
|
| 193 |
+
lang = _LANGUAGES.copy()
|
| 194 |
+
else:
|
| 195 |
+
lang = [lang]
|
| 196 |
+
|
| 197 |
+
for path, f in files:
|
| 198 |
+
l = path.split("/")[-1].split(".")[0]
|
| 199 |
+
|
| 200 |
+
if not lang:
|
| 201 |
+
break
|
| 202 |
+
elif l in lang:
|
| 203 |
+
lang.remove(l)
|
| 204 |
+
else:
|
| 205 |
+
continue
|
| 206 |
+
|
| 207 |
+
# Read the file
|
| 208 |
+
lines = f.read().decode(encoding="utf-8").split("\n")
|
| 209 |
+
|
| 210 |
+
for line in lines:
|
| 211 |
+
if not line:
|
| 212 |
+
continue
|
| 213 |
+
|
| 214 |
+
data = json.loads(line)
|
| 215 |
+
|
| 216 |
+
if data["partition"] != split:
|
| 217 |
+
continue
|
| 218 |
+
|
| 219 |
+
yield key_, {
|
| 220 |
+
"id": data["id"],
|
| 221 |
+
"locale": data["locale"],
|
| 222 |
+
"partition": data["partition"],
|
| 223 |
+
"domain": data["domain"],
|
| 224 |
+
"intent": data["intent"],
|
| 225 |
+
"utterance": data["utterance"],
|
| 226 |
+
"bio": data["bio"],
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
key_ += 1
|