Ai Based Personal Voice Assistant

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 57

AI BASED PERSONAL VOICE ASSISTANT

A project report submitted to Rajiv Gandhi University for the award of


Master of Computer Application Degree in the Faculty of Engineering and
Technology

Submitted by

JULIE DOLEY
Roll No: 19MCA011

Under the Supervision and Guidance of

DR. FIROS A.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

RAJIV GANDHI UNIVERSITY, RONO HILLS, DOIMUKH

ARUNACHAL PRADESH, INDIA, PIN-791112

2022

1
AI BASED PERSONAL VOICE ASSISTANT

A project report submitted to Rajiv Gandhi University for the award of


Master of Computer Application Degree in the Faculty of Engineering and
Technology

Submitted by

JULIE DOLEY
Roll No: 19MCA011

Under the Supervision and Guidance of

DR. FIROS A.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

RAJIV GANDHI UNIVERSITY, RONO HILLS, DOIMUKH

ARUNACHAL PRADESH, INDIA, PIN-791112

2022

2
DEPARTMENT OF
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” submitted by MISS. JULIE DOLEY
bearing Roll Number: 19MCA011 to Rajiv Gandhi University 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 is a
bonafide record of project work carried out by her in sixth semester in the
academic year 2021-22 under my supervision. The contents of this thesis, in full
or in parts, have not been submitted to any other Institution or University for the
award of any degree or diploma.

(DR. FIROS A.)


Assistant Professor
Department of Computer
Science and Engineering
Rajiv Gandhi University,
Doimukh-791112
Email: [email protected]

3
DECLARATION

I declare that this project report entitled “AI BASED PERSONAL


VOICE ASSISTANT” submitted to Rajiv Gandhi University in partial
fulfilment of the degree of Master of Computer Application in the Faculty of
Engineering and Technology of Rajiv Gandhi University is a record of
original work carried out by me in sixth semester in the academic year 2021-22
under the supervision of DR. FIROS A. and has not formed the basis for the
award of any other degree or diploma, in this university or any other Institution
or University. In keeping with the ethical practice in reporting scientific
information, due acknowledgements have been made wherever the findings of
others have been cited.

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:

(Dr. Utpal Bhattacharjee)


Name: Name:

(Project coordinator/External (External Examiner)


HOD
Examiner) Designation:
Department of Computer Science
Department of Computer Science and and Engineering
Engineering
Rajiv Gandhi University, Doimukh-

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.

My hearty thanks go to the Vice Chancellor, Registrar, Controller of


Examination and other supporting staffs of the Rajiv Gandhi University for their kind
help.

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.

In my project I am proposing a personal voice assistant that is intelligent. This


aim is to develop a personal voice assistant program that works on voice inputs and gives
output through voice and displays the text on the screen. It draws the inspirations from
voice assistants like Cortana for Windows, and Siri for IOS, Alexa from Amazon and
Google voice assistant from Google. It has been designed to provide a user-friendly
interface for carrying out a variety of tasks by employing certain well-defined voice
commands. Here Users can interact with the assistant through voice commands

As a personal voice assistant, it assists the end-user with day-to-day activities


like Greets Human Conversation, searching queries in Google (Wikipedia), play
YouTube videos, play songs from playlists, Tell Date and time, Sending Email, Give
Weather updates, Read Latest News, Find different word meanings etc. By analysing the
user statements and commands it will give an optimal solution with the help of Artificial
Intelligence.

NON-PLAGIARISM REPORT

7
CONTENTS

8
ITEM PAGE NUMBER

CERTIFICATE…………………………………..……...…..................… II

DECLARATION………………………………………......…..………… III

CERTIFICATE ………………………………………......…..………… IV

ACKNOWLEDGEMENT………………………………........……........ V

ABSTRACT…………………………………………………......................VI

NON-PLAGIARISM REPORT……………………………………… VII

CONTENTS……………………………………………………..….…….. VIII-IX

CHAPTER 1: INTRODUCTION 1-5

2
1.1. Voice Assistant 3
1.2. 4
Background
1.3. Objective
1.4. Purpose, Scope and Applicability
5

CHAPTER 2: SURVEY OF TECHNOLOGY 6-10

2.1. Used Technology 7


2.1.1. Python 7
2.1.2. IDE Used for the project

2.2. PyCharm
8
2.2.1. Features of PyCharm
8
2.2.2. Libraries used for development 9

