Ai Virtual Assistant: Karthikeyan R (Urk18Cs120)
Ai Virtual Assistant: Karthikeyan R (Urk18Cs120)
KARTHIKEYAN R (URK18CS120)
BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE AND ENGINEERING
MARCH-2021
BONAFIDE CERTIFICATE
This is to certify that the project report entitled, “AI virtual assistant” is a bonafide record of
Mini Project work done during the even semester of the academic year 2020-2021 by
in partial fulfillment of the requirements for the award of the degree of Bachelor of Technology
in Computer Science and Engineering of Karunya Institute of Technology and Sciences.
First and foremost, I praise and thank ALMIGTHY GOD whose blessings have bestowed
I am grateful to our beloved founders Late.Dr. D.G.S. Dhinakaran, C.A.I.I.B, Ph.D and
Dr. Paul Dhinakaran, M.B.A, Ph.D, for their love and always remembering us in their prayers.
I extend my thanks to our Vice Chancellor Dr.P. Mannar Jawahar, Ph.Dand our
Registrar Dr. Elijah Blessing, M.E., Ph.D,for giving me this opportunity to do the project.
I would like to thank Dr. Prince Arulraj, M.E., Ph.D.,Dean, School of Engineering and
Technology for his direction and invaluable support to complete the same.
I would like to place my heart-felt thanks and gratitude toDr. J. Immanuel John Raja,
and guidance.
I also thank all the staff members of the Department for extending their helping hands to
I would also like to thank all my friends and my parents who have prayed and helped me
Acknowledgement i
Abstract ii
1. Introduction
1.1 Introduction 6
1.2 Objectives 6
1.3 Motivation 7
1.4 Literature Review 7
1.5 Methodology 8
1.6 Overview of the Project 9
1.7 Chapter wise Summary 9
2. Analysis and Design 10
2.1 Functional Requirements 10
2.2 Non-Functional Requirements 10
2.3 Architecture 11
2.4 Use case diagram 12
2.5. Sequence Diagram 14
3. Implementation 15
3.1. Modules Description 16
3.2. Implementation Details 17
3.3. Tools used 26
4. Test results/experiments/verification. 27
4.1. Testing 28
4.2. Results 29
4.3. Verification 29
5. Conclusions and Further Scope 30
References 31
1.1 INTRODUCTION
In today’s era almost all tasks are digitalized. We have Smartphone in hands and it is
nothing less than having world at your finger tips. These days we aren’t even using fingers. We
just speak of the task and it is done. There exist systems where we can say Text Dad, “I’ll be late
today.” And the text is sent. That is the task of a Virtual Assistant. Well, I had a thought before I
started making my very own “Virtual Assistant”. Though it is not as capable and high as like
Amazon’s Alexa or Google Assistant, Home or Apple’s Siri or JARVIS from Iron Man.
Nowadays, People are troubled by typing commands into the computer. Be it procrastination or a
busy schedule. Typing is a big obsolete process. The solution to this is that we switch over to an
assistant which understands us and do the initial work for us.
It also supports specialized task such as booking a flight, or finding cheapest book online from
various e-commerce sites and then providing an interface to book an order are helping automate
search, discovery and online order operations. An assistant is the best replacement for typing
commands t his project was started on the premise that there is sufficient amount of openly
available data and information on the web that can be utilized to build a virtual assistant that has
access to making intelligent decisions for routine user activities.
1.2 OBJECTIVES
A virtual assistant is a skilled professional who can assist you with those mundane tasks
which are time-consuming and repetitive in nature. Virtual assistants are a shared resource,
which means they can work with multiple tasks handling a wide variety of tasks for each of
them. A virtual assistant can play the role of an online research assistant, social media assistant,
administrative assistant, travel assistant, email assistant, among others.
Social media assistant: Set up and manage social media accounts, schedule and post
relevant content, answer queries, moderate comments on behalf of the client.
Travel assistant: Create itineraries for the client including required travel and hotel
accommodations, provide recommendations for cultural events, restaurants, etc.
Email assistant: Manage inbox by replying on behalf of the client, setting rules and
filters for emails, etc.
These are only some of the roles and responsibilities that our virtual assistants handle
successfully on a daily basis. We will discuss more about following topics.
1.3 MOTIVATION
A virtual assistant typically operates from a home, office but can access the necessary
planning documents, such as shared calendars, remotely. The main motivation of the
project is reduce the time of users and increase the efficiency in a easy way.There’s
no need to buy a costly home assistants or any virtual assistants its cheaper and gives
good perfomance. Virtual assistant are best for small scale business even for the large
business. But large business always have strong budget they always having a option
but when you come to small scale business they having low budget and have to make
everything in time and perfect.As a small scale or personal virtual assistant will be
there for you like a personal assistant only better - available around the clock, experts
in various fields that you can make use of, they do everything from business tasks to
personal errands, helps a lot when you are really busy or running out of time or
simply don’t need to put in the effort yourself or appointing a person for your
personal. Your business is growing more and more and you are busier now more than
ever. You could use an extra set of hands for handling client’s call in a professional
manner and provide you instant support staff service. It’s all are motivations and then
we are going to discuss about overview of the projects and implementations.
This research could be is a chunk of a bigger project concerning virtual voice assistant
briefed by theories in human machine interaction. Moreover speech recognition has a brief
history with numerous waves of innovations. Voice recognition for dictation, hunt and voice
command has become vital feature on personal devices: like wearable devices and smart
phone’s This system has International Research Journal of Engineering and Technology
some basic features and most importantly mailing and secondly calendar, where user has the
privilege to mail and able to create their required event by providing voice commands. For
instance, if we use artificial intelligence we can are able to turn off the lights without the
instruction given by the user. Almost, everyone has some knowledge about trending voice
assistant like cortana for windows, and Siri for apple users, these virtual voice assistants
aren’t as brainy and intelligent as Ironman's Jarvis which appear in the superhero movie, but
the intended actions are almost similar by virtual voice assistant. It’s like you need a ask
question, and within a few fraction of seconds you will get an answer. It’s just given a
command and gets result.
1.5 METHODOLOGY
Virtual Personal Assistance works on real time, as its give the required output
instantaneously. As we give the command to it via the mic the speech or command that we
have given is first processed and then it is converted to text, then form the text the keys
words are extracted and then check with the modules which is stored in the local hard drive,
if the keywords match with any of the modules then that particular module will be executed,
if the key word doesn’t matches with any of the modules than it will just tell the use to try
again or it didn’t understand what the user wants. As we are using speech recognition as out
speech to text converter, we get the option to store the conversation that we had with our
Virtual Personal Assistance and we can use it later to make more modules easily. We divide
methodology in two parts: knowledge abstraction and implementation. Knowledge
abstraction has to do with the analysis of course content (which we will call data). On the
other hand, implementation depends on the characteristics of the data generated in the
process of knowledge abstraction, and also, it depends on the features of the tools available
for Dialogflow and its various integrations finally testing is executed.
Above all the topics we discussed about how the project is created and what’s the
purpose of the project. Then we are going to study about the materials used in a
project ,implementation process and control systems case diagrams and python
programming and how virtual assistant designed .And briefly discuss about artificial
intelligence and test our programs which it will work or not and verify the process.
After installation and programs are verified successfully we are going to discuss
about future of the process and how to improve our model also how to add someof the
features into our virtual assistant.
Figure-1(Architecture diagram.1)
Figure-3
A sequence diagram is an interaction diagram that shows how objects operate with one another
and in what order. It is a construct of a message sequence chart.
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
Figure-5(Sequence diagram)
Figure-7
After the program is successful the mic starts and it waits for user to speak, when the mic
receives the data it converts the data into the text format. The text is then matched with the action
which is to be performed. Action is performed.
Now, I will start by stating what I want this program to do. This program will run specific
commands once a wake word is given by the user’s voice. This program will then execute those
commands audibly back to the user.
For example, the user may say ‘Hey assistant, what’s the time now?’ or ‘what’s today’s date?’
and the virtual assistant will respond accordingly.
Now, let’s write a short description of what this program is going to do in comments.
Next import some of the libraries that will be important for this program. We will use the
warnings library to ignore the some of the error we get in this program. The library speech
recognition is used to recognize speech.
The os library will allow us to interact with the Operating System. The gtts library will help us
convert text to speech. The Wikipedia library will allow us to get information about a person
from Wikipedia. The date time library will allow us to get the current date and time. The
calendar library will allow us to get the day of the week, and the random library will be used for
randomization
First we need a function that can take in audio (a voice command) and recognize the speech, then
return that speech as a string (text). Let’s call this function recordAudio()
def speak(audio):
rate = engine.getProperty('rate')
newVoiceRate = 190
engine.setProperty('rate', newVoiceRate)
engine.say(audio)
engine.runAndWait()
We now have a function to record the audio. Let’s create a another function for the program to
respond back to the user audible and call it assistantResponse(). The function will take in a
string (text) and convert it to audio. I will also have this function print the text to the screen for
testing purposes. Selenium Web Driver is a collection of open source APIs which are used to
automate the testing of a web application. This tool is used to automate web application testing
to verify that it works as expected. It supports many browsers such as Safari, Firefox, IE, and
Chrome.
With the help of the takeCommand() function, our virtual assistant will be able to return a string
output by taking microphone input from our audio.
def takecommand():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
r.pause_threshold=0.8
audio=r.listen(source)
try:
print("Recognizing...")
query = r.recognize_google(audio)
print(f"User Said: {query}\n")
except Exception as e:
print("Say that again please...")
return "None"
return query
speak(audio):
Current time
hour = int(datetime.datetime.now().hour)
if hour>=0 and hour<12:
speak ("Good Morning sir")
In the above code, we are using datetime() function and storing the current time of the system
into a variable called strTime.
After storing the time in strTime, we are passing this variable as an argument in speak function.
Now, the time string will be converted into the speech.
Simple Mail Transfer Protocol (SMTP) is a protocol that allows us to send emails and to
route emails between mail servers.
An instance method called send mail is present in the SMTP module. This instance method
allows us to send an email.
It takes 3 parameters:
The message: A string message which needs to be sent to one or more than one recipient.
Now, we will create a sendEmail() function, which will help us to send emails to one or more
than one recipients.
server =smtplib.SMTP('smtp.gmail.com',587)
server.ehlo()
server.starttls()
server.login('[email protected]','karthik007@')
server.sendmail('[email protected]',to,content)
server.close()
peak(audio):
Note that, in a nutshell, goggle is not allowing you to log in via smtplib because it has flagged
this sort of login as "less secure", so what you have to do is go to this link while you're logged in
to your goggle account, and allow the access.
After successfully installing wikipedia module, import the wikipedia module into the program by
writing an import statement.
taskperformlist()
speak('searching wikipedia...')
results=wikipedia.summary(query, sentences=2)
speak("According to Wikipedia")
print(results)
speak(results)
In the above code, we have used an if statement to check whether Wikipedia is in the search
query of the user or not. If Wikipedia is found in the user’s search query, then two sentences
(which you can change by changing the number of sentences from 2 to any number you want)
from the summary of the Wikipedia page will be converted to speech with the help of the speak
function. After identify the specific information it will add the word “According to Wikipedia”.
Here, we are using the elif loop to check whether the Youtube is in the query of the user or not.
Let’ suppose, the user gives a command as “Please, open youtube.”
So, open youtube will be in the user’s query, and the elif condition will be true.
Open Google :We are going to import web browser module in Python which provides an
interface to display Web-based documents. While we are saying commands, PyAudio detect
availability of these commands by matching them. Python has a built-in package called re, which
can be used to work with Regular Expressions.
import re
import webbrowser
The re.search() method takes a regular expression pattern and a string and searches for that
pattern within the string. If the search is successful, search() returns a match object or None
otherwise. Therefore, the search is usually immediately followed by an if-statement to test if the
search succeeded
The code reg_ex = re.search('open google (.*)', command) stores the search result in a variable
named "reg_ex". Then the if-statement tests the match -- if true the search succeeded and group()
is the matching text. Otherwise if the match is false (None to be more specific), then the search
Weather Query If you live in a place where the weather can change on a dime, you may find
yourself searching for the weather every morning to ensure that you are adequately equipped
before leaving the house. This can eat up significant time in the morning, especially if you do it
every day, when the time can be better spent taking care of other things.
To implement this within our digital assistant, we’ll add another if statement that recognizes the
phrase “What is the weather in..?”
3. An email account.
4.Scikit Learn
5.TensorFlow
6.Pycharm
7.MxNet
8.Keras
9.PyTorch
10.CNTK
11.Webbrowser
12.PyAudio
15 Python compiler
4.1 TESTING
The testing process is the most important part in our project here we going to execute the code
and give the commands in the users point of view and next verify process here we will the
assistant is working properly or not. Here user said open goggle keyword to the program and it
will recognize the speech and converted into text then start the operation as per the program.
Figure-9
Next command is open you tube and it will recognize the command then executed the specific
operation.
Figure-10
This is the command about corona virus report and it will open the corona virus page.
Figure-11
27 | P a g e Mini Project 2020-2021
4.2VERIFICATION
Figure-13(Here it’s the output for the google command it will executed and open google.co.in)
When the application is executed it starts remote module in background. When it gets the
command it first tries to match the input with the commands stored in the Ms-Access database if
matched it executes the command accordingly. If not then it check the command for some
hardcoded flows of matched then the relevant output is given to user
CONCLUSION
Through this voice assistant, we have automated various services using a single line command. It
eases most of the tasks of the user like searching the web, retrieving weather forecast details,
vocabulary help and open entertainment tasks . We aim to make this project a complete assistant
and make it smart enough to act as a replacement for a general server administration. The future
plans include integrating this with mobile using React Native to provide a synchronized
experience between the two connected devices. Further, in the long run, it is planned to feature
auto deployment supporting elastic, backup files, and all operations which a general Server
Administrator does. This project describes the approach that is used to develop a personal
assistant. All the technical and implementation details are described to understand the system
better. Most of the basic features needed regularly are implemented though a number of
additional features can be added. Thus we have developed a personal assistant such that all most
of the user tasks are now implemented at the users command easily . In the end, to achieve the
final stage and all these improvements to the new system with high accuracy, we need funding
from an organization that will work with us to improve the system by funding the new hardware
devises that have high accuracy, as well as the tools and cloud severs that we will need for
testing the new system. Though a number of assistants are available in the market for smart
phones, personal assistants for PCs (Windows) are not that popular in our country. An additional
feature of remote access eradicates the limitation of area within which the system can be
accessed. User can now handle PC (Windows) from mobile or other system through a website.
This paper describes the approach that is used to develop a personal assistant. All the technical
and implementation details are described to understand the system better. Most of the basic
features needed regularly are implemented though a number of additional features can be added.
Thus we have developed a personal assistant such that all most of the user tasks are now
implemented at the users command easily and quickly.
Virtual assistants are growing to be prevalent in our day to day lives. Due to good outreach of
smart phones and laptops many of us own at least one virtual assistant in our system it may be
Siri on iPhone or Google Assistant on Android phones. Cortana also has a good reach due to
wide users of Windows 10 and Alexa as a home speaker. All of the 100 users were provided with
the same set of questions which they were supposed to ask to all the four personal assistants.
Survey on Virtual Assistant: Google Assistant, Siri, Cortana, Alexa 199answer and how many
they got right. From whole scenario it nearly came to conclusion that recognizing voice required
number of large different variations such as environment, voice modulation, frequency etc. Main
challenge for voice recognition is that people’s voices vary and they speak in different ways and
in different number of languages. All the IVAs are evolving over time. While all the four IVAs
were capable of answering nearly 17.35% of daily based questions, only Google Assistant was
found to be most efficient by answering 59.80% of the question. Contrary to the expectations,
Siri brought a bit of disappointment by answering only 45%. Whereas Cortana could only cover
one third of the questions. Alexa loss the race badly by only answering 7.91%. That was surely a
terrible defeat. According to our survey, IVAs have quite a poor retention rate, with only 25% of
frequent day to day life users. Alexa, Google Assistant, Siri, and Cortana are at good pace for
betterment over years. It’s quite likely that one day they will actually meet our expectations.
IVA’s are of broader benefits for future then they appeared to be. There is a large portion of
people from disabled community mostly with cognitive disabilities who may have hard time in
forming full sentences and communication, for such people personal assistant can be a deal
breaker. Though there is the place for enhancement in all tested devices new studies can be
conducted and the potential of IVAs can be tested in various untouched areas like education,
banking, business, counseling, sales etc. And also a merger of these devices with various
machine learning technologies and algorithms may give birth to different new possibilities.When
the application is executed it starts remote module in background. When it gets the command it
first tries to match the input with the commands stored in the Ms-Access database if matched it
executes the command accordingly. If not then it check the command for some hardcoded flows
of matched then the relevant output is given to user.
1. Jan Vossaert, Vincent Naessens, Laurens Lemaire “Secure Remote ccess to an Industrial
Generator with Mobile evices” World Con ress on Industrial Control Systems Security
(WCICSS-2015)
2. Chung, H., Iorga, M., Voas, J., Lee, S.: Alexa, can I trust you? In: 2017 IEEE Computer
Security (2017)
3. Lopez, G., Quesada, L., Guerrero, L.A.: Alexa vs Siri vs Cortana vs Google assistant: a
comparison of speech-based natural user interfaces. Conference Paper, January 2018.
4. Kepuska, V., Bohouta, G.: Next generation of virtual personal assistants (Microsoft
Cortana, Apple Siri, Amazon Alexa and Google Home). In: IEEE Conference (2018)
5. https://www.geeksforgeeks.org/build-a-virtual-assistant-using-python/
6. https://www.geeksforgeeks.org/voice-assistant-using-python/
7. https://www.geeksforgeeks.org/building-app-for-google-assistant-without-any-coding/
8. https://www.investopedia.com/terms/v/virtual-assistant.asp
9. https://www.analyticsvidhya.com/blog/2020/09/ai-virtual-assistant-using-python/
10. angeeta Mishra, Rohit Kankal, Sudeep Lunawat, Prashant Ram, Vivek Gupta,
“Interactive Automation Interface using android app and Speech Recognition over
wireless LAN and Internet”, International Conference & Workshop on Electronics &
Telecommunication Engineering (ICWET), February 2016.
11. G B Karan, Dhananjay Kumar, Kiran Pai, J. Manikandan, “Design of a phoneme based
voice controlled home automation system”, IEEE International Conference on Consumer
Electronics-Asia (ICCE-Asia), October 2017.
12. Ayush Panwar, Anandita Singh, Renu Kumawat, Siddharth Jaidka, Kumkum Garg,
“Eyrie smart home automation using Internet of Things”, Computing Conference, July
2017.