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