Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

Chatbot for DB with RASA

Design
Intent clasification
Entity extraction
Actions
Dialog context tracking
Questions & Answers and Historical chats

Chatbot is a machine which provide an answer whenever the user asks a question. two
widely used techniques called Intent classification and Entity extraction.

Once we understand the meaning of the question, then we need to perform certain
actions to generate the correct answer to the user. In this banking customer
service example, if an user asks for the account balance, then by executing a
simple SQL query the bot can generate the answer. If the user asks for some general
information like the Housing interest rate, then with the help of the bank’s FAQs
(Question-Answer pairs), the bot can generate the answer. Another way to generate
the answer is by referring the historical chats.

2. Intent Classification
Here, given a query or question from the user we need to identify what’s the
intention behind the question. Typical questions customers will ask are listed
below.

What do I have to do to change my pin?


How do I activate my card that just arrived?
Can Google Pay be used for top up, please help?
Which ATM’s can I use to make a withdrawal?
Why is my last cheque deposit taking so long?

Intent classigfication using BERT


BERT- Bidirectional Encoder Representations from Transformers is a transformer-
based model. If we have large number of training data, then we can use BERT model
to perform intent classification. But in real world, we often have very less number
of training data like 10 to 15 sentences per intent. In such scenarios, it’s good
to use Few shot learning. (Siamese network). In our banking dataset, we have
considerable amount of training data for each intent, so we are going to use the
BERT model.

Data Preprocessing: This is the first stage. During this stage, we first need to
remove duplicates, null values, http tags, special characters etc. After cleaning
the data, we need convert the text to vectors. For that we will first tokenize the
sentence into tokens and then covert it into token ids.

For the Banking dataset, we are going to use BERT model for Intent classification.
We have imported the banking77 dataset from Hugging Face. The dataset has a total
of 13,083 records. (Train data: 10003, Test data: 3080) and we have 77 labels or
intents.

3. Entity Extraction
To get the meaning behind the question, Entity extraction plays a major role along
with Intent classification.

Example: what is the maximum limit for credit card?

In the above example, using intent classification we can find the intent of the
above question. (ie) intent- Credit card. We understood that the question is
related to credit card but we doesn’t know what exact information the user wants.
To solve this, we use a technique called Entity Extraction.

Entity Extraction or Named Entity Recognition helps us to find the entities in the
question which in turn helps us to understand the exact meaning of the question.
Entities are categories such as person names, organizations, locations, medical
codes, time expressions, quantities, monetary values, percentages etc.

4. Actions
Once we identify the meaning of the question, then we need to take certain actions
and provide valid answer or output to the user. If the user is asking for the
balance of his savings account, then we can just execute the SQL query and provide
the answer for it.

5. Dialog context tracking


In real world, whenever the user interacts with the chatbot or customer service,
the user will not ask his question in a single context. In order to understand what
the user really wants, we need to keep track of the entire conversation with the
user. Here, the chatbot is required to keep track of the recent intents and
entities to get the whole picture. Also it’s much possible, the user can ask
multiple questions during the conversation.

6.Questions & Answers and Historical chats


In most companies, they will be having large amount of historical chats which would
have happened between the customer service person and the user. This data is much
useful to generate the answer. Here, given a question, the chatbot will search
through the historical chats and pick the relevant question and give the answer
based on that.

You might also like