You are on page 1of 32

​ABSTRACT

​A chatbot is a conversational agent where a computer program is designed to stimulate


an intelligent conversation . It can take user input in many formats like
text,voice,sentiments,etc. For this purpose, many open source platforms are available.
Artificial Intelligence Markup language(AIML) is derived from Extensible Markup
language(XML) which is used to build up a conversational agent(chatbot). Some of the
examples of messenger chatbots are lyft,Fandango,spotify,sephora,Natasha(hike).

A chatbot can be used anywhere a human is interacting with a computer system. These
are the areas where the fastest adoption is occurring. A chatbot can be used as an
“assistant” to live agent,increasing the agent’s efficiency.When trained , they can also
provide service when the call center is closed,or eventually even as an independent agent,if
desired.it can provide 24/7 service they also improve customer satisfaction.it can even
clarify doubts of agents without human intervention.

1
​ ​1. INTRODUCTION
1.1 Introduction to project
The project is titled as chatbot A virtual assistant.the motto of the project is to assist the
customer with the support by using a conversational agent where a computer program is
designed to stimulate an intelligent conversation . It can take user input in many formats like
text,voice,sentiments,etc..When trained , they can also provide service when the call center is
closed,or eventually even as an independent agent,if desired.it can provide 24/7 service they
also improve customer satisfaction.it can even clarify doubts of agents without human
interference.

1.2 Project overview


Assisting the customer by solving his queries even though when there is no customer support
present

1.1.2 Existing chat bots and their information


1.Uber
Uber is also using messaging apps to target their customers. Uber users can now hail a
ride through facebook messenger using uber bots, where they will receive notifications on the
status of their booking, or within conversations with friends when a location is communicated.
This again reduces the steps to completion for the customer and allows them to make purchases
without leaving their preferred app
2.Pizza Hut
Pizza Hut have tapped into their customer base by using chatbots to make customer
purchase easier Food orders can now be taken through Facebook Messenger and Twitter which
are linked to the customer’s Pizza Hut account. This allows the bot to suggest recent orders to
the customer and take payment from the messaging app, targeting the applications that their
customers are already using and massively reducing the steps to purchase.

2
3.Whole Bots
Now, it may not be Einstein, but Whole Foods’ Facebook Messenger Bot is just as
exciting, connecting with users by providing recipes, products, and cooking
inspiration.presenting filters and options for different types of food, including international
cuisines with each message, Whole Foods makes it easy for users to narrow in on the kind of
recipe they’re looking for. Once enough filters have been selected, the bot presents a link to a
specific recipe that directs users to the company’s website.

​ 1.2.1.2 Proposed System

​ ​The existing chatbots majorly work on social media purposes but the bot we created can be
extended for multiple uses such as hospital management ,food suggestion management
Business management ,library management

Food suggestion bot which is available in any language.

Here we are going to create a new chat bot which is very much helpful to the people to order
food on online .It will answers the queries like how to select the food,price of the food,and the
best restaurants near by you.It will ask you which type of food does the customer wants?.
It will gives the information status about confirmation of the food that has been ordered by the
customer.It also gives the information about different recipe and the best food available around
you?.

​How it is different?

By using python coding and Natural Language Processing(NLP),we are going to create this in
multiple languages(Local Languages also).in this way it is helpful to all the customers who
are not proficient in language.Because if you take any app or website the basic language to
work with it is english.so,in this way it is helpful to all the customers.

3
2. REQUIREMENT ENGINEERING

2.1 HARDWARE REQUIREMENTS


The hardware requirements of the project are:
A pc or mobile or tablet

2.2 SOFTWARE REQUIREMENTS


❏ The software requirements of the project are:
❏ Dialog flow
❏ Spyder IDE to write python programs
❏ Slack
❏ Web demo

4
​3. ​LITERATURE SURVEY
Natural language processing (NLP) is the ability of a computer program to understand human

language as it is spoken. NLP is a component of artificial intelligence (AI).

The development of NLP applications is challenging because computers traditionally require


humans to "speak" to them in a programming language that is precise, unambiguous and highly
structured, or through a limited number of clearly enunciated voice commands. Human speech,
however, is not always precise -- it is often ambiguous and the linguistic structure can depend on
many complex variables, including slang, regional dialects and social context.

