“Hello, How are you??”, when asked by a human, another human involved in the same conversation would reply with “I am fine❤️, what about you?”. Here we can see the emotions of the person in the texts exchanged between them which the bots may lack, but is it so in the present world?
There are several different bots which respond to various human emotions, they depict a human-like conversation whenever a human texts them, they are indeed backed up by Artificial Intelligence(AI) programs which understand and analyse the feeling of a human being by computing the facial emotions using heavy and complex algorithms. These algorithms are meant to analyse the human face and map the stress, happiness or sadness that the human is experiencing at that current moment.
To compute these kinds of dynamic constraints i.e. the emotions we need to have a self-learning program i.e. a program that can learn from itself each time it is invoked. This part of the program can be called as Artificially Intelligent. Chatbots here basically serve various different purposes including the functional and non-functional attributes. Chatbots are used as a helping aid to comfort the user in order to resolve and assist the user with the solution by replying instantly unlike humans. They differ according to the basic requirement they are made for, these include the platform that they have to be deployed to, the requirements and the functionality and many more aspects like that.
According to Wikipedia:
“A chatbot (also known as a talkbot, chatterbot, Bot, IM bot, interactive agent, or Artificial Conversational Entity) is a computer program which conducts a conversation via auditory or textual methods. Such programs are often designed to convincingly simulate how a human would behave as a conversational partner, thereby passing the Turing test. Chatbots are typically used in dialog systems for various practical purposes including customer service or information acquisition. Some chatterbots use sophisticated natural language processing systems, but many simpler systems scan for keywords within the input, then pull a reply with the most matching keywords, or the most similar wording pattern, from a database.”
Suppose you are a salesman who has to travel every day and let’s assume that you don’t have any weather app installed on your device, what would you do to make your day successful and productive??
The above problem set may have various different approaches but we have to choose an approach which is practically feasible, accurate, and which can be “predictable”. Here “predictable” refers to the user-interface design, how likely can the user predict the output screen that would be appearing on his/her device?
Here we can code and develop a functional bot on platforms such as messenger, twitter etc which would reply the salesman the current weather data whenever the bot receives a message such as “What’s the weather like” or “Current temperature in ” or any such keyword which deal with dynamically altering information. This approach reduces wastage of time on the client/user side hence improvising the interaction.
Let’s assume that you are in a depressed state of mind because of a series of events and your mental health is quite low, you don’t have any human available to contact at that particular instance, what would you do to feel good??
Well, we have chatbots which are intelligent enough to enact human-like behaviour in the most natural way by having an emotionally uplifting conversation with the user by reacting and reciprocating to the texts of the user. These types of bots are generally deployed over social media or on Mental health websites where humans who are emotionally not feeling well would or who would have suicidal tendencies text their health condition or text about how they feel to the bot, and the bot analyses the texts and based on the previous records it would reciprocate accordingly by making the human feel comfortable and less stressed.
How Does It Work??
When we develop a chatbot, we need to first establish a base knowledge/idea about what type of bot do we need, a functional one or a pure chatbot. The difference lies when it comes to the application part. The functional bot would be able to get you dynamic data i.e. weather data, current trends, cricket/football score etc, which will be defined in the bot to get from a destined XML file/data file. The data here will be retrieved by mining from various different websites.
Whereas pure chatbots would have thousands or even lakhs of datasets from which the bot would select a random reply and would be given back to the user, depending on the texts/messages received from the user respectively.
Google Allo is one of the finest examples in the BOT world, it’s basically a smart messaging app which learns from the texts sent by the user ever time and sends customized replies to the user. If two or more people are involved in a conversation on Google Allo then it suggests the replies to both the involved individuals by understanding the context of their respective texts. The suggestions/help is provided by the Google Assistant whenever you refer to it, by typing in “@google” followed by the query.
Google Allo can be referred as a chatbot but it’s a partial chatbot encompassing the features of a functional bot whereas Casper is a chatbot which aims for insomnias, and analyses the sleep cycle of such people and texts them whether they are awake or not and accordingly react to the situations via texts by asking them to sleep, or getting them to sleep via different activities.
The working of a chatbot which is powered by Artificial Intelligence(AI) has few different stages/steps defined in it such as;
- Analysing the texts.
- Understanding the context of the texts by comparing it with previous texts and their contexts.
- Segregating the keywords in the text and categorizing them into various emotion/keyword-based collection.
- Understanding the keyword and its context used and retrieving a reply from the datasets.
- Sending it back to the target (involved user).
Not all chatbots follow the same methodology but each bot has its own dataset, i.e. a collection of replies for every specific keyword entered by the user. When we consider datasets we aren’t dealing with a datasets of few Gigabytes, here we are dealing with datasets which are of Petabytes or more, because our grammar is not limited to few words we encounter a new word each day and hence increasing the probability to get a new word from the user every single time.
Not only do these bots retrieve information from their respective datasets but can also retrieve data from a search engine if their code is embedded with search engine API like Google, Bing, Yahoo etc.
Chatbots are basically programs that can conversate with human in a most-human likely manner, by default its not mandatory for the chatbot to be intelligent, its according to us and what type of functionality we provide to the chatbot, a chatbot in simple words needs to be useful, usable, user-friendly and adaptable to an extent.
Perception is where chatbot knows what the user wants, this is done by chatbot by providing buttons/options which the user can select, this is when the bot already computes the ways and gives options unlike an intelligent bot hence it will remove the option which is not there.
For example, when you are buying clothes and the only colour available is “red” out of “Red” and “blue” then it will remove the button option for “blue” colour hence giving user one option, this approach lacks fluidity however and hence not intelligent enough to please any human, this might lead to user frustration.
Chatbots have to hence analyse and store the input for future purpose when they would receive such kind of texts, they will know what type of message to send using AI. This can be achieved by text classification i.e. classifying the texts either according to the emotions or according to the situation. Text classification is achieved by multidimensional Naïve Bayes algorithm, which is a classic algorithm used for text classification and NLP (Natural Language Processing).
Each word is treated as having no connection with other words in the sentence being classified i.e. each word is considered to be independent at first place and later classified. For example, take a sample sentence “John is playing with a ball”, Here “John”, “playing” and “ball” has no relationship at present when we start the process of classification, we ought to assume that they have nothing in common. These are called tokens i.e. words in a sentence, and this is nothing but a bag full of words/tokens which is derived out of a sentence.
There are various different steps in text classification such as Tokenization, storing tokens/Storing, Stemming, and performing list operations. Whenever the user texts or sends any message to the chatbot, the text classification algorithm segregates the sentence into “words” used to form the sentence. Tokenization in simple words is “John is playing with a ball” is tokenized to “John”, “is”, “playing”, “with”, “a”, “ball”.
Stemming is a type of analytical process where the tokens/the words are reduced to their stem i.e. to their originated word/origin word. For example, “Have” stems to “Hav” which further allows it to be matched with “having” (same stem). “Greet” stems to “Greeting” and so does “Hi” stems to “Hello”.
//Input the sentence/text from user
// perform tokenization
// split the text
words = text.split()
//for each word in the line
for word in words:
- print the word print(word)
- //Perform stemming
//stemmed elements/store tokens
//create a list and store the tokens in different lists.
// and so on and so forth we can add various different lists representing various human emotions or texts.
// return or print cheerful message to user
else if(reply equalto())
//return or print reply accordingly to the user
// scan in tokens to find appropriate reply for the users text and send it to user.
//to include results from search engine i.e. dynamic web data
//display dynamic data in dialog box
With the emerging Artificial Intelligence and Machine Learning, we can observe a significant change in self-learning in bots from the various different inputs and from the web, hence increasing the productivity.
Chatbots now have emerged into a new phase where they are deployed everywhere, from simple chatbots to medical field, covering all major fields such as science, entertainment, query-resolving and processing, finance, architecture, agriculture and what not.
There are infinite variations and updations that can be performed on the present day bots which will hence act as helping hand to the human community by playing various different roles in various different fields of work. Chatbots hence do not only assist humans but also correct humans by learning from various different test cases/scenarios which are near to perfection.
Research article on “Chatbots and Artificial Intelligence” made possible with the guidance and help of,
Head of Department(Information Technology)
SreeNidhi Institute of Science and Technology,
Researched and Published by,
Parimi Shiva Kalyan, IT-F4, 15311A12N9, SNIST
*Not for reproduction