Professional Documents
Culture Documents
Chat
Chat
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.
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.
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.