0% found this document useful (0 votes)
109 views6 pages

Chatbot Using TensorFlow For Small Businesses

The document discusses developing a chatbot using TensorFlow for small businesses that can follow the context of a conversation by maintaining the training of a neural network model and using natural language processing techniques, and provides an example of a chatbot created to provide college admission information to students through a web interface.

Uploaded by

Aakash Wagle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views6 pages

Chatbot Using TensorFlow For Small Businesses

The document discusses developing a chatbot using TensorFlow for small businesses that can follow the context of a conversation by maintaining the training of a neural network model and using natural language processing techniques, and provides an example of a chatbot created to provide college admission information to students through a web interface.

Uploaded by

Aakash Wagle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Proceedings of the 2nd International Conference on Inventive Communication and Computational Technologies (ICICCT 2018)

IEEE Xplore Compliant - Part Number: CFP18BAC-ART; ISBN:978-1-5386-1974-2

Chatbot using TensorFlow for small Businesses


5
1
Rupesh Singh 3
Manmath Paste Nirmala Shinde
(Student) (Student) (Assistant Professor)
Department of Computer Engineering Department of Computer Engineering Department of Computer Engineering
K J Somaiya College of Engineering K J Somaiya College of Engineering K J Somaiya College of Engineering
Mumbai, India Mumbai, India Mumbai, India
[email protected] [email protected] [email protected]

2 4
Harshkumar Patel Nitin Mishra
(Student) (Student)
Department of Computer Engineering Department of Computer Engineering
K J Somaiya College of Engineering K J Somaiya College of Engineering
Mumbai, India Mumbai, India
[email protected] [email protected]

Abstract— Chatbots are software used in entertainment where response is nothing but manipulated version of user
industry, businesses and user support. Chatbots are modeled on query e.g. Eliza.
various techniques such as knowledge base, machine learning
based. Machine learning based chatbots yields more practical Small businesses and small startups generally have a high
results. Chatbot which gives responses based on the context of customer to employee’s rate. They cannot attend to every
conversation tends to be more user friendly. The chatbot we are customer personally. Such small businesses need automation in
proposing demonstrates a method of developing chatbot which can their customer support system. Chatbot can automate the
follow the context of the conversation. This method uses customer support part. Chatbot can increase the profits by
TensorFlow for developing the neural network model of the
decreasing the resources strain. We here provide the method for
chatbot and uses the nlp techniques to maintain the context of the
conversation. This chatbots can be used in small industries or
making such chatbots that a small company can make with very
business for automating customer care as user queries will be little resources. This can be useful for many other organizations
handled by chatbots thus reducing need of human labour and such as universities and colleges, as displayed in our demo.
expenditure.

Keywords— Chatbots; Neural Networks; Machine learning; In this project, we created a chatbot which will provide
Conversational models; Machine translation; Artificial intelligence; information about admission in K.J. Somaiya college of
Statistics; Computational linguistics; Natural language processing; engineering to the student through web interface using
Text mining; TensorFlow; Tflearn. TensorFlow and NLP techniques. Thus, our bot will act as a
person at enquiry office whom they can ask any questions
regarding admission and college environment at any time in
more interactive way. Thus, reducing workload of the
I. INTRODUCTION admission cell personnel. This system can be integrated on
Chatbots are simple computer programs that interacts with college website and thus students who desires to get admission
users using natural language. The interaction can be textual or in the college can clear their doubts from their home. we have
auditory depending upon the need. The popularity of this bots provided a feedback mechanism through will user can rate bot’s
are increasing every day and are used in various practical responses and thus bot can respond more accurately next time.
applications which include customer service, information
TensorFlow is used to create Neural model on which bot will
acquisition and dialogue systems. This bot uses Natural
be trained based on intent file. This model can be updated as
language processing techniques for understanding user query
and when new rule is implemented in the college. This bot can
and give response. Now there are bots which uses fixed
maintain context and can give responses based on context.
response techniques where user query is searched for fixed
Thus, this paper focuses on the sample bot which can be used
keywords and returns response which matches the most with
as a reference for creating chatbots for many other purposes.
the query. Also, some bots use string manipulation techniques
The paper talks about the methods and technologies used in