As we begin down the path of creating a chat-based & utilitarian mobile experience for
museums, it’s important to note that we on the Studio team do not consider ourselves to be
experts in chatbots, artificial intelligence or conversational interfaces. We do consider ourselves
to be experts in experience design and creative technology, but not chatbots. Yet. By the end of
this year-long process we hope to be much closer to the expert side of the chatbot spectrum than
the novice side. Acknowledging this, our primary goal right now is to learn as much as possible
(as quickly as possible) from the experts that do exist within the bot domain.

5
4. TECHNOLOGY

PYTHON TOOL​:
Python is considered as one of the widest used machine learning tool.It has many other
features that attract the data science community. Being a data science tool, Python helps to
explore the concepts of machine learning in the best way possible. Machine Learning is all
about probability, mathematical optimization, and statistics, which are all made easy by Python.
There are lot of inbuilt machine Learning packages which will make machine learning Handy
with python. What drives developers to Python is that it is easy to learn and code. It promotes
an easy-to-understand syntax especially when compared to other data science languages, such
as R and thereby leads to a shorter learning curve.
The reason for growing success of Python is the availability of data science libraries for
aspiring candidates. These libraries have been upgraded continuously. The constraints that
developers faced a year ago are now treated successfully with Python.

DIALOG FLOW
Dialog flow is a Google-owned developer of human-computer interaction technologies
based on natural language conversations. This is best known for creating the Assistant
by(speakoit​)​, a virtual buddy for Android, ios, and windows ​phone smartphones that performs
tasks and answers users question in a natural language. Speaktoit has also created a natural
language processing engine that incorporates conversation context like dialogue history,
location and user preferences.

SLACK
Slack is an American cloud-based set of proprietary team collaboration tools and
services, ]​ Slack began as an internal tool used by a company, tiny speak, in the development of
glich,​ a now defunct online game. The name is an acronym for "Searchable Log of All
Conversation and Knowledge”,including persistent chat rooms (channels) organized by topic,

6
private groups and direct messaging.Slack integrates with a large number of third-party services
and supports community-built integrations. Major integrations include services such as google
drive, trello, dropbox, box, heroku, IBM bluemix, crashlytics, github, runscope, zendesk and
zapier.Slack provides Api to users to create applications and to automate processes, such as
sending automatic notifications based on human input, sending alerts on specified conditions,
and automatically creating internal support tickets. The Slack API has been noted for its
compatibility with many types of applications, frameworks, and services

JSON
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy
for humans to read and write. It is easy for machines to parse and generate. It is based on a
subset of the javascript is a programming ​language. JSON is a text format that is completely
language independent but uses conventions that are familiar to programmers of the C-family of
languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These
properties make JSON an ideal data-interchange language.

7
5. DESIGN REQUIREMENT ENGINEERING

5.1 System Architecture

These architecture explains about the working of a chatbot and explains how it internally works
on a given query and replies for customer and helps him clarify his doubts
Designing Bots​: Creating Conversational Interfaces
This book hasn’t even been out a month, but it’s already become our North Star. Shevat is one
of the smartest thinkers in the bot space and this book is the most comprehensive resource
we’ve found relating to design and development considerations
The Ultimate Guide to Chatbots: Why they’re disrupting UX and best practices for building
Why Chat May Be King of the New Mobile Landscape

8
5.2 UML DIAGRAMS

UML (Unified Modeling Language) is a modeling language used by software


developers. UML can be used to develop diagrams and provide users with ready-to-use,
expressive modeling examples.UML can be used for modeling a system independent of a
platform language. UML is a graphical language for visualizing, specifying, constructing, and
documenting information about software-intensive systems. UML gives a standard way to write
a system model, covering conceptual ideas.

TYPES OF UML DIAGRAMS

1.use case diagram


2.class diagram
3.sequence diagram
4.collaboration diagram
5.activity diagram
6.state chart diagram
7.component diagram
8.deployment diagram

9
5.3 USE CASE DIAGRAM

A use case diagram at its simplest is a representation of a user's interaction with the system that
shows the relationship between the user and the different use cases in which the user is
involved.
Actors are customer,message channel,chatbot api.
These diagrams explain static states and working of the chat bot