2.3. Methods Used for Voice Assistant 10

9
CHAPTER 3: SYSTEM REQUIREMENT AND ANALYSIS 11-15

3.1. Problem Definition 12

3.2. Requirement Specification 13

3.3. 14
Project Planning and Scheduling
3.4. Feasibility Study 15
3.5.
3.6. Hardware Requirements
Software Requirements 16

CHAPTER 4: SYSTEM DESIGN 17-24

4.1. Activity Diagram 18


4.2. Flow Chart Diagram 19
4.3. Use Case Diagram 20
4.4. Class Diagram 21
4.5 Sequence Diagram 22
23

4.5.1. Sequence Diagram for Query Response


4.5.2. Sequence Diagram for Task Execution

4.6. Component Diagram 24

CHAPTER 5: CODING 25-34

5.1. Goal of Coding 26


5.2. Core Part of Project Coding 27-34

CHAPTER 6: TESTING 36
CHAPTER 7: SCREENSHOTS 37-42
CHAPTER 8: CONCLUSION AND FUTURE SCOPE 43-44

10
REFERENCES 45

LIST OF FIGURE& TABLE

TABLES

ITEM No Page
No

Table 1 Project Planning and scheduling 25

FIGURES

Fig 1 The System’s Activity Diagram 29

Fig 2 Flowchart Diagram of the system 30

Fig 3 The System’s Use Case Diagram 31

11
The System’s Class Diagram

Fig 4 Sequence Diagram for Query-Response 32

Fig 5 Sequence Diagram for Task Execution 33

Fig 6 Component Diagram 34

Fig 7 35

CHAPTER 1
12
INTRODUCTION

CHAPTER-1
INTRODUCTION

1.1 VOICE ASSISTANT

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.

● GOOGLE ASSISTANT from Google


It is a virtual assistant that is powered by an artificial intelligence developed by
Google. They are available on devices like smart mobile phones and in smart homes.
Two Way conversation is performed by Google Assistants. It is made to use in the
android devices.

● ALEXA from Amazon

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.

● SIRI from Apple


SIRI is a virtual assistant software that is part of Apple (Ios, macOS) operating
system. It interacts with the user through voice interfaces and have ability to
recognizes the various commands and act acts upon them. It also adapts user speech
and also converse the user if does not able to identify user requests.

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

Purpose of personal virtual assistant is to being capable of voice interaction, music


playback, making to-do lists, setting alarms, playing audiobooks and providing weather
details and other real-time information such as news. Virtual assistants enable users to
speak natural language voice commands in order to operate the device and its apps.

There is an increased overall awareness and a higher level of comfort demonstrated


specifically by millennial consumers. In this ever-evolving digital world where speed,
efficiency, and convenience are constantly being optimized, it’s clear that we are moving
towards less screen interaction.

● 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

2.1. USED TECHNOLOGY


2.1.1. PYTHON

Python is an Objects Oriented Programming based and high levels interpreted


programming language. It is a robust and highly useful language focused on rapid
application development (RAD). Python helps in easy writing and execution of codes.
Python provides a huge list of benefits to the user and the usage of Python is such that it
is not limited to only one activity though its growing popularity has allowed to enter into
some of the most popular and complex processes like Artificial Intelligence (AL),
Machine Learning (ML), Natural language processing (NLP), Data science etc.

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

PyCharm is a hybrid-platform developed by JetBrains as an IDE for Python. It is


commonly used for Python application development. Some of the unicorn organizations
such as Twitter, Facebook, Amazon, and Pinterest use PyCharm as their Python IDE.

2.2.1 FEATURES OF PYCHARM:

● Intelligent Code Editor


● Code Navigation
● Refactoring
● Assistance for Many Other Web Technologies
● Support for Popular Python Web Frameworks
● Assistance for Python Scientific Libraries

19
2.2.2 LIBARIES USED IN PYCHARM FOR DEVELOPMENT:

● SPEECH RECOGNITION: It is a library that is used for performing speech


recognition and it allow us to convert audio into text for further processing with the
support for several engines and APIs for both online and offline it supports Google
Cloud Speech API and IBM Speech to Text and Microsoft Bing Voice Recognition
etc. We can also convert large audio files into text using Speech Recognition API in
python. Since we are building an application of voice assistant so one of the most
important things in this is that our assistant recognizes our voice.
 