978-1-5386-1974-2/18/$31.00 ©2018 IEEE 1614

Authorized licensed use limited to: Somaiya University. Downloaded on January 30,2023 at 14:03:16 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the 2nd International Conference on Inventive Communication and Computational Technologies (ICICCT 2018)
IEEE Xplore Compliant - Part Number: CFP18BAC-ART; ISBN:978-1-5386-1974-2

creating this chatbot, and why some things are preferred over standard replies that ELIZA would use if a keyword is not
other. The paper by explaining the inner working of this sample found. Some examples would be “Very interesting, please go
chatbot explains the proposed methodology of developing on” or “Can you think of a special example?”.
similar purpose chatbot.

In the following sections we discuss:

1. Existing chatbots and there strong and weak points.


2. How the proposed chatbot can act as a reference for
creating similar bots for small businesses.
3. Inner working of the proposed method and algorithms
used.
4. Result of the proposed system and comparison with
other methods.

Figure 1: Chatting session with Eliza.

II. RELATED WORK


ALICE

Few Chatbots with useful applications are presented. We will ALICE was implemented by Richard Wallace in 1995 [6]. Eliza
discuss about ELIZA and ALICE as of now. was source of inspiration for Alice. It is a natural language
processing bot which uses pattern matching for retrieving
ELIZA responses. The information is stored in Artificial Intelligence
Markup Language also known as AIML files. AIML files were
specifically designed to store pattern knowledge base for
The first chatbot developed was ELIZA [1]. It was developed chatbots. These files are like XML files. AIML are of three
by Joseph Weizenbaum using a keyword matching and string categories.
manipulation techniques. When user provides the query, this
chatbot searches for certain keyword. These keywords were Atomic categories: [6]
already defined and if found then the response was retrieved. If In this AIML category there is exact match and thus response is
not found, then Eliza would perform certain string manipulation generated directly.
techniques or use certain rules to obtain detail knowledge from <category>
the user to continue the interaction. <pattern>What is your name? </pattern>
<template>My name is john</template>
Consider the following example to understand how this would </category>
work.
Default categories: [11]
USER: How can I get in touch with my mother? Default categories are general form of input query which makes
use of wild character such as * so as to match user submitted
Clearly ‘Mother’ is the keyword in the given user query, so query.
the bot will try to find words related to mother like family. <category>
Then by using some string operation it will give an answer. <pattern>What is *</pattern>
<template>It is my name</template>
ELIZA: Tell me more about your family </category>

Also, Eliza uses string manipulation techniques where it If response is not generated using first category it will proceed
replaces some words from user query and gives it as a response. to this category. Consider if user enters, “what is john?”, Alice
will search for default category and if match is found response
USER: I am fine is displayed.

ELIZA: How long have you been fine? Recursive categories: In this category special tags are used to
specify recursion and get more information form user [8,9].
The chatbot doesn't understand what it is saying. It only
produces results according to rules, static responses and string
manipulation. However most of the time there are some

978-1-5386-1974-2/18/$31.00 ©2018 IEEE 1615

Authorized licensed use limited to: Somaiya University. Downloaded on January 30,2023 at 14:03:16 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the 2nd International Conference on Inventive Communication and Computational Technologies (ICICCT 2018)
IEEE Xplore Compliant - Part Number: CFP18BAC-ART; ISBN:978-1-5386-1974-2

1. User interface

The user interface can be in the form of anything from desktop


to phone and web. The interface in the example is a web
interface. The interface will also work as the instruction guide
for the users. The user will get all the information needed to
understand the system in here. The main purpose of the
interface will be to take the queries and convey them to the
backend which consist of tensor module and feedback system.
The interface works as a medium between the backend and user.

2. Neural Model and NLP Unit


Figure 2: Chatting session with Alice