10
​ 5.4 CLASS DIAGRAM
The class diagram is the main building block of object-oriented modeling. It is used for general
conceptual modeling of the structure of the application, and for detailed modeling translating
the models into programming code. Class diagrams can also be used for data modeling. The
classes in a class diagram represent both the main elements, interactions in the application, and
the classes to be programmed.

11
5.5 SEQUENCE DIAGRAM

A sequence diagram shows object interactions arranged in time sequence. It depicts the objects
and classes involved in the scenario and the sequence of messages exchanged between the
objects needed to carry out the functionality of the scenario. Sequence diagrams are typically
associated with use case realizations in the Logical View of the system under development.
Sequence diagrams are sometimes called event diagrams or event scenarios.

12
5.6 COLLABORATION DIAGRAM

UML collaboration/communication diagrams like UML sequence diagrams, are used to explore
the dynamic nature of your software. Collaboration diagrams show the message flow between
objects in an OO application, and also imply the basic associations (relationships) between
classes.

13
​ 5.7 ACTIVITY DIAGRAM

Activity diagrams are graphical representations of workflows of stepwise activities and


actions[1] with support for choice, iteration and concurrency. In the Unified Modeling
Language, activity diagrams are intended to model both computational and organizational
processes (i.e., workflows), as well as the data flows intersecting with the related activities.

14
​5.8 COMPONENT DIAGRAM

A component is something required to execute a stereotype function. Examples of stereotypes


in components include executables, documents, database tables, files, and library files.
Components are wired together by using an assembly connector to connect the required
interface of one component with the provided interface of another component.

15
​5.9 DEPLOYMENT DIAGRAM

A deployment diagram in the Unified Modeling Language models the physical deployment of
artifacts on nodes. To describe a web site, for example, a deployment diagram would show
what hardware components ("nodes") exist (e.g., a web server, an application server, and a
database server), what software components ("artifacts") run on each node (e.g., web
application, database), and how the different pieces are connected

16
6.IMPLEMENTATION

6.1 MODULES

Here we divided the the work into three modules

MODULE 1​: we have first wrote python code to


1.generate the data
2.to train the model
3.validate the input

MODULE 2​: ​we trained a bot with relevant answers asked by a customer and we also trained it
for replies to be given to the customer for his doubt clarification

MODULE 3​: ​we integrated the bot with slack by creating a work space to work on and he we
can chat with the bot

17
List of figures

1.​ ​Login with Dialogflow


​In the very first , we have to login with Dialog Flow module.​Dialog flow is a Google-owned
developer of human–computer interaction technologies based on natural language
conversations. The company is best known for creating the Assistant, a virtual buddy for
Android, iOS, and Windows Phone smartphones that performs tasks and answers users'
question in a natural language​.

18
2 .Working with dialog flow

After creating an account in dialog flow we have many attributes in dialog flow
flat-form.the basic attributes are intents,entities,integration,knowledge
fulfillment,training,account….etc.
​ Intents are used to train the model with different questions and answers.
Multiple similar type of questions and answers can be trained at a time using this intent.
After opening the intents(by clicking on intents button), we have create our own intent
By giving our own name.then we can train multiple questions to the chat bot ,by adding
Different questions in training phrases work space.
In the similar way multiple answers Can be trained to the chat bot by adding
multiple answers in the text responses work space.After the training the model with multiple
questions and answers we should click on save button.then training will be completed with one
minute.

19
3. Integrations with dialog flow

By using dialog flow flat-form we can connect it into different devices like
facebook messenger ,web demo,slack,Amazon Alexa….etc.
Whatever we have trained for the model the training outcomes will be reflected to different
flat-forms .the accuracy of the model depends on the number of different questions and answers
that we have trained our model.if we trained more questions and answers then output will be
clear and accurate.

20
4. Working of slack work space
​Slack is new kind of messaging for teams bringing all your communication
It need to be authorized for creating the chatroom the user has to get signed
Up for slack

21
5. Working model of slack

22
6. Working of web demo

It creates a space for user to check the bot created for its successful functioning .

23
6.2 Code snippet

