Minor
Minor
Submitted by:
1. INTRODUCTION
3. PROPOSED SYSTEM
4. SOURCE CODE
5. OUTPUT
6. APPLICATION
7. FUTURE SCOPE
8. TESTING
9. COCLUSION
10. LIMITATION
INTRODUCTION
VOICE ASSISTANT:
A voice assistant is a digital assistant that uses voice
recognition, language processing algorithms, and voice
synthesis to listen to specific voice commands and return
relevant information or perform specific functions as
requested by the user.
speck Function:
#text to speach
def speck(audio,rate = 180):
engine.setProperty('rate',rate) # rate maintain the speed
of voice
engine.say(audio)
print(audio)
engine.runAndWait()# start executing next line after
completion of speak
Parameters:
• audio: The text to be spoken.
• rate: The speed at which the text will be spoken (default is
180).
capture_voice_input Function:
#Create a function to capture voice input from the user using
a microphone:
#capture_voice_input()
def capture_voice_input():
with sr.Microphone() as source:
#recognizer.adjust_for_ambient_noise(source,duration=1)
#recognizer.energy_threshold()
print("Listening...")
recognizer.pause_threshold = 1 # Minimum length of
silence that will register as the end of a phrase
Purpose: Captures voice input from the user using the microphone.
Returns:
• An audio object containing the captured voice input.
convert_voice_to_text Function:
#Create a function to convert the captured voice input to
text:
def convert_voice_to_text(audio):
try:
text = recognizer.recognize_google(audio) # use google
recognizer for voice to text
print("You said: " + text)
except:
speck("Sorry, I didn't understand that. try again") #
handle any error in recognizer
return "none"
return text
Purpose: Converts the captured voice input to text using Google's
speech recognition service.
Parameters:
• audio: The audio input captured from the microphone.
Returns:
• The recognized text, or "none" if recognition fails.
intro Function:
# for introduction of assitent
def intro():
speck("hello , i am anna . how can i help you") # speak
the introduction
return
auto_search_with_topic Function:
def auto_search_with_topic(text):
speck("searching on wikipedia.....",)
text1 = search_wiki(text)
webbrowser.open(topic1)
return
Purpose: Determines whether to search Wikipedia or perform a web search based on the
text.
Parameters:
Behavior:
If the text includes "wikipedia", it performs a Wikipedia search and reads the result.
Otherwise, it opens a Google or YouTube search in the web browser.
search_wiki Function:
Parameters:
Returns:
Main Logic:
intro()
audio = capture_voice_input()
text = convert_voice_to_text(audio)
if text.lower() != 'none':
auto_search_with_topic(text)
DESCRIPTION
Before developing software, we keep following things in
mind that we can develop powerful and quality software
PROBLEM STATEMENT
Problem statement was to design a module:
O Which is user friendly
O Which will restrict the user from accessing other user's
data.
O Which will help user in viewing his data and privileges.
O Which will help the administrator to handle all the
changes.
FUNCTIONS TO BE PROVIDED:
SYSTEM REQUIRMENTS:
Language: Python
RAM: 512 MB
# https://reintech.io/blog/how-to-create-a-
voice-recognition-system-with-python
#topic ='https://www.google.com/search?q='+ x
#topic1 ='https://www.google.com/search?q=(x)'
engine=pyttsx3.init("sapi5") # creating a
pyttsx3 object
voices=engine.getProperty('voices') # geting
the list of voices
engine.setProperty('voice',voices[1].id)#
seting a certain voice for speak
#text to speach
defspeck(audio,rate=180):
engine.setProperty('rate',rate) # rate
maintain the speed of voice
engine.say(audio)
print(audio)
engine.runAndWait()# start executing next
line after completion of speak
recognizer=sr.Recognizer()
defcapture_voice_input():
withsr.Microphone() assource:
#recognizer.adjust_for_ambient_noise(source,du
ration=1)
#recognizer.energy_threshold()
print("Listening...")
recognizer.pause_threshold=1
# listening duration 5 seconds
audio=recognizer.listen(source,0,5)
returnaudio
#capture_voice_input()
defconvert_voice_to_text(audio):
try:
text=recognizer.recognize_google(audio)
print("You said: "+text)
except:
speck("Sorry, I didn't understand
that. try again")
return"none"
returntext
'''
#list_microphone_names() method will return a
array/list of \
#the connected microphones to the system.
lst1 = sr.Microphone.list_microphone_names()
print(len(lst1))
'''
# for introduction of assitent
defintro():
speck("hello , i am anna . how can i help
you")
return
defauto_search_with_topic(text):
speck("searching on
wikipedia.....",)
text1=search_wiki(text)
if'try again'!=text1:
speck("according to
wikipedia "+text1)
else:
speck("i can't
understand the query")
else:
speck("searching.....")
topic='https://www.google.com/search?q='+text
topic1='https://www.youtube.com/search?
q='+text
# then call the default
open method described above
#webbrowser.open(url1)
webbrowser.open(topic1)
return
# for Searcingwikipedia
defsearch_wiki(str_search):
try:
# Replacing the Activation word from
the query
query=str_search.lower()
if'search on wikipedia'inquery:
query=query.replace('search on
wikipedia', '').strip()
elif'on wikipedia'inquery:
query=query.replace('on
wikipedia', '').strip()
elif'according to wikipedia'inquery:
query=query.replace('according to
wikipedia', '').strip()
elif'in wikipedia'inquery:
query=query.replace('in
wikipedia', '').strip()
elif'wikipedia'inquery:
query=query.replace('wikipedia',
'').strip()
result=wikipedia.summary(query) #
taking only the summary from wikipedia
return"try again"
intro()
audio=capture_voice_input()
text=convert_voice_to_text(audio)
iftext.lower() !='none':
auto_search_with_topic(text)
OUTPUT
APPLICATION
FUTURE SCOPE
CONCLUSION
Voice assistants are advanced software agents that can
perform tasks or services based on verbal commands. They
use natural language processing (NLP) to understand and
respond to human speech. Examples include Amazon's Alexa,
Apple's Siri, Google Assistant, and Microsoft's Cortana. These
assistants can perform a variety of functions, such as setting
reminders, playing music, providing weather updates,
controlling smart home devices, and answering questions by
accessing information from the internet. Voice assistants are
integrated into smartphones, smart speakers, and other
connected devices, enhancing user interaction through
hands-free operation and improving accessibility for various
user needs.
LIMITATION