Basic C++ Chatbot Program
VerifiedAdded on 2020/04/15
|11
|3738
|225
AI Summary
This assignment provides a basic C++ program that simulates a simple chatbot. The program utilizes an array of predefined responses and randomly selects one to reply to user input. It demonstrates fundamental concepts in C++ programming, such as string manipulation, random number generation, and user interaction. Students can analyze the code structure, understand how it works, and potentially modify it to enhance its functionality or add new features.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
ARTIFICIAL INTELLIGENCE: HEALTHY LIFESTYLE
ASSISTANT CHATBOT CREATED IN C++ LANGUAGE
Name
Date
ASSISTANT CHATBOT CREATED IN C++ LANGUAGE
Name
Date
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
Contents
Introduction..........................................................................................................................................3
Background...........................................................................................................................................3
Natural language Processing (NLP).....................................................................................................4
Machine learning..................................................................................................................................4
Previous Work......................................................................................................................................5
Artificial Intelligence (AI) bots.......................................................................................................5
Healthy Lifestyle..............................................................................................................................5
Project Goals and Objectives................................................................................................................5
Design, Training, and Testing...............................................................................................................6
Critical Evaluation................................................................................................................................9
References...........................................................................................................................................11
Introduction..........................................................................................................................................3
Background...........................................................................................................................................3
Natural language Processing (NLP).....................................................................................................4
Machine learning..................................................................................................................................4
Previous Work......................................................................................................................................5
Artificial Intelligence (AI) bots.......................................................................................................5
Healthy Lifestyle..............................................................................................................................5
Project Goals and Objectives................................................................................................................5
Design, Training, and Testing...............................................................................................................6
Critical Evaluation................................................................................................................................9
References...........................................................................................................................................11
Introduction
As lifestyle diseases become chronic, there is need for people to have a means by which they can
obtain information on how to live a healthy lifestyle to not only improve their wellbeing, but to help
the overcome, manage, or reverse some lifestyle conditions such as obesity, diabetes, or heart
disease (Pappachan, 2011), (Bhatnagar et al., 2016). Normally, such help would traditionally come
from reading material (books or articles), or spending time with a health care/ lifestyle professional.
However, the pace of modern life makes those approaches less than ideal. Technological
development has created better approaches and avenues within which people can obtain information
fast and on the go; one approach in this case is through Chabot’s, which is a short form of a chatter
robot. Chabot’s are computer programs that can conduct conversation just like would be done with a
human being through text or auditory methods. The Chabot simulate human conversation in a
convincing manner such that it can pass the Turing test. The Turing Test is a test that evaluates the
ability of a machine to exhibit intelligent behavior that is indistinguishable, or equivalent to a
human being (Khan and Das, 2017).
Chabot’s are utilized in dialog systems for practical applications, including for customer service.
Some chatter bots that have been developed in the past include ELIZA and ALICE. Chatter bots
operate on the principle of AI (artificial intelligence) and use the principles of machine learning to
behave like human beings, and therefore pass the Turing test. AI refers to intelligence that machines
display, and is different from natural intelligence that animals and humans display. Within chatting
robots is AI that enables the chatter bots to perform various tasks, including telling the weather or
responding intelligently to questions (Henderson, 2007). Inside the AI of a chatter bot is machine
learning and NLP (natural language processing) that enable the chatter bot to be trained by creating
chatter bot algorithms so the chatter bot can translate data input into it into desired outputs
(Hirschberg and Manning, 2015). This paper describes and develops a chatter bot using the C++
language that acts as a personal health assistant for people. This paper discusses the background of
chatter bots in the context of the healthy lifestyle issue, and describes the various technologies and
concepts in chatter bot design. The paper then discusses some previous work in the same filed and
then describes the problem in this project and the objectives of this research project. This is
followed by a design of the chatter bot and testing, with all steps and concepts as used in its design
clearly described. The paper then discusses the performance of the chatter bot after its testing. The
code for the project will be attached in a separate document
Background
As lifestyle diseases become chronic, there is need for people to have a means by which they can
obtain information on how to live a healthy lifestyle to not only improve their wellbeing, but to help
the overcome, manage, or reverse some lifestyle conditions such as obesity, diabetes, or heart
disease (Pappachan, 2011), (Bhatnagar et al., 2016). Normally, such help would traditionally come
from reading material (books or articles), or spending time with a health care/ lifestyle professional.
However, the pace of modern life makes those approaches less than ideal. Technological
development has created better approaches and avenues within which people can obtain information
fast and on the go; one approach in this case is through Chabot’s, which is a short form of a chatter
robot. Chabot’s are computer programs that can conduct conversation just like would be done with a
human being through text or auditory methods. The Chabot simulate human conversation in a
convincing manner such that it can pass the Turing test. The Turing Test is a test that evaluates the
ability of a machine to exhibit intelligent behavior that is indistinguishable, or equivalent to a
human being (Khan and Das, 2017).
Chabot’s are utilized in dialog systems for practical applications, including for customer service.
Some chatter bots that have been developed in the past include ELIZA and ALICE. Chatter bots
operate on the principle of AI (artificial intelligence) and use the principles of machine learning to
behave like human beings, and therefore pass the Turing test. AI refers to intelligence that machines
display, and is different from natural intelligence that animals and humans display. Within chatting
robots is AI that enables the chatter bots to perform various tasks, including telling the weather or
responding intelligently to questions (Henderson, 2007). Inside the AI of a chatter bot is machine
learning and NLP (natural language processing) that enable the chatter bot to be trained by creating
chatter bot algorithms so the chatter bot can translate data input into it into desired outputs
(Hirschberg and Manning, 2015). This paper describes and develops a chatter bot using the C++
language that acts as a personal health assistant for people. This paper discusses the background of
chatter bots in the context of the healthy lifestyle issue, and describes the various technologies and
concepts in chatter bot design. The paper then discusses some previous work in the same filed and
then describes the problem in this project and the objectives of this research project. This is
followed by a design of the chatter bot and testing, with all steps and concepts as used in its design
clearly described. The paper then discusses the performance of the chatter bot after its testing. The
code for the project will be attached in a separate document
Background
A chatter bot will be able to provide a user with answers and responses on lifestyle choices in order
to help them improve or maintain their health. To do this, the chatter bot must be able to process
language and decide the kind of response to give for every question or statement given to it.
Processing language requires the use of NLP by the chatter bot
Natural language Processing (NLP)
NLP is a field of study concerned with how computers can understand the language of humans.
Without NLP, the human sentences just become a series of gibberish symbols without meaning to
the computer (Kumar, 2017). Computers cannot recognize words or understand grammar, given that
computers operate on the binary system of a series of 1’s and 0’s. NLP then becomes a translator, an
intermediary that translates the human language into a format that computers can understand. This
requires precise and accurate procedures to enable the computers understand the human language.
Every little detail; s space, a character, can make a very big difference in the way the computer
processes human language (Green, Heer and Manning, 2015). However, with NLP, the way humans
interact with computers changes drastically; examples include the Siri application in Apple Phones,
or Cortana in Microsoft (Scagliarini and Varone, 2017). These have made it possible for commands
to be given in human language in different languages with the computers responding appropriately.
NLP is a form of artificial intelligence that moderates and creates a bridge in communication
between machines and humans. For this project, these concepts will be programmed into the
proposed chatter boot using the C++ programming language
Machine learning
Machine learning is a computer science field that makes it possible for computers to learn without
explicit programming of the computers. The formulas parameters are computed from data, rather
than being defined by a programmer as happens in normal software development. The two most
commonly used forms of machine learning are regression and classification. Classification refers to
the categorizing of different data types while regression refers to finding a way of describing data
(Bottou, 2014). Machine learning has two basic stages, fitting and predicting; during fitting, the
program is provided with a large data set and the program attempts to adjust its parameter, using a
statistical or mathematical model to best ‘fit’ the data input. During prediction, the program predicts
new inputs based on the parameters it has just computed during fitting (Radford, Metz, and
Chintala, 2015). Using the C++ program, code will be developed to enhance the Machine Learning
(ML) capabilities of the program.
to help them improve or maintain their health. To do this, the chatter bot must be able to process
language and decide the kind of response to give for every question or statement given to it.
Processing language requires the use of NLP by the chatter bot
Natural language Processing (NLP)
NLP is a field of study concerned with how computers can understand the language of humans.
Without NLP, the human sentences just become a series of gibberish symbols without meaning to
the computer (Kumar, 2017). Computers cannot recognize words or understand grammar, given that
computers operate on the binary system of a series of 1’s and 0’s. NLP then becomes a translator, an
intermediary that translates the human language into a format that computers can understand. This
requires precise and accurate procedures to enable the computers understand the human language.
Every little detail; s space, a character, can make a very big difference in the way the computer
processes human language (Green, Heer and Manning, 2015). However, with NLP, the way humans
interact with computers changes drastically; examples include the Siri application in Apple Phones,
or Cortana in Microsoft (Scagliarini and Varone, 2017). These have made it possible for commands
to be given in human language in different languages with the computers responding appropriately.
NLP is a form of artificial intelligence that moderates and creates a bridge in communication
between machines and humans. For this project, these concepts will be programmed into the
proposed chatter boot using the C++ programming language
Machine learning
Machine learning is a computer science field that makes it possible for computers to learn without
explicit programming of the computers. The formulas parameters are computed from data, rather
than being defined by a programmer as happens in normal software development. The two most
commonly used forms of machine learning are regression and classification. Classification refers to
the categorizing of different data types while regression refers to finding a way of describing data
(Bottou, 2014). Machine learning has two basic stages, fitting and predicting; during fitting, the
program is provided with a large data set and the program attempts to adjust its parameter, using a
statistical or mathematical model to best ‘fit’ the data input. During prediction, the program predicts
new inputs based on the parameters it has just computed during fitting (Radford, Metz, and
Chintala, 2015). Using the C++ program, code will be developed to enhance the Machine Learning
(ML) capabilities of the program.
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
Previous Work
Artificial Intelligence (AI) bots
A Chabot is a computer program that can undertake conversation using textual or audio with human
beings, being able to mimic human language behavior; they are widely used at present. Chabot’s
utilize NLP techniques in analyzing input sentences and then generate suitable outputs. Presently,
two AI trends are predominant; as human like as possible bots that can pass the Turing test and
another trend is Chatbots that can give users help, without the users realizing that they are dealing
with a bot, for instance, the Siri application by Apple. These types of bots can attain very high
levels of accuracy because they have a narrow scope of use (Scagliarini and Varone, 2017).
Healthy Lifestyle
Presently, achieving a healthy lifestyle requires either reading content from the web or books, or
consulting a healthy lifestyle consultant. These processes either consume a lot of time or finances,
or both. These factors make it a less attractive prospect for a majority of the population, with
research showing that in the USA, for example, less than 3% of the population follow a healthy
lifestyle, according to Beck (2016) based on statistics from the Mayo Clinic Proceedings. These are
very disturbing statistics; The CDC (2017) shows that the leading causes of death for American are
chronic diseases such as stroke, cancer, heart disease, Type 2 Diabetes, and arthritis. Not only are
they leading killers, but are among the most common as well as costly causes of health problems,
yet are they easily preventable if only people could adopt healthier lifestyles. By 2012, half of all
adults in the US suffered some form of chronic lifestyle health condition. In the UK, the Health
Secretary in 2013 reported that the five big killers that include lung, liver, heart disease, stroke, and
cancer accounted for 150000 annual deaths among people below age 75 in England; 30000 of those
deaths were entirely avoidable (Roberts 2013). Further, according to Bodkin (2017), one third of
Britons are at risk of early death due to an unhealthy lifestyle devoid of any exercise based on
studies by the British Heart Foundation. Further, even for those that exercise, there is a big risk of
illnesses because of spending a lot of time sitting at work (Hruby and Hu, 2014). The figures and
statistics point to a dire situation in healthy lifestyles and require a new approach that makes the
best use of available technology. A chatter bot would offer an inexpensive and interesting solution
that can help enhance healthy lifestyles among people because it’s readily available, cost effective,
and is based on technology that a lot more people are comfortable with
Project Goals and Objectives
To develop a program that will respond to user input in an accurate manner and provide relevant
feedback using the C++ language. The project aims at having a ‘self-contained’ program, with all
Artificial Intelligence (AI) bots
A Chabot is a computer program that can undertake conversation using textual or audio with human
beings, being able to mimic human language behavior; they are widely used at present. Chabot’s
utilize NLP techniques in analyzing input sentences and then generate suitable outputs. Presently,
two AI trends are predominant; as human like as possible bots that can pass the Turing test and
another trend is Chatbots that can give users help, without the users realizing that they are dealing
with a bot, for instance, the Siri application by Apple. These types of bots can attain very high
levels of accuracy because they have a narrow scope of use (Scagliarini and Varone, 2017).
Healthy Lifestyle
Presently, achieving a healthy lifestyle requires either reading content from the web or books, or
consulting a healthy lifestyle consultant. These processes either consume a lot of time or finances,
or both. These factors make it a less attractive prospect for a majority of the population, with
research showing that in the USA, for example, less than 3% of the population follow a healthy
lifestyle, according to Beck (2016) based on statistics from the Mayo Clinic Proceedings. These are
very disturbing statistics; The CDC (2017) shows that the leading causes of death for American are
chronic diseases such as stroke, cancer, heart disease, Type 2 Diabetes, and arthritis. Not only are
they leading killers, but are among the most common as well as costly causes of health problems,
yet are they easily preventable if only people could adopt healthier lifestyles. By 2012, half of all
adults in the US suffered some form of chronic lifestyle health condition. In the UK, the Health
Secretary in 2013 reported that the five big killers that include lung, liver, heart disease, stroke, and
cancer accounted for 150000 annual deaths among people below age 75 in England; 30000 of those
deaths were entirely avoidable (Roberts 2013). Further, according to Bodkin (2017), one third of
Britons are at risk of early death due to an unhealthy lifestyle devoid of any exercise based on
studies by the British Heart Foundation. Further, even for those that exercise, there is a big risk of
illnesses because of spending a lot of time sitting at work (Hruby and Hu, 2014). The figures and
statistics point to a dire situation in healthy lifestyles and require a new approach that makes the
best use of available technology. A chatter bot would offer an inexpensive and interesting solution
that can help enhance healthy lifestyles among people because it’s readily available, cost effective,
and is based on technology that a lot more people are comfortable with
Project Goals and Objectives
To develop a program that will respond to user input in an accurate manner and provide relevant
feedback using the C++ language. The project aims at having a ‘self-contained’ program, with all
aspects of AI integrated into it to make it easy to use and deploy in various environments without
having to use specific platforms to use it. This design project aims at having a program that can
learn adaptively, give correct responses, and be trained to be an effective healthy lifestyle
‘consultant’.
Design, Training, and Testing
A basic program that can take input and give a suitable result can easily be designed in C++, for
instance the one shown below;
//Basic C++ program to output specific results
#include <iostream>
#include <cstring>
#include <ctime>
Int main ()
{
std::string Response[] = {
“I AM FINE”
“HOW IS YOUR DAY?”
“SO TELL ME ABOUT YESTERDAY”
“VERY INTERESTING”
‘ARE THINGS GONNA GET BETTER?”
};
srand((unsigned) time(NULL));
std::string sInput = “”;
std::string sResponse = “”;
while(1) {
std::cout <<”>”;
std::getline(Std::cin, sInput);
int nSelection = rand() % 5;
sResponse = Response[nSelection];
std::cout <<sResponse <<std::endl;
}
return 0;
}
having to use specific platforms to use it. This design project aims at having a program that can
learn adaptively, give correct responses, and be trained to be an effective healthy lifestyle
‘consultant’.
Design, Training, and Testing
A basic program that can take input and give a suitable result can easily be designed in C++, for
instance the one shown below;
//Basic C++ program to output specific results
#include <iostream>
#include <cstring>
#include <ctime>
Int main ()
{
std::string Response[] = {
“I AM FINE”
“HOW IS YOUR DAY?”
“SO TELL ME ABOUT YESTERDAY”
“VERY INTERESTING”
‘ARE THINGS GONNA GET BETTER?”
};
srand((unsigned) time(NULL));
std::string sInput = “”;
std::string sResponse = “”;
while(1) {
std::cout <<”>”;
std::getline(Std::cin, sInput);
int nSelection = rand() % 5;
sResponse = Response[nSelection];
std::cout <<sResponse <<std::endl;
}
return 0;
}
This is a simple program built in C++; however, it cannot interpret input outside of the design
parameters; it only has a fixed output with a small vocabulary. The aim is to use AI principles,
machine learning, NLP, and training to make the program more intelligent and be able to think and
respond logically. The above example shows the program is not making effort to understand the
user input and repeats itself often as there is no mechanism for controlling the repetition. Using
keywords, the program can be made to understand user input better. A keyword is recognized by the
program that enables it to react and respond accordingly. This requires a knowledge database being
added to the program so it can ‘understand’ some words and sentences, such as knowing “HOW
ARE YOU TODAY” when a user types these into it. To prevent repetition by the Chabot, the
sPrevResponse was used to store the previous response it made so that it does not repeat it. Further,
the Chabot was only able to respond to upper case input; this was improved so that it is not case
sensitive. The idea is to have the Chabot should use key words to match a response from its
database, rather than using exact sentence matching. Key words and the concept of Fuzzy String
Search were used to enable the Chatbot match responses without exact sentence matching. This
entailed breaking inputs into separate words and then creates two vectors that are different. The first
vector stores words for input and the second vector store words for current key word. Using the
Levenshtein Distance concept, the ‘distance’ between two word vectors can be measured; the
Chatbot was then programmed to stop repeating sentences and classes used for encapsulating the
Chatbot implementation as the code became bigger. The database was enhanced using more words
and terms and the null aspect also programmed, so that, for instance, if a user presses enter without
typing any words, the Chatbot gives an appropriate response. The Chatbot was designed to be able
to detect slight changes in words and respond intelligently; for instance is asked
‘How can I lose weight?’
And ‘What can I do to lose weight?’
The Chatbot was programmed so that it knows these two sentences mean the same thing; this is part
of machine learning and incorporation of AI into the Chatbot. These were tested and evaluated after
building the Chatbot and confirmed to be true. The Chatbot was then programmed to be able to
select the most suitable response, save previous inputs, save previous response to stop repetition,
and to find matches based on Fuzzy Logic. States were introduced so that a null input sets it into a
null state and keyword boundaries set for more accurate responses but putting a character before
and after key words in the database. The program then has ‘sign on’ messages so that the Chatbot
parameters; it only has a fixed output with a small vocabulary. The aim is to use AI principles,
machine learning, NLP, and training to make the program more intelligent and be able to think and
respond logically. The above example shows the program is not making effort to understand the
user input and repeats itself often as there is no mechanism for controlling the repetition. Using
keywords, the program can be made to understand user input better. A keyword is recognized by the
program that enables it to react and respond accordingly. This requires a knowledge database being
added to the program so it can ‘understand’ some words and sentences, such as knowing “HOW
ARE YOU TODAY” when a user types these into it. To prevent repetition by the Chabot, the
sPrevResponse was used to store the previous response it made so that it does not repeat it. Further,
the Chabot was only able to respond to upper case input; this was improved so that it is not case
sensitive. The idea is to have the Chabot should use key words to match a response from its
database, rather than using exact sentence matching. Key words and the concept of Fuzzy String
Search were used to enable the Chatbot match responses without exact sentence matching. This
entailed breaking inputs into separate words and then creates two vectors that are different. The first
vector stores words for input and the second vector store words for current key word. Using the
Levenshtein Distance concept, the ‘distance’ between two word vectors can be measured; the
Chatbot was then programmed to stop repeating sentences and classes used for encapsulating the
Chatbot implementation as the code became bigger. The database was enhanced using more words
and terms and the null aspect also programmed, so that, for instance, if a user presses enter without
typing any words, the Chatbot gives an appropriate response. The Chatbot was designed to be able
to detect slight changes in words and respond intelligently; for instance is asked
‘How can I lose weight?’
And ‘What can I do to lose weight?’
The Chatbot was programmed so that it knows these two sentences mean the same thing; this is part
of machine learning and incorporation of AI into the Chatbot. These were tested and evaluated after
building the Chatbot and confirmed to be true. The Chatbot was then programmed to be able to
select the most suitable response, save previous inputs, save previous response to stop repetition,
and to find matches based on Fuzzy Logic. States were introduced so that a null input sets it into a
null state and keyword boundaries set for more accurate responses but putting a character before
and after key words in the database. The program then has ‘sign on’ messages so that the Chatbot
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
can initiate conversation, rather than waiting for input. Keywords must be ranked to make
conversations more realistic with equivalent keywords added, with template response and keyword
transposition. Keywords can be located at any place within a sentence; the Chatbot was made to
distinguish these keywords based on location. The Chatbot was then programmed to handle the
context of conversation. The program was optimized since the database kept growing; a flat file was
implemented to store the database so that the database can be improved/ modified, without Re-
compiling the program every time changes are made to the database. This was done following
notations used in the ELIZA bot with lines representing specific aspects;
Lines starting with [LETTER] in the database Represents
K Keywords
R Responses
S Sign on messages
T Transpositions
E Possible corrections
N Responses for no input by user
X Response when there is no matching keyword
found
W Responses when user repeats self
C Context of present Chatbot response
# Comments
An algorithm to better handle repetition was developed and then implemented where a list of all
responses the Chatbot selected is made and a search made when a new response is made for past
stored responses. The algorithm was designed to make a comparison of total available responses so
that if the position plus one is less (inferior) to the total responses available, it was treated as
repetition. The present repetitive response is then discarded and the Chatbot selects another suitable
response, matching input with the responses in its database. The database was updated with new
keywords through implementing a command to store user input in a file (‘unknown’ text file) to
make keywords updating easy; the words in the file are simply looked up. The Chatbot was then
programmed to save conversation logs to help establish Chatbot weaknesses in certain
conversations for purposes of improving its performance. To train the Chatbot to learn, any word
conversations more realistic with equivalent keywords added, with template response and keyword
transposition. Keywords can be located at any place within a sentence; the Chatbot was made to
distinguish these keywords based on location. The Chatbot was then programmed to handle the
context of conversation. The program was optimized since the database kept growing; a flat file was
implemented to store the database so that the database can be improved/ modified, without Re-
compiling the program every time changes are made to the database. This was done following
notations used in the ELIZA bot with lines representing specific aspects;
Lines starting with [LETTER] in the database Represents
K Keywords
R Responses
S Sign on messages
T Transpositions
E Possible corrections
N Responses for no input by user
X Response when there is no matching keyword
found
W Responses when user repeats self
C Context of present Chatbot response
# Comments
An algorithm to better handle repetition was developed and then implemented where a list of all
responses the Chatbot selected is made and a search made when a new response is made for past
stored responses. The algorithm was designed to make a comparison of total available responses so
that if the position plus one is less (inferior) to the total responses available, it was treated as
repetition. The present repetitive response is then discarded and the Chatbot selects another suitable
response, matching input with the responses in its database. The database was updated with new
keywords through implementing a command to store user input in a file (‘unknown’ text file) to
make keywords updating easy; the words in the file are simply looked up. The Chatbot was then
programmed to save conversation logs to help establish Chatbot weaknesses in certain
conversations for purposes of improving its performance. To train the Chatbot to learn, any word
that the Chatbot did not find a match for elicited a response by prompting the user on the unmatched
word during the testing phase. The tester then added a new keyword and its corresponding response
in the Chatbot database. This was done using the following algorithm
No State Action
1 No keyword found for input Please enter keyword
2 Keyword is ‘Key’
3 (If response is no) Please enter the keyword (go to step 2 above)
4 N response found for keyword (key) Please enter response
5 So the response is (resp)
6 (If response is no) Please enter response (go to step 4 above)
7 Keyword and response successfully
learned
8 Is there any other key word I need to
learn
9 (If response is yes, otherwise continue
with chat)
Please enter keyword (go to step 2)
This way, a functional Chatbot written with C++ was created and tested; the Chatbot is able to use a
few keywords and match responses in its database, giving out suitable responses. If words are not
found, it was able to prompt the user during testing to input a response and a corresponding
response in the database.
Critical Evaluation
Developing the Chatbot was not without challenges; the C++ language had its challenges with bugs
and run time errors. Further, at the initial stages, the Chatbot would give responses, but most were
repetitive, requiring adding new commands and instructions to stop repetition. Even after coding it
so it could not repeat sentences, there was a problem with giving responses to inputs that did not
match exact sentences; this was solved using fuzzy logic rule based system to provide a wider range
of responses. Training the Chatbot to learn inputs, be able to choose the right or suitable response
without repetition and approach or pass the Turing test was an interesting challenge that has given
me in depth understanding on the theoretical and practical aspects of AI and the rules that govern
how an AI application such as a Chatbot operates. I now clearly understand the concepts of NLP,
word during the testing phase. The tester then added a new keyword and its corresponding response
in the Chatbot database. This was done using the following algorithm
No State Action
1 No keyword found for input Please enter keyword
2 Keyword is ‘Key’
3 (If response is no) Please enter the keyword (go to step 2 above)
4 N response found for keyword (key) Please enter response
5 So the response is (resp)
6 (If response is no) Please enter response (go to step 4 above)
7 Keyword and response successfully
learned
8 Is there any other key word I need to
learn
9 (If response is yes, otherwise continue
with chat)
Please enter keyword (go to step 2)
This way, a functional Chatbot written with C++ was created and tested; the Chatbot is able to use a
few keywords and match responses in its database, giving out suitable responses. If words are not
found, it was able to prompt the user during testing to input a response and a corresponding
response in the database.
Critical Evaluation
Developing the Chatbot was not without challenges; the C++ language had its challenges with bugs
and run time errors. Further, at the initial stages, the Chatbot would give responses, but most were
repetitive, requiring adding new commands and instructions to stop repetition. Even after coding it
so it could not repeat sentences, there was a problem with giving responses to inputs that did not
match exact sentences; this was solved using fuzzy logic rule based system to provide a wider range
of responses. Training the Chatbot to learn inputs, be able to choose the right or suitable response
without repetition and approach or pass the Turing test was an interesting challenge that has given
me in depth understanding on the theoretical and practical aspects of AI and the rules that govern
how an AI application such as a Chatbot operates. I now clearly understand the concepts of NLP,
the Levenshtein Distance concept as applied in Fuzzy Logic, and programming a Chatbot to store
past input so that it does not repeat previous responses. This project has given me invaluable lessons
on how algorithms work and how to develop them using a language like C++
past input so that it does not repeat previous responses. This project has given me invaluable lessons
on how algorithms work and how to develop them using a language like C++
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
References
Beck, J. (2016). Less Than 3 Percent of Americans Live a ’Healthy Lifestyle’. [online] The Atlantic.
Available at: https://www.theatlantic.com/health/archive/2016/03/less-than-3-percent-of-americans-
live-a-healthy-lifestyle/475065/ [Accessed 30 Dec. 2017].
Bhatnagar, P., Wickramasinghe, K., Wilkins, E. and Townsend, N. (2016). Trends in the
epidemiology of cardiovascular disease in the UK. BMJ, [online] 102(24), pp.1945–1952. Available
at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5256396/.
Bottou, L. (2014). From machine learning to machine reasoning. Machine Learning, 94(2), pp.133-
149.
'CDC' (2017). Chronic Disease Overview | Publications | Chronic Disease Prevention and Health
Promotion | CDC. [online] Cdc.gov. Available at:
https://www.cdc.gov/chronicdisease/overview/index.htm [Accessed 30 Dec. 2017].
Green, S., Heer, J. and Manning, C. (2015). Natural Language Translation at the Intersection of AI
and HCI. Queue - HCI, 12(6).
Henderson, H. (2007). Artificial Intelligence: Mirrors for the Mind. 1st ed. New York: Chelsea
House, pp.126-130.
Hirschberg, J. and Manning, C. (2015). Advances in natural language processing. Science,
349(6245), pp.261-266.
Hruby, A. and Hu, F. (2014). The Epidemiology of Obesity: A Big Picture. PharmacoEconomics,
[online] 33(7), pp.673-689. Available at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4859313/.
Khan, R. and Das, A. (2017). Build Better Chatbots: A Complete Guide to Getting Started with
Chatbots. 1st ed. New York: APress, Springer Science, pp.1-3.
Kumar, R. (2017). Natural Language Processing. Machine Learning and Cognition in Enterprises,
4, pp.65-73.
Pappachan, M. (2011). Increasing prevalence of lifestyle diseases: high time for action. Indian
Journal of Medical Research, [online] 134(2). Available at:
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3181012/ [Accessed 30 Dec. 2017].
Radford, A., Metz, L. and Chintala, S. (2017). Unsupervised representation learning with deep
convolutional generative adversarial networks. Cornell University.
Beck, J. (2016). Less Than 3 Percent of Americans Live a ’Healthy Lifestyle’. [online] The Atlantic.
Available at: https://www.theatlantic.com/health/archive/2016/03/less-than-3-percent-of-americans-
live-a-healthy-lifestyle/475065/ [Accessed 30 Dec. 2017].
Bhatnagar, P., Wickramasinghe, K., Wilkins, E. and Townsend, N. (2016). Trends in the
epidemiology of cardiovascular disease in the UK. BMJ, [online] 102(24), pp.1945–1952. Available
at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5256396/.
Bottou, L. (2014). From machine learning to machine reasoning. Machine Learning, 94(2), pp.133-
149.
'CDC' (2017). Chronic Disease Overview | Publications | Chronic Disease Prevention and Health
Promotion | CDC. [online] Cdc.gov. Available at:
https://www.cdc.gov/chronicdisease/overview/index.htm [Accessed 30 Dec. 2017].
Green, S., Heer, J. and Manning, C. (2015). Natural Language Translation at the Intersection of AI
and HCI. Queue - HCI, 12(6).
Henderson, H. (2007). Artificial Intelligence: Mirrors for the Mind. 1st ed. New York: Chelsea
House, pp.126-130.
Hirschberg, J. and Manning, C. (2015). Advances in natural language processing. Science,
349(6245), pp.261-266.
Hruby, A. and Hu, F. (2014). The Epidemiology of Obesity: A Big Picture. PharmacoEconomics,
[online] 33(7), pp.673-689. Available at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4859313/.
Khan, R. and Das, A. (2017). Build Better Chatbots: A Complete Guide to Getting Started with
Chatbots. 1st ed. New York: APress, Springer Science, pp.1-3.
Kumar, R. (2017). Natural Language Processing. Machine Learning and Cognition in Enterprises,
4, pp.65-73.
Pappachan, M. (2011). Increasing prevalence of lifestyle diseases: high time for action. Indian
Journal of Medical Research, [online] 134(2). Available at:
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3181012/ [Accessed 30 Dec. 2017].
Radford, A., Metz, L. and Chintala, S. (2017). Unsupervised representation learning with deep
convolutional generative adversarial networks. Cornell University.
1 out of 11
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024 | Zucol Services PVT LTD | All rights reserved.