Ai Based Personal Voice Assistant
Ai Based Personal Voice Assistant
Ai Based Personal Voice Assistant
Submitted by
JULIE DOLEY
Roll No: 19MCA011
DR. FIROS A.
2022
1
AI BASED PERSONAL VOICE ASSISTANT
Submitted by
JULIE DOLEY
Roll No: 19MCA011
DR. FIROS A.
2022
2
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
RAJIV GANDHI UNIVERSITY
(A central University)
Rono Hills, Doimukh, Itanagar Ph :
Arunachal Pradesh, INDIA Fax :
Email :
CERTIFICATE
3
DECLARATION
Signature
Rajiv Gandhi University
Date: JULIE DOLEY
Roll No: 19MCA011
Email: [email protected]
DEPARTMENT OF
4
COMPUTER SCIENCE & ENGINEERING
RAJIV GANDHI UNIVERSITY
(A central University)
Rono Hills, Doimukh, Itanagar Ph :
Arunachal Pradesh, INDIA Fax :
Email :
CERTIFICATE
This is to certify that the project report entitled “AI BASED
PERSONAL VOICE ASSISTANT title” submitted by Miss. JULIE
DOLEY bearing Roll Number: 19MCA011 of sixth semester in the
academic year 2021-22 is examined and has been found satisfactory, and is
hereby approved as a project work carried out and presented in a manner
required for its acceptance in partial fulfilment for the award of the degree of
Master of Computer Application in the Faculty of Engineering and
Technology of Rajiv Gandhi University.
Signature:
Signature: Signature:
ACKNOWLEDGEMENT
5
With immense pleasure, I acknowledge the help, guidance and support
received from various quarters during the course of my research work. Hence, I hereby
express my gratitude to one and all.
My sincere thanks to my research guide and mentor, Dr. Firos A. for his
immense support and guidance. His vision and suggestions throughout the research
period right from choosing the problem to solving and presenting has been
fundamental in completion of the research work. Prof, you have been a source of
motivation throughout.
I thank all the faculty member and staff of Computer Science and Engineering
department of the Rajiv Gandhi University for their kind cooperation.
Finally, I would like to express my sincere gratitude and love to my parents and
my friends. Their support and confidence during all my life have made me as I am, and
their effort has allowed me to be here completing my degree with the execution of this
project work.
Signature
JULIE DOLEY
Roll No: 19MCA011
ABSTRACT
6
“Voice Assistants” which are also called as intelligent personal assistant or
connected speakers. Voice assistant react to voice commands and give the most relevant
information about the user enquiry. They allow the search to be carried out using a voice
command which is entered by a user. It uses Artificial Intelligence and Voice
recognition, and language processing algorithms and voice synthesis which listens to
specific voice commands and then returns the information related to the searched.
NON-PLAGIARISM REPORT
7
CONTENTS
8
ITEM PAGE NUMBER
CERTIFICATE…………………………………..……...…..................… II
DECLARATION………………………………………......…..………… III
CERTIFICATE ………………………………………......…..………… IV
ACKNOWLEDGEMENT………………………………........……........ V
ABSTRACT…………………………………………………......................VI
CONTENTS……………………………………………………..….…….. VIII-IX
2
1.1. Voice Assistant 3
1.2. 4
Background
1.3. Objective
1.4. Purpose, Scope and Applicability
5
2.2. PyCharm
8
2.2.1. Features of PyCharm
8
2.2.2. Libraries used for development 9
9
CHAPTER 3: SYSTEM REQUIREMENT AND ANALYSIS 11-15
3.3. 14
Project Planning and Scheduling
3.4. Feasibility Study 15
3.5.
3.6. Hardware Requirements
Software Requirements 16
CHAPTER 6: TESTING 36
CHAPTER 7: SCREENSHOTS 37-42
CHAPTER 8: CONCLUSION AND FUTURE SCOPE 43-44
10
REFERENCES 45
TABLES
ITEM No Page
No
FIGURES
11
The System’s Class Diagram
Fig 7 35
CHAPTER 1
12
INTRODUCTION
CHAPTER-1
INTRODUCTION
In today’s date almost every day today tasks are done in digitalized way.
Everybody have Smartphone in their hands and it is nothing less than having the world in
finger tips. These days we aren’t even using our fingers for searching by typing, we just
speak about the task and it is done by those voice assistant devices. There exist systems
where we can say to send text message to someone by only using our own voice and at
very that moment the text will be send to that person. Therefore, that is the task of voice
assistant or as an intelligent personal voice assistant. It also supports various specialized
task such as booking flight, finding things from different e-commerce websites.
They allow the search to be carried out using a voice command which is entered by
a user. It uses Artificial Intelligence and Voice recognition, and language processing
13
algorithms and voice synthesis which listens to specific voice commands and then returns
the information related to the searched.
Voice Assistants are software programs that helps to ease our day today tasks such
as showing weather report, creating reminders, playing music and videos etc. They can
take commands through text or by voice. Voice based intelligent assistants need a word to
activate the listener and followed by the command. This system is manually designed to
be used efficiently on desktops. Personal assistant software improves user productivity by
managing routine tasks of the user and by providing information from online sources to
the user. It is effortless to work as it followed by the command and within a second it gets
executed.
Nowadays voice searches among users have increased and dominated over the
search carried out by text. Web searches through mobile devices have just overtaken by
those searches that is carried out by a computer search and more than 50 percent searches
will be through voice. Voice assistants are turning out to be smarter than ever as it picked
out important information automate processes and deliver personalized responses.
This project is started on the premise that there will be sufficient amount of openly
available data and information on the web (search engine) which can be utilized to build a
personal voice assistant that have access of making intelligent decisions for users.
1.2 BACKGROUND
As we know there exists various voice assistants in the market to do our day today task in
more easy way. Some of the few examples of such voice assistants are discuss here.
14
Alexa is a personal virtual assistant that is voice controlled. It is owned by amazon. It
has various smart features that helps in marketing and shopping as it is a product of
amazon so it can be a personal shopper too.
1.3 OBJECTIVES
● To design a personal voice assistant that take command from user voice and produce
appropriate output according to that.
● To save time while searching queries from different sources.
● To do simple day to day activities and to operate the computer device according to the
user like playing YouTube videos, play music and searching the web etc.
● To utilize speech recognition and text to speech module based on machine learning
with the help of python.
● To develop advance personal voice recognition assistant text to speech conversion
system using artificial intelligence.
15
1.4 PURPOSE SCOPE AND APPLICABILITY
● PURPOSE
● SCOPE
Voice assistants will continue to offer more individualized experiences as they get better
at differentiating between voices. However, it’s not just developers that need to address
the complexity of developing for voice as brands also need to understand the capabilities
of each device and integration and if it makes sense for their specific brand. They will
also need to focus on maintaining a user experience that is consistent within the coming
16
years as complexity becomes more of a concern. This is because the visual interface with
voice assistants is missing. Users simply cannot see or touch a voice interface.
● APPLICABILITY
The mass adoption of artificial intelligence in users’ everyday lives is also fueling the
shift towards voice. The number of IoT devices such as smart thermostats and speakers
are giving voice assistants more utility in a connected user’s life. Smart speakers are the
number one way we are seeing voice being used. Many industry experts even predict that
nearly every application will integrate voice technology in some way in the next 5 years.
The use of virtual assistants can also enhance the system of IoT (Internet of Things).
Twenty years from now, Microsoft and its competitors will be offering personal digital
assistants that will offer the services of a full-time employee usually reserved for the rich
and famous.
CHAPTER 2
SURVEY OF TECHNOLOGY
17
CHAPTER-2
SURVEY OF TECHNOLOGY
Python has a lot of libraries for every need of this project. For Machine learning
based personal assistant the libraries that are used are Speech Recognition for voice
Recognized, Pyttsx3 that is python text to speech conversion for text to speech, selenium
for web automation etc. Python is an efficient language because of its efficiency it
consumes less time and produce efficient code. Therefore, we get more time for
optimization than writing bulky code.
18
2.1.2. IDE (INTEGRATED DEVELPOMENT ENVIORNMENT) USED FOR
THE PROJECT
An IDE consists of an editor and a compiler that we use to write and compile
programs. It has a combination of features required for developing software. The presence
of an IDE makes the development process and programming much easier. It interprets
what we are typing and suggests the relevant keyword to insert. We can distinguish
between a class and a method as the IDE allocates different colors to them. The IDE also
gives different colors for the right and the wrong keywords. If we are writing a wrong
keyword, it tries to predict the keyword that we intend to write and auto completes it.
2.2 PYCHARM
19
2.2.2 LIBARIES USED IN PYCHARM FOR DEVELOPMENT:
20
● DATETIME: Date and Time is used to showing Date and Time. This module comes
built-int with Python.
● SPEAK METHOD
Speak method will help us in taking the voice from the machine. Here is the code
explanation of Speak Method
21
CHAPTER 3
SYSTEM REQUIREMENT AND ANALYSIS
22
CHAPTER 3
Most of the time for completing one task user needs to manage multiple applications
for example, if a user is trying to make some plan like travelling then they need to come
across from various task before reaching their destination like booking tickets etc.
Therefore, a system is necessary that could manage tasks efficiently and effortlessly.
We have multiple voice assistants already but we use those very rarely. People faces
problems in voice recognition and sometimes system fails to understand our accent and
pronouncing as every individual have their own way of pronouncing a thing which is
different from others.
Voice assistants in mobile phones are largely used as compare to desktop voice
assistant application. Therefore, there is a need of voice assistant that can understand
users accent and also work on desktop system.
23
If a voice assistant is not be able to answer to questions accurately then it is because
of the lack of proper context or it do not understand the intent of the questions that have
been asked. To increase its ability to answer to the questions relevantly it needs rigorous
optimization and by involving both humans and machine learning practices. By ensuring
solid quality control strategies continuously will help to manage the risk of the voice
assistant learning undesired behaviors. It required a large amount of information to be fed
in order to work efficiently. Voice assistant should be able to use models to perform
complex task dependencies.
Voice assistants focuses on users to take input from them and then later records the
input. It then used this input to perform the management of applications such as to
operate search engines like Google, Firefox or internet explorer etc. The main focus is
on capturing the user input through voice and then recognizing the input and later
executing the tasks if the voice assistant understands the task. This Software takes
input in natural language to makes it easier for the user to give input that they want to
be done.
Voice recognition software enables the application to be use for free and it allows
the user to search their query through their voice interface. Virtual assistants must
provide a wide variety of services. These include:
24
3.3 PROJECT PLANNING AND SCHEDULING
25
3.4 FEASIBILITY STUDY
Feasibility study can help you determine whether or not you should proceed
with your project. It is essential to evaluate cost and benefit. It is essential to evaluate
cost and benefit of the proposed system. Five types of feasibility study are taken into
consideration.
26
3.5 HARDWARE REQUIREMENTS
27
CHAPTER 4
SYSTEM DESIGN
28
CHAPTER 4
SYSTEM DESIGN
4.1 ACTIVITY DIAGRAM
At first the system will be on idle mode and after receiving a wakeup call it
wakes up and start beginning its execution. Then the received command is then
identified whether it should be questioned or not and according to that it performed
specific action. After performing the task and the system waits for another command
from user and this loop will continues unless it receives stop or quit command. After
receiving the commands and it goes back to sleep.
29
4.2 FLOW CHART DIAGRAM
Start
Send Voice
Command
If no
Does
receive
yes
yes
Continue
to work
No
End
30
Fig 3. Use Case Diagram
In this project there is only one user. The user queries command to the system.
System then interprets it and fetches answer. The response is sent back to the user.
31
4.4 CLASS DIAGRAM
The class user has two attributes command, it sends in audio and the response it
receives which is also audio. It performs function to listen the user command, Interpret it and
then reply or sends back response accordingly. Question class has the command in string
form as it is interpreted by interpret class. It sends it to general or about or search function
based on its identification.
The task class also has interpreted command in string format. It has various functions
like reminder, note, mimic, research and reader.
32
4.5.1 SEQUENCE DIAGRAM FOR QUERY-RESPONSE
The above sequence diagram shows how an answer asked by the user is being fetched
from internet. The audio query is interpreted and sent to Web scraper. The web scraper
searches and finds the answer. It is then sent back to speaker, where it speaks the answer to
user.
33
4.5.2 SEQUENCE DIAGRAM FOR TASK EXECUTION
The user sends command to voice assistant in audio form. The command is passed to the
interpreter. It identifies what the user has asked and directs it to task executer. If the task is
missing some info, the voice assistant asks user back about it. The received information is
sent back to task and it is accomplished. After execution feedback is sent back to user
34
4.6 COMPONENT DIAGRAM
The main component here is the Voice Assistant. It provides two specific service,
executing Task and Answering your question.
35
CHAPTER 5
CODING
CHAPTER 5
CODING
36
CODING
Coding is the process of transforming a system structure into a computer language
format. This section of the software development code deals with software that translates
design specifications into source code. You are required to write source code and internal
documents so that the compatibility of the code and its meaning can be easily verified.
Coding is done by a coder or programmers who are more independent than the
designer. The goal is not to reduce the effort and costs of the coding phase, but to reduce the
cost of the latest phase. The cost of testing and maintenance can be greatly reduced by
writing effective codes.
37
import pyttsx3 #to save or open files
import datetime
import wikipedia
import webbrowser
import pywhatkit
import pyjokes
import os
import time
import subprocess
import requests
engine = pyttsx3.init('sapi5')
rate = engine.getProperty('rate')
engine.setProperty('rate', 175)
voices = engine.getProperty('voices')
def speak(text):
engine.say(text)
engine.runAndWait()
def wishMe():
hour = datetime.datetime.now().hour
else:
38
speak("Hello,Good Evening dear")
def takeCommand():
#listen for audio and convert it to text:
r.pause_threshold = 1
r.energy_threshold = 10000
r.adjust_for_ambient_noise(source, 1.2)
#print("Listening...")
audio = r.listen(source)
print("Recognizing...")
try:
print(f"user said:{statement}\n")
except Exception as e:
return "None"
return statement
if __name__ == '__main__':
while True:
statement = takeCommand().lower()
39
if statement == 0:
continue
speak('your personal AI assistant JURY is shutting down,See you later have a Take care !Good bye')
print('your personal AI assistant JURY is shutting down,See you later have a Take care !Good bye')
break
if 'wikipedia' in statement:
speak('Searching Wikipedia...')
speak("According to Wikipedia")
print(results)
speak(results)
webbrowser.open_new_tab("https://www.youtube.com")
time.sleep(3)
webbrowser.open_new_tab("https://www.google.com")
time.sleep(3)
webbrowser.open_new_tab("gmail.com")
40
speak("Google Mail open now")
time.sleep(5)
api_key = "8ef61edcf1c576d65d836254e11ea420"
base_url = "https://api.openweathermap.org/data/2.5/weather?"
city_name = takeCommand()
complete_url = base_url+"appid="+api_key+"&q="+city_name
response = requests.get(complete_url)
x = response.json()
if x["cod"] != "404":
y = x["main"]
current_temperature = y["temp"]
current_humidiy = y["humidity"]
z = x["weather"]
weather_description = z[0]["description"]
str(current_temperature) +
str(current_humidiy) +
str(weather_description))
str(current_temperature) +
str(current_humidiy) +
str(weather_description))
41
else:
strTime = datetime.datetime.now().strftime("%H:%M:%S")
time.sleep(3)
elif 'who are you' in statement or 'what can you do' in statement:
speak ('Hello there my name is JURY. Your persoanl voice assistant. I am programmed for minor
tasks like'
'opening youtube, google chrome, gmail and stackoverflow, tell time, search wikipedia, show
weather'
'in different cities , get top headline news from times of india!')
elif "who made you" in statement or "who created you" in statement or "who discovered you" in
statement:
webbrowser.open_new_tab("https://stackoverflow.com/login")
speak("Here is stackoverflow")
news = webbrowser.open_new_tab("https://timesofindia.indiatimes.com/home/headlines")
speak('Here are some headlines from the Times of India, Have a happy reading')
time.sleep(6)
42
webbrowser.open_new_tab(statement)
time.sleep(5)
os.system('notepad')
time.sleep(2)
webbrowser.get().open(url)
time.sleep(5)
43
speak('Playing' + song)
print('Playing' + song)
pywhatkit.playonyt(song)
time.sleep(9)
speak('Playing' + video)
print('Playing' + video)
pywhatkit.playonyt(video)
time.sleep(8)
joke = pyjokes.get_joke()
print(joke)
speak(joke)
speak('Presenting a joke')
time.sleep(2)
songs = os.listdir(songs_dir)
print(songs)
speak('Playing song')
os.startfile(os.path.join(songs_dir, songs[0]))
time.sleep(7)
speak("Ok , your pc will log off in 10 sec make sure you exit from all applications")
subprocess.call(["shutdown", "/l"])
44
elif 'exit' in statement:
speak('your personal AI voice assistant is exiting now,See you later have a Take care and Good
bye')
exit()
print('your personal AI assistant is exiting now ,See you later have a Take care and Good bye')
time.sleep(5)
45
CHAPTER 6
TESTING
CHAPTER 6
TESTING
46
6.1 TEST CASE 1
Test ID: T1
Description:
6.2 TEST CASE 2
Test ID: T2
Description:
47
CHAPTER 7
SCREENSHOTS
CHAPTER 7
SCREENSHOTS
48
7.1 INITIALIZING AND RECOGNIZING PROCESS
49
7.3 PLAY YOUTUBE SONG
50
7.4 OPEN GOOGLE
51
7.5 TELLING JOKES
52
7.7 GUI for Personal Voice Assistant
53
7.9 Login Page
54
CHAPTER 8
CHAPTER 8
55
Voice assistants will continue to offer more experiences as they are getting
better at differentiating between voices. However, it is not just developers that need to
address the complexity of developing for voice as brands also need to understand the
capabilities of each device and integration and if it makes sense for their specific
brand. They will also need to focus on maintaining a user experience that is consistent
within the coming years as complexity becomes more of a concern. This is because the
visual interface with voice assistants is missing. Users simply cannot see or touch a
voice interface.
Through this voice assistant, we have automated various services using a single
line voice command. It eases most of the tasks of the user like searching the websites
and retrieving details of your searches, help in vocabulary and for entertainment
purpose like playing music and videos.
This project aims to make intelligent personal voice assistant that will be
machine learning based to give results of queries more accurately and to make it smart
to handle various day to day desktop application tasks. The future plans include is that
it should be able to take as much as input from the user and give output without short
time. Further with the help of GUI it will be more presentable and will include much
more advanced features to perform efficiently and smartly.
REFERENCES
56
3. Stuart Russell and Peter Norvig, ‘Artificial Intelligence: A Modern Approach’
57