Update dataset_2.py
Browse files- dataset_2.py +42 -18
dataset_2.py
CHANGED
@@ -21,7 +21,7 @@ import datasets
|
|
21 |
logger = datasets.logging.get_logger(__name__)
|
22 |
|
23 |
|
24 |
-
"""
|
25 |
|
26 |
_CITATION = """\
|
27 |
@article{gerz2021multilingual,
|
@@ -33,7 +33,7 @@ _CITATION = """\
|
|
33 |
"""
|
34 |
|
35 |
_DESCRIPTION = """\
|
36 |
-
|
37 |
detection task with spoken data. It covers 14
|
38 |
intents extracted from a commercial system
|
39 |
in the e-banking domain, associated with spoken examples in 14 diverse language varieties.
|
@@ -44,20 +44,20 @@ _ALL_CONFIGS = sorted([
|
|
44 |
])
|
45 |
|
46 |
|
47 |
-
_DESCRIPTION = "
|
48 |
|
49 |
_HOMEPAGE_URL = "https://arxiv.org/abs/2104.08524"
|
50 |
|
51 |
-
_DATA_URL = "https://www.dropbox.com/
|
52 |
|
53 |
|
54 |
-
class
|
55 |
"""BuilderConfig for xtreme-s"""
|
56 |
|
57 |
def __init__(
|
58 |
self, name, description, homepage, data_url
|
59 |
):
|
60 |
-
super(
|
61 |
name=self.name,
|
62 |
version=datasets.Version("1.0.0", ""),
|
63 |
description=self.description,
|
@@ -69,7 +69,7 @@ class ATCConfig(datasets.BuilderConfig):
|
|
69 |
|
70 |
|
71 |
def _build_config(name):
|
72 |
-
return
|
73 |
name=name,
|
74 |
description=_DESCRIPTION,
|
75 |
homepage=_HOMEPAGE_URL,
|
@@ -77,7 +77,7 @@ def _build_config(name):
|
|
77 |
)
|
78 |
|
79 |
|
80 |
-
class
|
81 |
|
82 |
DEFAULT_WRITER_BATCH_SIZE = 1000
|
83 |
BUILDER_CONFIGS = [_build_config(name) for name in _ALL_CONFIGS + ["all"]]
|
@@ -87,16 +87,36 @@ class ATC(datasets.GeneratorBasedBuilder):
|
|
87 |
langs = _ALL_CONFIGS
|
88 |
features = datasets.Features(
|
89 |
{
|
90 |
-
"
|
91 |
-
"
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
)
|
95 |
|
96 |
return datasets.DatasetInfo(
|
97 |
description=_DESCRIPTION,
|
98 |
features=features,
|
99 |
-
supervised_keys=("
|
100 |
homepage=self.config.homepage,
|
101 |
citation=_CITATION,
|
102 |
task_templates=task_templates,
|
@@ -111,10 +131,10 @@ class ATC(datasets.GeneratorBasedBuilder):
|
|
111 |
|
112 |
archive_path = dl_manager.download_and_extract(self.config.data_url)
|
113 |
audio_path = dl_manager.extract(
|
114 |
-
os.path.join(archive_path, "
|
115 |
)
|
116 |
text_path = dl_manager.extract(
|
117 |
-
os.path.join(archive_path, "
|
118 |
)
|
119 |
|
120 |
text_path = {l: os.path.join(text_path, f"{l}.csv") for l in langs}
|
@@ -138,11 +158,15 @@ class ATC(datasets.GeneratorBasedBuilder):
|
|
138 |
csv_reader = csv.reader(csv_file, delimiter=",", skipinitialspace=True)
|
139 |
next(csv_reader)
|
140 |
for row in csv_reader:
|
141 |
-
file_path,
|
142 |
|
143 |
file_path = os.path.join(audio_path, *file_path.split("/"))
|
144 |
yield key, {
|
145 |
-
"path": file_path,
|
146 |
-
"
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
-
key += 1
|
|
|
21 |
logger = datasets.logging.get_logger(__name__)
|
22 |
|
23 |
|
24 |
+
""" MInDS-14 Dataset"""
|
25 |
|
26 |
_CITATION = """\
|
27 |
@article{gerz2021multilingual,
|
|
|
33 |
"""
|
34 |
|
35 |
_DESCRIPTION = """\
|
36 |
+
MINDS-14 is training and evaluation resource for intent
|
37 |
detection task with spoken data. It covers 14
|
38 |
intents extracted from a commercial system
|
39 |
in the e-banking domain, associated with spoken examples in 14 diverse language varieties.
|
|
|
44 |
])
|
45 |
|
46 |
|
47 |
+
_DESCRIPTION = "MINDS-14 is a dataset for the intent detection task with spoken data. It covers 14 intents extracted from a commercial system in the e-banking domain, associated with spoken examples in 14 diverse language varieties."
|
48 |
|
49 |
_HOMEPAGE_URL = "https://arxiv.org/abs/2104.08524"
|
50 |
|
51 |
+
_DATA_URL = "https://www.dropbox.com/s/e2us0hcs3ilr20e/MInDS-14.zip?dl=1"
|
52 |
|
53 |
|
54 |
+
class Minds14Config(datasets.BuilderConfig):
|
55 |
"""BuilderConfig for xtreme-s"""
|
56 |
|
57 |
def __init__(
|
58 |
self, name, description, homepage, data_url
|
59 |
):
|
60 |
+
super(Minds14Config, self).__init__(
|
61 |
name=self.name,
|
62 |
version=datasets.Version("1.0.0", ""),
|
63 |
description=self.description,
|
|
|
69 |
|
70 |
|
71 |
def _build_config(name):
|
72 |
+
return Minds14Config(
|
73 |
name=name,
|
74 |
description=_DESCRIPTION,
|
75 |
homepage=_HOMEPAGE_URL,
|
|
|
77 |
)
|
78 |
|
79 |
|
80 |
+
class Minds14(datasets.GeneratorBasedBuilder):
|
81 |
|
82 |
DEFAULT_WRITER_BATCH_SIZE = 1000
|
83 |
BUILDER_CONFIGS = [_build_config(name) for name in _ALL_CONFIGS + ["all"]]
|
|
|
87 |
langs = _ALL_CONFIGS
|
88 |
features = datasets.Features(
|
89 |
{
|
90 |
+
"path": datasets.Value("string"),
|
91 |
+
"audio": datasets.Audio(sampling_rate=8_000),
|
92 |
+
"transcription": datasets.Value("string"),
|
93 |
+
"english_transcription": datasets.Value("string"),
|
94 |
+
"intent_class": datasets.ClassLabel(
|
95 |
+
names=[
|
96 |
+
"abroad",
|
97 |
+
"address",
|
98 |
+
"app_error",
|
99 |
+
"atm_limit",
|
100 |
+
"balance",
|
101 |
+
"business_loan",
|
102 |
+
"card_issues",
|
103 |
+
"cash_deposit",
|
104 |
+
"direct_debit",
|
105 |
+
"freeze",
|
106 |
+
"high_value_payment",
|
107 |
+
"joint_account",
|
108 |
+
"latest_transactions",
|
109 |
+
"pay_bill",
|
110 |
+
]
|
111 |
+
),
|
112 |
+
"lang_id": datasets.ClassLabel(names=langs),
|
113 |
}
|
114 |
)
|
115 |
|
116 |
return datasets.DatasetInfo(
|
117 |
description=_DESCRIPTION,
|
118 |
features=features,
|
119 |
+
supervised_keys=("audio", "transcription"),
|
120 |
homepage=self.config.homepage,
|
121 |
citation=_CITATION,
|
122 |
task_templates=task_templates,
|
|
|
131 |
|
132 |
archive_path = dl_manager.download_and_extract(self.config.data_url)
|
133 |
audio_path = dl_manager.extract(
|
134 |
+
os.path.join(archive_path, "MInDS-14", "audio.zip")
|
135 |
)
|
136 |
text_path = dl_manager.extract(
|
137 |
+
os.path.join(archive_path, "MInDS-14", "text.zip")
|
138 |
)
|
139 |
|
140 |
text_path = {l: os.path.join(text_path, f"{l}.csv") for l in langs}
|
|
|
158 |
csv_reader = csv.reader(csv_file, delimiter=",", skipinitialspace=True)
|
159 |
next(csv_reader)
|
160 |
for row in csv_reader:
|
161 |
+
file_path, transcription, english_transcription, intent_class = row
|
162 |
|
163 |
file_path = os.path.join(audio_path, *file_path.split("/"))
|
164 |
yield key, {
|
165 |
+
"path": file_path,
|
166 |
+
"audio": file_path,
|
167 |
+
"transcription": transcription,
|
168 |
+
"english_transcription": english_transcription,
|
169 |
+
"intent_class": intent_class.lower(),
|
170 |
+
"lang_id": _ALL_CONFIGS.index(lang),
|
171 |
}
|
172 |
+
key += 1
|