● PYTTSX3: Pyttsx3 stands for Python Text to Speech. It is a cross-platform python
wrapper for text-to-speech synthesis. It is a Python package supporting common text-
to-speech engines on Mac OS X, Windows, and Linux. It works for both Python2.x
and 3.x versions. Its main advantage is that it works offline.

● WEBBROWSER: It provides a high-level interface which allows displaying Web-


based documents to users.

● WIKIPEDIA: It is used to fetch a variety of information from the Wikipedia website.

● PYWHATKIT: It is a python library with various helpful features. It's easy-to-use


and does not require you to do any additional setup Send WhatsApp messages, play a
YouTube video, perform a Google Search and get information on a particular topic.

● PYJOKES: Pyjokes is used for collection Python Jokes over the Internet.


 

20
● DATETIME: Date and Time is used to showing Date and Time. This module comes
built-int with Python. 

2.3 METHODS USED FOR VOICE ASSISTANT

● SPEAK METHOD

Speak method will help us in taking the voice from the machine. Here is the code
explanation of Speak Method

● TAKE QUERY METHOD


This method will check for the condition. If the condition is trued it will return output.
We can add any number if conditions for it is satisfies and we will get the desired
output.

● TAKE COMMAND METHOD


This method is for taking the commands and recognizing the command from the
speech Recognition module

21
CHAPTER 3
SYSTEM REQUIREMENT AND ANALYSIS

22
CHAPTER 3

SYSTEM REQUIREMENT AND ANALYSIS

System Analysis is the understanding of an existing system completely and


finding where the system is failing. The solution is to resolve the issues in the proposed
system and to divide the systems into smaller parts.

3.1 PROBLEM DEFINITION

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.

3.2 REQUIREMENT SPECIFICATION

Personal voice assistant software required to act as an interface to the digital


world by understanding user requests and commands then translating them into actions
and the recommendations are based on agent’s understanding of the world.

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:

• Providing information regarding weather facts etc. from Wikipedia.

• Play music from various services.

• Play YouTube videos, TV shows and play movies on televisions.

• Book tickets for shows and for travel.

24
3.3 PROJECT PLANNING AND SCHEDULING

This is a six-month time frame to implement a production system of AI Based Personal


Voice Assistant in time for fall 2022.

Phases Date No. of days

Analysis 1.02.2022 30 days

Requirements 3.03.2022 12 days

Coding 14.03.2022 45 days

Testing 28.04.2022 13 days

Table 1. 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.

● TECHNICAL FEASIBILITY: It includes finding out technologies for the


project, both hardware and software. For virtual assistant, user must have
microphone to convey their message and a speaker to listen when system speaks.
These are very cheap now a days and everyone generally possess them. Besides,
system needs internet connection. While using this voice assistant, make sure you
have a steady internet connection. It is also not an issue in this era where almost
every home or office has Wi-Fi.
● OPERATIONAL FEASIBILITY: It is the ease and simplicity of operation of
proposed system. System does not require any special skill set for users to operate
it. In fact, it is designed to be used by almost everyone. Kids who still don’t know
to write can read out problems for system and get answers.
● ECONOMICAL FEASIBILITY: Here, we find the total cost and benefit of the
proposed system over current system. For this project, the main cost is
documentation cost. User also would have to pay for microphone and speakers.
Again, they are cheap and available. As far as maintenance is concerned.
● ORGANIZATIONAL FEASIBILITY: This shows the management and
organizational structure of the project. This project is not built by a team. The
management tasks are all to be carried out by a single person. That won’t create
any management issues and will increase the feasibility of the project.
● CULTURAL FEASIBILITY: It deals with compatibility of the project with
cultural environment. Virtual assistant is built in accordance with the general
culture.

This project is technically feasible with no external hardware requirements.


Also, it is simple in operation and does not cost training or repairs. Overall feasibility
study of the project reveals that the goals of the proposed system are achievable.
Decision is taken to proceed with the project.

26
3.5 HARDWARE REQUIREMENTS

Hardware requirement is significant. It will require sufficient RAM which will


significantly affecting on speed of the whole system. A hard disk should have good amount
of space to store the file and application. The minimum hardware requirements.
● Monitor
● Processor: 2.30GHz.
● RAM: 4GB or more.
● Hard disk: 250GB.

3.6 SOFTWARE REQUIREMENTS

The software is designed to be light weighted so that it doesn’t be a burden to the