import pandas as pd
import numpy as np
import random
l1=['hi','hello!','hola']
r1=['hi','hi there!','hii','what can i do for you?','hello,how can i help you?']
l2=['how are you','how do you do','how the things going on']
r2=['well','good','nice']
l3=['I want to eat something','I am very hungry','I am so hungry','I want to eat something']
r3=['which sort of food do you prefer south indian north indian chinese bakery desserts
other']
l4=['north indian']
r4=['roti with dal tadka roti with butter chicken roti with chole bhature tomato pulao']
l5=['south indian']
r5=['sambar rice curd rice thalis meals']
l6=['chinese']
r6=['momos noodles fried rice manchuria']/=
l7=['bakery']
r7=['puffs pastries sandwiches cakes']
l8=['desserts']
r8=['ice-cream milkshakes brownies sweets']
l9=['other']
r9=['italian mexican american']
l10=['thali']
r10=['veg-thali non veg-thali']
l11=['bakery']
r11=['puffs pastries sandwiches cakes']
l12=['chinese']
r12=['momos noodles fried rice manchuria']
l13=['thank you!','thanks!','thanks alot']
r13=['you are welcome','welcome','it is nice to chat with you']

24
while True:
k=input("<")
if k in l1:
print(random.choice(r1))
elif k in l2:
print(random.choice(r2))
elif k in l3:
print(random.choice(r3))
elif k in l4:
print(random.choice(r4))
elif k in l5:
print(random.choice(r5))
elif k in l6:
print(random.choice(r6))
elif k in l7:
print(random.choice(r7))
elif k in l8:
print(random.choice(r8))
elif k in l9:
print(random.choice(r9))
elif k in l10:
print(random.choice(r10))
elif k in l11:
print(random.choice(r11))
elif k in l12:
print(random.choice(r12))
elif k in l13:
print(random.choice(r13))
else:
print("i can't understand what you are saying")

25
output

26
​ 7. SOFTWARE TESTING

7.1 Unit Testing

​ UNIT TESTING is a level of software testing where individual units/ components of a software
are tested. The purpose is to validate that each unit of the software performs as designed. A unit
is the smallest testable part of any software. It usually has one or a few inputs and usually a
single output. In procedural programming, a unit may be an individual program, function,
procedure, etc. In object-oriented programming, the smallest unit is a method, which may belong
to a base/ super class, abstract class or derived/ child class. (Some treat a module of an
application as a unit. This is to be discouraged as there will probably be many individual units
within that module.) Unit testing frameworks, drivers, stubs, and mock/ fake objects are used to
assist in unit testing.

7.2 Integration Testing


​ Integration Testing​ ​ is a level of software testing where individual units are combined
and tested as a group. The purpose of this level of testing is to expose faults in the interaction
between integrated units. Test drivers and test stubs are used to assist in Integration Testing.

7.3 System Testing

​System​ ​is a level of software testing where a complete and integrated software is
tested. The purpose of this test is to evaluate the system’s compliance with the specified
requirements

27
7.4 Acceptance Testing

​Acceptance Testing is a level of software testing where a system is tested for


acceptability. The purpose of this test is to evaluate the system’s compliance with the business
requirements and assess whether it is acceptable for delivery.

Acceptance Testing Formal testing with respect to user needs, requirements, and business
processes conducted to determine whether or not a system satisfies the acceptance criteria and to
enable the user, customers or other authorized entity to determine whether or not to accept the
system.

28
​ 8. RESULTS

The bot we have trained using dialog flow and natural language processing(nlp)

Gives 85% a accurate reply to the customer.

​ ​ 9. CONCLUSION AND FUTURE ENHANCEMENTS

9.1 Conclusion

Our project is about chat bot for food instructions.our project has been developed using natural
processing using Dialog flow platform.

9.2 Future Enhancement

The bot can be further trained to think on its own by using Artificial intelligence and by
including online libraries.

29
BIBLIOGRAPHY

https://dialogflow.com/

https://console.dialogflow.com/api-client/#/agent/45c15589-082e-4889-a289-8376cd947f8a/in
tents

https://searchbusinessanalytics.techtarget.com/definition/natural-language-processing-NLP

https://bot-griet.slack.com/oauth/593216051172.6741efa41082be3a90009aa2c6b6af3d003d4
cd01702dd7e123dc69eeb82be09

https://bot.dialogflow.com/45c15589-082e-4889-a289-8376cd947f8a

http://softwaretestingfundamentals.com/software-testing-basics/

30
31

You might also like