Click here to Skip to main content
14,930,093 members
Articles / Artificial Intelligence / Machine Learning
Posted 23 Jul 2020


2 bookmarked

Anytime Customer Support using Artificial Intelligence Chatbot in Customer Service

Rate me:
Please Sign up or sign in to vote.
3.40/5 (5 votes)
23 Jul 2020CPOL5 min read
Basics of the rule-based chatbot, machine-learning chatbot and AI chatbot.
This post focuses on the basic knowledge of how rule-based, machine-learning and AI chatbots work, why we need chatbots in customer service, and how they process customer queries. I've explained the work processing flow and architectural design of the chatbot. I've designed the pipe-and-filter pattern for the ML chatbot and explained the implementation of the framework using .NET into the provided link.


At some point, it's rare to find a person who doesn't have the experience with customer service through a representative. Sometimes, they don't have the immediate answers and they transfer the customer to another person. That's how they serve multiple customers and this is fair enough to take long resolution time to resolve the customer service tickets. But it could disappoint customers. So, instead of disappointing them, we could handle these challenges adding chatbot. As a result, 24/7 customer support could enhance customer satisfaction.


  • Chatbot types and their benefits
  • Process flow and basic components of chatbots
  • Basic idea about rule-based, retrieval-based and generative chatbot
  • Text classification approaches for solving NLP problem
  • Pipe-and-Filter architecture pattern for ML chatbot implementation
  • Prerequisite guides to chatbot development for starters using .NET Framework


A chatbot is a conversational software application which interacts with customers over the internet.

Benefits of Chatbot

  • Enhance customer engagement
  • 24/7 customer support availability
  • Quickly resolve customer issues
  • Reduce customer support cost

Types of Chatbots

Image 1

Rule-Based Chatbot

The chatbot answers the customer queries based on the predefined rules. The rule-based chatbot implementation is very straightforward and cheap.

Chatbot Process Flow and Basic Components

Image 2

For example, if we consider a flow-based design, then it's easy to identify the intent and entities to a set of the predefined intents. Let's see the given chatbot below:

Image 3
  • If a user chooses "Yes, I'd like to create an account", then chatbot identifies the intent which is "create an account". Now chatbot can respond, "Okay, you want to create an account. What is your email?"
  • Now if a user responses, "Why do you need my email?", then chatbot can respond, "Sorry, I didn't understand that. What's your email?"
  • If a user replies, "My email address is", then chatbot identifies the value of the entity and responses, "Got it! Thanks for giving us your email address. Hold on a second, let me pull your information."

The rule-based chatbot uses regular expression in order to match the pattern of the text. If the input text matches the existing pattern, then it can respond to the user correctly.

Self-Learning Chatbot

Self-learning chatbot uses machine learning (ML) approach. It uses deep-learning to train itself. It is better than the rule-based chatbot.

Retrieval-Based Model

Retrieval-based chatbot can be built with the machine learning (ML) algorithm which uses data processing technique such as natural language processing (NLP) to process the user input. So, the response accuracy depends on the existing training data and data processing algorithm. It can handle only predefined intents and entities. It can't handle unknown intents and entities. It is also known as ML-based chatbot.

Process Flow and Basic Components of ML Chatbot

Image 4
  • Natural language processing (NLP) converts human input text into structured data so that the machine can understand it. So, NLP performs the following tasks such as, speech recognition, tokenization, parsing and information extraction, etc.
  • Natural language understanding (NLU) uses algorithm to classify the intent (verb) and recognize the entity (noun or action content).
  • Natural language generation (NLG) converts structured data of the machine into text so that humans can understand it.
Image 5

For example, if a user types free input text, then bot can identify the intent and entities to a set of the predefined intents. Let's see the given chatbot below:

  • If a user types "Hi, my email is and I want to open an account.", then chatbot identifies the intents that are "greetings" and "create an account". Now chatbot can response, "Okay, you want to create an account and your email is Right?"
  • If a user replies, "Yes", then chatbot identifies the value of the entity and responses, "Got it! Hold on a second, let me pull your information."

Text Classification Approaches for Solving NLP Problem

There are three text classification approaches to classify text such as:

  1. Pattern Matcher
  2. Algorithm
  3. Neural Network

Text Classification using Algorithm for NPL Problem

You can use multinomial naive Bayes algorithm to classify text.

ML Service Design using Pipe-and-Filter Architecture Pattern for Retrieval Chatbot

Image 6

Framework Implementation using Pipe-and-Filter Architecture Pattern

If you need more details about the pipe-and-filter architecture pattern as well as want to implement a framework using .NET C#, then I've an article with source code using .NET Framework; you can take a look, A Framework Implementation using Pipe and Filter Architecture.

Generative Model Chatbot

It is similar to the retrieval-based chatbot that can be built with the machine learning (ML) algorithm. But it can't only handle predefined intents and entities, but it can also handle unknown intents and entities. It is also known as AI-based chatbot. Because, it is the mimic of human brain. You can use recurrent neural network (RNN) and attention mechanisms for the NLP problem. RNN is one of the type of the artificial neural network. Attention mechanism is one of the input processing techniques for neural networks.

Types of Artificial Neural Networks for Solving NLP Problem

  • Recurrent Neural Network
  • Recursive Neural Network
  • Sequence-to-Sequence Model
  • Multilayer Perceptron
  • Shallow Neural Network
  • Long Short-Term Memory
  • Convolutional Neural Network

Prerequisite Guides to Chatbot Development for Starters using .NET Framework

I'm guessing, you've already installed Visual Studio 2019. If you need machine learning graphical interface to generate the model, then open the Visual Studio setup file and select "ML.NET Model Builder" component as shown in the image below:

Image 7

Now you need to install the following extensions from the Visual Studio extension:

Web Application Project Creation using Bot Framework

In Visual Studio, click on the "Create a new project". If you want to see the bot templates, then choose "AI Bots" from the "Project types" and select your required template as in the below image:

Image 8

Integrate ML.NET with Bot Project

Select the project from the Solution Explorer> click on the right button of the mouse> Add> Machine Learning as in the below image:

Image 9

Taking a coffee break, will come back soon with the implementation of the rule-based/ML-based chatbot using .NET Technology.


  • 23rd July, 2020: Initial version


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Habibur Rony
United States United States
Lazy software engineer, don’t believe in hard work.

Comments and Discussions

-- There are no messages in this forum --