This module is the main core of the whole system. This is the
III. PROPOSED SYSTEM part which generates the actual response for the user query. First
the model is defined using TensorFlow which is trained using
intent file created. Intent file is in form of json file which is as
follows:
The proposed system uses the machine learning at its core. The
proposed system uses the TensorFlow to make a neural network
{"tag": "admission_enquiry",
and train it with intent file to generate a response model. This
"patterns": ["i have some doubts regarding process", "I want
response model can be used to predict the response from the
to know about admission process", "enquiry about
query of the user. The proposed system consists of three main
admission"],
parts
"responses": ["Okay, what do you wanna know?", "what are
you doubts?", "Okay, you can ask"]
},
1) User Interface
{"tag": "application_date",
2) Neural network model and NLP unit
"patterns": ["when do i apply?", "What is the due date for
3) Feedback System
application?", "what is last date of the application?","what
is starting date of the application?" ],
"responses": ["Application process will remain open at 04th
of July to 14th of august", "from 4th July to 14th
august","you can apply from 4th july to 14th august"]
},
{"tag":"Application_form",
"patterns":["how to avail admission form?","From where to
have admission form?","where can I get an application
form? "],
"responses":["Application form for admission is available at
the Somaiya website","from somaiya website","you can get
forms from somaiya website","visit somaiya website for
forms"]
},
{"tag":"Location",
"patterns":["where is the location of the college?","College is
located at?","How to reach college?"],
"responses":["Somaiya college of engineering is Located
near vidyavihar station at central railway.","College is
located in mumbai near vidyavihar railway station."]
},

It consist of three parts i.e. Tags, Patterns , Responses. The tag


is nothing but context of that query. It defines what query is
about. Patterns and responses as name suggests is used to train
Figure 3: Architecture the model with sentences and get corresponding responses.
Patterns are loaded and passed through query modulation

978-1-5386-1974-2/18/$31.00 ©2018 IEEE 1616

Authorized licensed use limited to: Somaiya University. Downloaded on January 30,2023 at 14:03:16 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the 2nd International Conference on Inventive Communication and Computational Technologies (ICICCT 2018)
IEEE Xplore Compliant - Part Number: CFP18BAC-ART; ISBN:978-1-5386-1974-2

process. Here NLP takes place where various functions are In this case model predicted two intent Hosel_availability with
applied in form of pipeline which includes [2] probability of 0.6343 and greeting with probability of 0.166 as
Sentences -> Tokenization -> Lemmatization -> POS-tagging. Threshold is 0.15 as of now. The intent with higher probability
This data is then stored in form of bag of words which is used is selected and response is generated accordingly.
as input to training model. We have used bag of words
technique for feature extraction. Feed forward network is QUERY: activities related to sports
created using tensorflow with 4 layers (1 Input layer + 2 hidden PREDICTION: [('Sport_support', 0.99963164)]
layer + 1 output layer). Trained model is saved which is used RESPONSE: Skream is a national…...
for predicting responses taking input as user query.

During training, the model creates a bag of words array which


3. Feedback System
is collection of all unique words. Now when query is passed, it
goes through query modulation process and converted to bag of
words. Here the words which are present is represented by 1 The database stores the intent file which is crucial part of the
while others as 0. training and response. User interface will be provided with
functionality through which user can rate the response and this
Consider the query will be stored in database along with responses. Next time when
QUERY:how to get admission in college? user gives query, response model will give response based on
the feedback i.e. this response will be checked for ranking and
Following is bag of words representation for the given query: highest-ranking response will be displayed. This ranking will
be integer based with 5 having highest ranking. Initially all the
[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 responses will be set to default 0 and as and when user interacts
0000000000000000000000000010000000 with the bot it will be updated.
0000000000000000000000000000000000
0000000000100000000000010000100000
0000000000000000000000000000000000 IV. RESULTS
0000000000000000000000000000000000
0000000000000000000 00000000000010 We have used machine learning approach to create a bot in this
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] paper. Chatbots based on machine learning does not understand
the meaning of sentences. It learns how to respond based on
Now when user gives query this query will be passed through previous experience. Though we have used some NLP
same query modulation process and converted into bag of functions but the actual process through which response is
words. This will be given as input to model and model will generated is using machine learning. As said earlier, we created
return all the tags that have probabilities greater than error the model and trained it with the intent file thus more diverse
threshold defined. Then response model will select the response the intent file more accurate will be the result. This model is
which will be more accurate and having greater ranking given used to predict the tag based on the user query.
by feedback System. Now coming to the responsiveness of the proposed chatbot
which is response generation and maintaining the context of the
QUERY: Hello conversation, the bot performs quite efficiently if the query
PREDICTION: [('greeting', 0.98416048)] asked is simple and in accordance to the intent file created.
RESPONSE: Hello, thanks for visiting Also, context is maintained to some extent. For checking the
efficiency of the system, we conducted a small experiment
Here model predicted intent greeting with probability of 0.98 where we asked 10 people to interact with the bot and give their
feedback. These people where students and their parents who
QUERY: How to get admission in college? went through the admission process and have to wait in long
PREDICTION: [('Admission_process', 0.99881846)] queue in the college just to get their doubts cleared. The results
RESPONSE: For admission person should follow the given are plotted in the following graph.
steps….

Similarly here model predicted intent Admission process with


probability of 0.9988

QUERY: Any hostel facilities available


PREDICTION:[('Hostel_availability', 0.63436478), ('greeting',
0.16629744)]
RESPONSE: There are two hostels available for students.

978-1-5386-1974-2/18/$31.00 ©2018 IEEE 1617

Authorized licensed use limited to: Somaiya University. Downloaded on January 30,2023 at 14:03:16 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the 2nd International Conference on Inventive Communication and Computational Technologies (ICICCT 2018)
IEEE Xplore Compliant - Part Number: CFP18BAC-ART; ISBN:978-1-5386-1974-2

form 0.99642229]

5 who is somaiya Principal of [('Who_Princi


college somaiya college of pal',
principal engineering is 0.4513315),
XXXX XXX ('Founder',
0.40391245]

6 how to get For admission [('Admission_


* admission form person should process',
follow the given 0.7114048),
steps…….. ('Application_
form',
0.16649978]

7 where is college Somaiya college of [('Location',


Figure 4: Output Graph located engineering is 0.86157036]
Located near
vidyavihar station
Each person asked different number of question depending at central railway.
upon their requirement. The graph plots the satisfactory
(Correct) vs unsatisfactory(wrong) responses. for eg, person1 8 what are we do not accept [('payments_
feels 60% of the responses were correct while 40% were wrong. payment cash, but net modes',
Thus taking the whole experiment into consideration, total 108 modes? banking , card 0.98774439]
questions where asked out of which 74 where satisfactory payment will do
which gives accuracy of 68.51%. This accuracy can further be
enhanced with more varied intent file. 9 mode of Net banking. [('payments_
payment modes',
0.80774439]

Following are some of the interactions performed and


TABLE 1: RESULTS prediction given. On an average, out of 10 queries asked the bot
give 6-7 responses correct. But again, it depends upon the way
S QUERY RESPONSE PROBABILI- questions are framed. It is assumed the user has good English
R. TY knowledge and can interact with the system properly. With
N increase in the dataset this accuracy can further be enhanced,
O and system can be made more efficient

1 hii Hello, thanks for [('greeting',


visiting 0.24204822), V. CONCLUSION
('Location',
0.2273401)] Main objective of this project was to provide a system to create
chatbot which can be used by small businesses as a replacement
2 enquiry about what are you [('admission_ of customer support.
admission doubts? enquiry', The method demonstrated was successful to some extent in
0.99886227] creating chatbots when the domain is small but, the result got
will get more accurate as the size of intent file increases. The
3 what is basic require- ment [('Eligibility_ accuracy of the chatbot is directly proportional to the size of
eligibility is 12th (provided nationality, intent file used for training the chatbot. With small domain it is
criteria for you clear the cut 0.99982148] relatively easy to create the intent files that will yield a certain
admission off) level of accuracy. This method is clearly suitable in situation
where the domain is narrow, and user interact with some
relevance.
4 From where to visit somaiya [('Application
get application website for forms _form',

978-1-5386-1974-2/18/$31.00 ©2018 IEEE 1618

Authorized licensed use limited to: Somaiya University. Downloaded on January 30,2023 at 14:03:16 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the 2nd International Conference on Inventive Communication and Computational Technologies (ICICCT 2018)
IEEE Xplore Compliant - Part Number: CFP18BAC-ART; ISBN:978-1-5386-1974-2

VI. FUTURE SCOPE [8] B.A shawar and E. Atwell, “Evaluation of Chatbot Information System,
in Eighth Maghrebian Conference on Software Engineering and Artificial
Intelligence.
The method presented uses solely machine learning with some
helping natural language processing for converting the intent [9] B.A shawar and E. Atwell, “JLCL,”2007. [Online]. Available:
into bag of words. The method can be improved by using some http://www.jlcl.org/2007_heft1/Bayan_Abu-
additional level natural language processing. The natural shawar_and_Eric_Atwell.pdf
language processing can be used to do sentiment analysis which
can complement the machine learning predictor. The [10] B. Setiaji and F. W. Wibowo, "Chatbot Using a Knowledge in Database:
Human-to-Machine Conversation Modeling," in Intelligent \ Systems,
sentimental part can be analyzed using natural language Modelling and Simulation (ISMS), 2016 7th International Conference on,
processing which will emphasize on the keywords in the user Bangkok, Thailand.
query which can be very useful in reducing the error in
prediction. [11] B. R. Ranoliya, N. Raghuwanshi and S. Singh, "Chatbot for university
related FAQs," in Advances in Computing, Communications and
Instead of using natural language processing to perform the Informatics (ICACCI), 2017.
sentimental analysis and find out the key aspect of queries we
can add multiple machine learning neural models to do the
same. The first method is quite hard to achieve as it is very hard
to determine the keywords and emphasis in query using natural
language processing. The machine learning does not understand
sentimental analysis as it is purely based on mathematical
functions.

REFERENCES
[1] A. Vichare, A. Gyani, Y. Shrikhande and N. Rathod, "A chatbot system
demonstrating Intelligent Behaviour using NLP," in International Journal
of Advanced Research in Computer Engineering & Technology
(IJARCET), 10 October 2015. J. Clerk Maxwell, A Treatise on Electricity
and Magnetism, 3rd ed., vol. 2. Oxford: Clarendon, 1892, pp. 68-73.

[2] R. Shah, S. Lahoti and P. L. K., "An Intelligent Chat-bot using Natural
Language Processing," in International Journal of Engineering Research,
1 May 2017. T. L. Gilbert, Formulation, Foundations and Applications of
the Phenomenological Theory of Ferromagnetism, Ph.D. dissertation,
Illinois Inst. Tech., Chicago, IL, 1956, unpublished.

[3] A. Sordoni, M. Galley, M. Auli, C. Brockett, Y. Ji, M. Mitchell, J.-Y. Nie,


J. Gao and B. Dolan, "A Neural Network Approach to Context-Sensitive
Generation of Conversational Responses," in arXiv:1506.06714, 22 June
2015.S. O. Demokritov and V. E. Demidov, “Micro-Brillouin light
scattering spectroscopy of magnetic nanostructures,” IEEE Trans. Magn.,
to be published.

[4] "Contextual chatbots using tensorflow," 2017. [Online]. Available:


https://chatbotsmagazine.com/contextual-chat-bots-with-tensorflow-
4391749d0077.Y. Yorozu, M. Hirano, K. Oka, and Y. Tagawa, “Electron
spectroscopy studies on magneto-optical media and plastic substrate
interface,” IEEE Transl. J. Magn. Jpn., vol. 2, pp. 740-741, August 1987
[Dig. 9th Annual Conf. Magn. Jpn., p. 301, 1982].

[5] "Make bots great again," 30 September 2016. [Online]. Available:


http://blog.datatonic.com/2016/09/make-bots-great-again.html.

[6] "Cornell University Library," 2014. [Online]. Available:


https://arxiv.org/ftp/arxiv/papers/1408/1408.6762.pdf.

[7] "Text Classification using Neural Networks," 2017. [Online]. Available:


https://machinelearnings.co/text-classification-using-neural-networks-
f5cd7b8765c6.

978-1-5386-1974-2/18/$31.00 ©2018 IEEE 1619

Authorized licensed use limited to: Somaiya University. Downloaded on January 30,2023 at 14:03:16 UTC from IEEE Xplore. Restrictions apply.

You might also like