machine that is running it. This system is build being keeping in mind that generally
available software compatibility. The best choice of software, tools and techniques is
crucial to developing and deploying software projects. For my project, the following
software/platforms have been employed.

● Operating System : Windows 10(64-bit) or above.


● Language used : Python 3.7 or later
● IDE used : PyCharm

27
CHAPTER 4
SYSTEM DESIGN

28
CHAPTER 4
SYSTEM DESIGN
4.1 ACTIVITY DIAGRAM

Fig 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

Run The Program

yes
Continue
to work
No

End

4.3 USE CASE DIAGRAM

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

Fig 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.

4.5 SEQUENCE DIAGRAM

32
4.5.1 SEQUENCE DIAGRAM FOR QUERY-RESPONSE

Fig 5. 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

Fig 6. 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

Fig 7. 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.

5.1 GOAL OF CODING


● TRANSLATING A SYSTEM STRUCTURE INTO A COMPUTER
LANGUAGE FORMAT:
Coding is the process of converting a system structure into a computer language
format, which can be computer-generated and perform tasks as specified in the design
structure during the design phase.

● TO REDUCE THE COST OF THE LATEST PHASES:


The cost of testing and maintenance can be greatly reduced by writing code for
success.

● MAKING THE PROGRAM MORE READABLE:


The program should be easy to read and understand. It promotes readable and
understandable coding as the clear purpose of the coding work can help to produce
sustainable software.

5.2 CORE PART OF PROJECT CODING

import speech_recognition as sr #importing speech recognition package from google API

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')

engine.setProperty('voice', voices[1] .id)

def speak(text):

engine.say(text)

engine.runAndWait()

def wishMe():

hour = datetime.datetime.now().hour

if hour >= 0 and hour < 12:

speak("Hello,Good Morning dear")

print("Hello,Good Morning dear")

elif hour >= 12 and hour < 18:

speak("Hello,Good Afternoon dear")

print("Hello,Good Afternoon dear")

else:

38
speak("Hello,Good Evening dear")

print("Hello,Good Evening dear")

def takeCommand():

r = sr Recognizer() # initialise a recogniser

#listen for audio and convert it to text:

with sr.Microphone() as source:

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:

statement = r.recognize_google(audio, language = 'en-in')

print(f"user said:{statement}\n")

except Exception as e:

speak("Pardon me, please can you say that again")

return "None"

return statement

if __name__ == '__main__':

while True:

speak("How may i help you")

speak("Tell me, what task do you want me to do for you?")

statement = takeCommand().lower()

39
if statement == 0:

continue

if "bye" in statement or "ok bye" in statement or "stop" in statement:

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...')

statement = statement.replace("wikipedia", "")

results = wikipedia.summary(statement, sentences=2)

speak("According to Wikipedia")

print(results)

speak(results)

elif 'open youtube' in statement:

webbrowser.open_new_tab("https://www.youtube.com")

speak("youtube is open now")

print("youtube is open now")

time.sleep(3)

elif 'open google' in statement:

webbrowser.open_new_tab("https://www.google.com")

speak("Google chrome is open now")

print("Google chrome is open now")

time.sleep(3)

elif 'open gmail' in statement:

webbrowser.open_new_tab("gmail.com")

40
speak("Google Mail open now")

print("Google Mail open now")

time.sleep(5)

elif "weather" in statement:

api_key = "8ef61edcf1c576d65d836254e11ea420"

base_url = "https://api.openweathermap.org/data/2.5/weather?"

speak("whats the city name")

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"]

speak(" Temperature in kelvin unit is " +

str(current_temperature) +

"\n humidity in percentage is " +

str(current_humidiy) +

"\n description " +

str(weather_description))

print(" Temperature in kelvin unit = " +

str(current_temperature) +

"\n humidity (in percentage) = " +

str(current_humidiy) +

"\n description = " +

str(weather_description))

41
else:

speak(" City Not Found ")

elif 'time' in statement or 'time right now' in statement:

strTime = datetime.datetime.now().strftime("%H:%M:%S")

speak(f"Sir the time is {strTime}")

print(f"Sir the time is {strTime}")

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:

speak("I was built by Miss Julie")

print("I was built by Miss Julie")

elif "open stackoverflow" in statement:

webbrowser.open_new_tab("https://stackoverflow.com/login")

speak("Here is stackoverflow")

elif 'news' in statement:

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)

elif 'search' in statement:

statement = statement.replace("search", "")

