Datasets:
Tasks:
Automatic Speech Recognition
Sub-tasks:
keyword-spotting
Size:
10K<n<100K
ArXiv:
Tags:
speech-recognition
License:
mariosasko
commited on
Delete minds14.py
Browse files- minds14.py +0 -172
minds14.py
DELETED
@@ -1,172 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2022 The PolyAI and HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
|
16 |
-
import csv
|
17 |
-
import os
|
18 |
-
|
19 |
-
import datasets
|
20 |
-
|
21 |
-
logger = datasets.logging.get_logger(__name__)
|
22 |
-
|
23 |
-
|
24 |
-
""" MInDS-14 Dataset"""
|
25 |
-
|
26 |
-
_CITATION = """\
|
27 |
-
@article{gerz2021multilingual,
|
28 |
-
title={Multilingual and cross-lingual intent detection from spoken data},
|
29 |
-
author={Gerz, Daniela and Su, Pei-Hao and Kusztos, Razvan and Mondal, Avishek and Lis, Michal and Singhal, Eshan and Mrk{\v{s}}i{\'c}, Nikola and Wen, Tsung-Hsien and Vuli{\'c}, Ivan},
|
30 |
-
journal={arXiv preprint arXiv:2104.08524},
|
31 |
-
year={2021}
|
32 |
-
}
|
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.
|
40 |
-
"""
|
41 |
-
|
42 |
-
_ALL_CONFIGS = sorted([
|
43 |
-
"cs-CZ", "de-DE", "en-AU", "en-GB", "en-US", "es-ES", "fr-FR", "it-IT", "ko-KR", "nl-NL", "pl-PL", "pt-PT", "ru-RU", "zh-CN"
|
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,
|
64 |
-
)
|
65 |
-
self.name = name
|
66 |
-
self.description = description
|
67 |
-
self.homepage = homepage
|
68 |
-
self.data_url = data_url
|
69 |
-
|
70 |
-
|
71 |
-
def _build_config(name):
|
72 |
-
return Minds14Config(
|
73 |
-
name=name,
|
74 |
-
description=_DESCRIPTION,
|
75 |
-
homepage=_HOMEPAGE_URL,
|
76 |
-
data_url=_DATA_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"]]
|
84 |
-
|
85 |
-
def _info(self):
|
86 |
-
task_templates = None
|
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,
|
123 |
-
)
|
124 |
-
|
125 |
-
def _split_generators(self, dl_manager):
|
126 |
-
langs = (
|
127 |
-
_ALL_CONFIGS
|
128 |
-
if self.config.name == "all"
|
129 |
-
else [self.config.name]
|
130 |
-
)
|
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}
|
141 |
-
|
142 |
-
return [
|
143 |
-
datasets.SplitGenerator(
|
144 |
-
name=datasets.Split.TRAIN,
|
145 |
-
gen_kwargs={
|
146 |
-
"audio_path": audio_path,
|
147 |
-
"text_paths": text_path,
|
148 |
-
},
|
149 |
-
)
|
150 |
-
]
|
151 |
-
|
152 |
-
|
153 |
-
def _generate_examples(self, audio_path, text_paths):
|
154 |
-
key = 0
|
155 |
-
for lang in text_paths.keys():
|
156 |
-
text_path = text_paths[lang]
|
157 |
-
with open(text_path, encoding="utf-8") as csv_file:
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|