Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Languages:
English
Size:
10K - 100K
ArXiv:
License:
Commit
•
9c043e5
1
Parent(s):
11b7417
Delete loading script
Browse files- banking77.py +0 -176
banking77.py
DELETED
@@ -1,176 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The 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 |
-
"""BANKING77 dataset."""
|
16 |
-
|
17 |
-
|
18 |
-
import csv
|
19 |
-
import warnings
|
20 |
-
|
21 |
-
import datasets
|
22 |
-
from datasets.tasks import TextClassification
|
23 |
-
|
24 |
-
|
25 |
-
_CITATION = r"""\
|
26 |
-
@inproceedings{Casanueva2020,
|
27 |
-
author = {I{\~{n}}igo Casanueva and Tadas Temcinas and Daniela Gerz and Matthew Henderson and Ivan Vulic},
|
28 |
-
title = {Efficient Intent Detection with Dual Sentence Encoders},
|
29 |
-
year = {2020},
|
30 |
-
month = {mar},
|
31 |
-
note = {Data available at https://github.com/PolyAI-LDN/task-specific-datasets},
|
32 |
-
url = {https://arxiv.org/abs/2003.04807},
|
33 |
-
booktitle = {Proceedings of the 2nd Workshop on NLP for ConvAI - ACL 2020}
|
34 |
-
}
|
35 |
-
""" # noqa: W605
|
36 |
-
|
37 |
-
_DESCRIPTION = """\
|
38 |
-
BANKING77 dataset provides a very fine-grained set of intents in a banking domain.
|
39 |
-
It comprises 13,083 customer service queries labeled with 77 intents.
|
40 |
-
It focuses on fine-grained single-domain intent detection.
|
41 |
-
"""
|
42 |
-
|
43 |
-
_HOMEPAGE = "https://github.com/PolyAI-LDN/task-specific-datasets"
|
44 |
-
|
45 |
-
_LICENSE = "Creative Commons Attribution 4.0 International"
|
46 |
-
|
47 |
-
_TRAIN_DOWNLOAD_URL = (
|
48 |
-
"https://raw.githubusercontent.com/PolyAI-LDN/task-specific-datasets/master/banking_data/train.csv"
|
49 |
-
)
|
50 |
-
_TEST_DOWNLOAD_URL = "https://raw.githubusercontent.com/PolyAI-LDN/task-specific-datasets/master/banking_data/test.csv"
|
51 |
-
|
52 |
-
|
53 |
-
class Banking77(datasets.GeneratorBasedBuilder):
|
54 |
-
"""BANKING77 dataset."""
|
55 |
-
|
56 |
-
VERSION = datasets.Version("1.1.0")
|
57 |
-
|
58 |
-
def _info(self):
|
59 |
-
warnings.warn(
|
60 |
-
"Dataset 'banking77' is deprecated and will be deleted. Use 'PolyAI/banking77' instead.",
|
61 |
-
FutureWarning,
|
62 |
-
)
|
63 |
-
features = datasets.Features(
|
64 |
-
{
|
65 |
-
"text": datasets.Value("string"),
|
66 |
-
"label": datasets.features.ClassLabel(
|
67 |
-
names=[
|
68 |
-
"activate_my_card",
|
69 |
-
"age_limit",
|
70 |
-
"apple_pay_or_google_pay",
|
71 |
-
"atm_support",
|
72 |
-
"automatic_top_up",
|
73 |
-
"balance_not_updated_after_bank_transfer",
|
74 |
-
"balance_not_updated_after_cheque_or_cash_deposit",
|
75 |
-
"beneficiary_not_allowed",
|
76 |
-
"cancel_transfer",
|
77 |
-
"card_about_to_expire",
|
78 |
-
"card_acceptance",
|
79 |
-
"card_arrival",
|
80 |
-
"card_delivery_estimate",
|
81 |
-
"card_linking",
|
82 |
-
"card_not_working",
|
83 |
-
"card_payment_fee_charged",
|
84 |
-
"card_payment_not_recognised",
|
85 |
-
"card_payment_wrong_exchange_rate",
|
86 |
-
"card_swallowed",
|
87 |
-
"cash_withdrawal_charge",
|
88 |
-
"cash_withdrawal_not_recognised",
|
89 |
-
"change_pin",
|
90 |
-
"compromised_card",
|
91 |
-
"contactless_not_working",
|
92 |
-
"country_support",
|
93 |
-
"declined_card_payment",
|
94 |
-
"declined_cash_withdrawal",
|
95 |
-
"declined_transfer",
|
96 |
-
"direct_debit_payment_not_recognised",
|
97 |
-
"disposable_card_limits",
|
98 |
-
"edit_personal_details",
|
99 |
-
"exchange_charge",
|
100 |
-
"exchange_rate",
|
101 |
-
"exchange_via_app",
|
102 |
-
"extra_charge_on_statement",
|
103 |
-
"failed_transfer",
|
104 |
-
"fiat_currency_support",
|
105 |
-
"get_disposable_virtual_card",
|
106 |
-
"get_physical_card",
|
107 |
-
"getting_spare_card",
|
108 |
-
"getting_virtual_card",
|
109 |
-
"lost_or_stolen_card",
|
110 |
-
"lost_or_stolen_phone",
|
111 |
-
"order_physical_card",
|
112 |
-
"passcode_forgotten",
|
113 |
-
"pending_card_payment",
|
114 |
-
"pending_cash_withdrawal",
|
115 |
-
"pending_top_up",
|
116 |
-
"pending_transfer",
|
117 |
-
"pin_blocked",
|
118 |
-
"receiving_money",
|
119 |
-
"Refund_not_showing_up",
|
120 |
-
"request_refund",
|
121 |
-
"reverted_card_payment?",
|
122 |
-
"supported_cards_and_currencies",
|
123 |
-
"terminate_account",
|
124 |
-
"top_up_by_bank_transfer_charge",
|
125 |
-
"top_up_by_card_charge",
|
126 |
-
"top_up_by_cash_or_cheque",
|
127 |
-
"top_up_failed",
|
128 |
-
"top_up_limits",
|
129 |
-
"top_up_reverted",
|
130 |
-
"topping_up_by_card",
|
131 |
-
"transaction_charged_twice",
|
132 |
-
"transfer_fee_charged",
|
133 |
-
"transfer_into_account",
|
134 |
-
"transfer_not_received_by_recipient",
|
135 |
-
"transfer_timing",
|
136 |
-
"unable_to_verify_identity",
|
137 |
-
"verify_my_identity",
|
138 |
-
"verify_source_of_funds",
|
139 |
-
"verify_top_up",
|
140 |
-
"virtual_card_not_working",
|
141 |
-
"visa_or_mastercard",
|
142 |
-
"why_verify_identity",
|
143 |
-
"wrong_amount_of_cash_received",
|
144 |
-
"wrong_exchange_rate_for_cash_withdrawal",
|
145 |
-
]
|
146 |
-
),
|
147 |
-
}
|
148 |
-
)
|
149 |
-
return datasets.DatasetInfo(
|
150 |
-
description=_DESCRIPTION,
|
151 |
-
features=features,
|
152 |
-
supervised_keys=None,
|
153 |
-
homepage=_HOMEPAGE,
|
154 |
-
license=_LICENSE,
|
155 |
-
citation=_CITATION,
|
156 |
-
task_templates=[TextClassification(text_column="text", label_column="label")],
|
157 |
-
)
|
158 |
-
|
159 |
-
def _split_generators(self, dl_manager):
|
160 |
-
"""Returns SplitGenerators."""
|
161 |
-
train_path = dl_manager.download(_TRAIN_DOWNLOAD_URL)
|
162 |
-
test_path = dl_manager.download(_TEST_DOWNLOAD_URL)
|
163 |
-
return [
|
164 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
|
165 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
|
166 |
-
]
|
167 |
-
|
168 |
-
def _generate_examples(self, filepath):
|
169 |
-
"""Yields examples as (key, example) tuples."""
|
170 |
-
with open(filepath, encoding="utf-8") as f:
|
171 |
-
csv_reader = csv.reader(f, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True)
|
172 |
-
# call next to skip header
|
173 |
-
next(csv_reader)
|
174 |
-
for id_, row in enumerate(csv_reader):
|
175 |
-
text, label = row
|
176 |
-
yield id_, {"text": text, "label": label}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|