42
webbrowser.open_new_tab(statement)

time.sleep(5)

elif 'open notepad' in statement:

os.system('notepad')

speak('Done for you!')

print("Done for you!")

time.sleep(2)

elif 'thank you' in statement:

speak('Your welcome. Anything else you want me to do ?')

elif 'how are you' in statement:

speak('I am fine. Thank You! How about you?')

elif 'Iam also good' in statement:

speak('Good to hear that')

elif 'map' in statement:

location = statement.replace('map', '')

url = 'https://google.nl/maps/place/' + location + '/&amp;'

webbrowser.get().open(url)

print('Here is the map of ' + location)

speak('Here is the map of ' + location)

time.sleep(5)

elif 'what are you doing' in statement:

speak('hmmm.. I am little busy.')

if 'play youtube song' in statement:

song = statement.replace('play', '')

43
speak('Playing' + song)

print('Playing' + song)

pywhatkit.playonyt(song)

time.sleep(9)

if 'play youtube video' in statement:

video = statement.replace('play', '')

speak('Playing' + video)

print('Playing' + video)

pywhatkit.playonyt(video)

time.sleep(8)

elif 'joke' in statement or 'tell me a joke' in statement:

joke = pyjokes.get_joke()

print(joke)

speak(joke)

speak('Presenting a joke')

time.sleep(2)

elif 'play music' in statement:

songs_dir = "C:\\Users\\Gomdo\\Desktop\\Arijit_Singh-Hindi_Song [MP3MAD.COM]"

songs = os.listdir(songs_dir)

print(songs)

speak('Playing song')

os.startfile(os.path.join(songs_dir, songs[0]))

time.sleep(7)

elif "log off" in statement or "sign out" in statement:

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 Title: Response Time

Test ID: T1

Test Priority: Medium

Test Purpose: Verify that the system response time is efficient.

Description:

Time is very important in a language based system. I'm talking because I haven't entered


any input. The system also needs to respond immediately. The user must receive an
immediate response to the request made.

6.2 TEST CASE 2

Test Title: Accuracy

Test ID: T2

Test Priority: High

Test Purpose: According to the data collected, verify that the answers obtained from


the system are correct.

Description:

 The Voice Assistance System is primarily used to get accurate answers to questions.


Obtaining the answer the Voice Assistant System is primarily used to obtain
accurate answers to questions.

47
CHAPTER 7
SCREENSHOTS

CHAPTER 7
SCREENSHOTS

48
7.1 INITIALIZING AND RECOGNIZING PROCESS

7.2 ACCESSING YOUTUBE VIDEOS

Video remains a major source of entertainment and is one of the highest


priority tasks for voice assistants. These are equally important
for both entertainment and educational purposes, as most educational and research
activities are carried out through YouTube in modern times. This makes the
learning process more practical and outside the four walls of the classroom.

49
7.3 PLAY YOUTUBE SONG

50
7.4 OPEN GOOGLE

51
7.5 TELLING JOKES

7.6 EXIT CODE AND SHUTTING DOWN

52
7.7 GUI for Personal Voice Assistant

7.8 Welcome Page

53
7.9 Login Page

54
CHAPTER 8

CONCLUSION AND FUTURE SCOPE

CHAPTER 8

CONCLUSION AND FUTURE SCOPE

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

1. Gowrishankar S, Veena A, ‘Introduction to Python Programming’, CRC Press.

2. Yuxi (Hayden) liu, ‘Python Machine Learning by Example’, Packet Publishing


Ltd.

56
3. Stuart Russell and Peter Norvig, ‘Artificial Intelligence: A Modern Approach’

4. David L. Poole and Alan K. Mackworth, ‘Python code for Artificial


Intelligence: Foundations of Computational Agents’, Version 0.7.6.

5. Purushotham Botla, ‘Designing Personal Assistant Software for Task


Management using Semantic Web Technologies and Knowledge Databases’.

6. Kevin Murphy, ‘Machine Learning: A Probabilistic Perspective, MIT Press,


2012.

7. Abdolrahmani, A., Kuber, R., Branham, S. M. (2018). Siri Talks at You: An


Empirical Investigation of Voice Activate Personal Assistant (VAPA) Usage
by Individuals Who Are Blind. In Proceedings of the 20th International ACM
SIGACCESS Conference on Computers and Accessibility (pp. 249–258).
ACM.

57

You might also like