Skip to content

Commit 5e2010a

Browse files
Merge pull request #6422 from JohnSnowLabs/2021-11-07-bert_sequence_classifier_banking77_en_umGUhbgMgSVREizOlHjpqmwM
2021-11-07-bert_sequence_classifier_banking77_en
2 parents 52284cb + f62dd1e commit 5e2010a

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
layout: model
3+
title: BERT Sequence Classification - Classify Banking-Related texts
4+
author: John Snow Labs
5+
name: bert_sequence_classifier_banking77
6+
date: 2021-11-07
7+
tags: [banking, bert_for_sequence_classification, classification, en, open_source]
8+
task: Text Classification
9+
language: en
10+
edition: Spark NLP 3.3.2
11+
spark_version: 2.4
12+
supported: true
13+
article_header:
14+
type: cover
15+
use_language_switcher: "Python-Scala-Java"
16+
---
17+
18+
## Description
19+
20+
This model is imported from `Hugging Face-models` and it classifies texts into 77 banking-related classes.
21+
22+
## Predicted Entities
23+
24+
`activate_my_card`, `age_limit`, `card_acceptance`, `card_arrival`, `card_delivery_estimate`, `card_linking`, `card_not_working`, `card_payment_fee_charged`, `card_payment_not_recognised`, `card_payment_wrong_exchange_rate`, `card_swallowed`, `cash_withdrawal_charge`, `apple_pay_or_google_pay`, `cash_withdrawal_not_recognised`, `change_pin`, `compromised_card`, `contactless_not_working`, `country_support`, `declined_card_payment`, `declined_cash_withdrawal`, `declined_transfer`, `direct_debit_payment_not_recognised`, `disposable_card_limits`, `atm_support`, `edit_personal_details`, `exchange_charge`, `exchange_rate`, `exchange_via_app`, `extra_charge_on_statement`, `failed_transfer`, `fiat_currency_support`, `get_disposable_virtual_card`, `get_physical_card`, `getting_spare_card`, `automatic_top_up`, `getting_virtual_card`, `lost_or_stolen_card`, `lost_or_stolen_phone`, `order_physical_card`, `passcode_forgotten`, `pending_card_payment`, `pending_cash_withdrawal`, `pending_top_up`, `pending_transfer`, `pin_blocked`, `balance_not_updated_after_bank_transfer`, `receiving_money`, `Refund_not_showing_up`, `request_refund`, `reverted_card_payment?`, `supported_cards_and_currencies`, `terminate_account`, `top_up_by_bank_transfer_charge`, `top_up_by_card_charge`, `top_up_by_cash_or_cheque`, `top_up_failed`, `balance_not_updated_after_cheque_or_cash_deposit`, `top_up_limits`, `top_up_reverted`, `topping_up_by_card`, `transaction_charged_twice`, `transfer_fee_charged`, `transfer_into_account`, `transfer_not_received_by_recipient`, `transfer_timing`, `unable_to_verify_identity`, `verify_my_identity`, `beneficiary_not_allowed`, `verify_source_of_funds`, `verify_top_up`, `virtual_card_not_working`, `visa_or_mastercard`, `why_verify_identity`, `wrong_amount_of_cash_received`, `wrong_exchange_rate_for_cash_withdrawal`, `cancel_transfer`, `card_about_to_expire`
25+
26+
{:.btn-box}
27+
<button class="button button-orange" disabled>Live Demo</button>
28+
<button class="button button-orange" disabled>Open in Colab</button>
29+
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/bert_sequence_classifier_banking77_en_3.3.2_2.4_1636277240241.zip){:.button.button-orange.button-orange-trans.arr.button-icon}
30+
31+
## How to use
32+
33+
34+
35+
<div class="tabs-box" markdown="1">
36+
{% include programmingLanguageSelectScalaPythonNLU.html %}
37+
```python
38+
document_assembler = DocumentAssembler() \
39+
.setInputCol('text') \
40+
.setOutputCol('document')
41+
42+
tokenizer = Tokenizer() \
43+
.setInputCols(['document']) \
44+
.setOutputCol('token')
45+
46+
sequenceClassifier = BertForSequenceClassification \
47+
.pretrained('bert_sequence_classifier_banking77', 'en') \
48+
.setInputCols(['token', 'document']) \
49+
.setOutputCol('class') \
50+
.setCaseSensitive(True) \
51+
.setMaxSentenceLength(512)
52+
53+
pipeline = Pipeline(stages=[document_assembler, tokenizer, sequenceClassifier])
54+
55+
example = spark.createDataFrame([['I am still waiting on my card?']]).toDF("text")
56+
result = pipeline.fit(example).transform(example)
57+
```
58+
```scala
59+
val document_assembler = DocumentAssembler()
60+
.setInputCol("text")
61+
.setOutputCol("document")
62+
63+
val tokenizer = Tokenizer()
64+
.setInputCols("document")
65+
.setOutputCol("token")
66+
67+
val tokenClassifier = BertForSequenceClassification("bert_sequence_classifier_banking77", "en")
68+
.setInputCols("document", "token")
69+
.setOutputCol("class")
70+
.setCaseSensitive(true)
71+
.setMaxSentenceLength(512)
72+
73+
val pipeline = new Pipeline().setStages(Array(document_assembler, tokenizer, sequenceClassifier))
74+
75+
val example = Seq.empty["I am still waiting on my card?"].toDS.toDF("text")
76+
77+
val result = pipeline.fit(example).transform(example)
78+
```
79+
</div>
80+
81+
## Results
82+
83+
```bash
84+
['atm_support']
85+
```
86+
87+
{:.model-param}
88+
## Model Information
89+
90+
{:.table-model}
91+
|---|---|
92+
|Model Name:|bert_sequence_classifier_banking77|
93+
|Compatibility:|Spark NLP 3.3.2+|
94+
|License:|Open Source|
95+
|Edition:|Official|
96+
|Input Labels:|[token, sentence]|
97+
|Output Labels:|[label]|
98+
|Language:|en|
99+
|Case sensitive:|true|
100+
101+
## Data Source
102+
103+
[https://huggingface.co/philschmid/BERT-Banking77](https://huggingface.co/philschmid/BERT-Banking77)

0 commit comments

Comments
 (0)