-
Notifications
You must be signed in to change notification settings - Fork 12.5k
/
Copy pathVoiceAssistant_main.py
78 lines (64 loc) · 2.52 KB
/
VoiceAssistant_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
from speakListen import *
from websiteWork import *
from textRead import *
from dictator import *
from menu import *
from speechtotext import *
from TextTospeech import *
def main():
start = 0
end = 0
if start == 0:
print("\nSay \"Hello Python\" to activate the Voice Assistant!")
start += 1
while True:
q = short_hear().lower()
if "close" in q:
greet("end")
exit(0)
if "hello python" in q:
greet("start")
print_menu()
while True:
query = hear().lower()
if "close" in query:
greet("end")
end += 1
return 0
elif "text to speech" in query:
tts()
time.sleep(4)
elif "search on google" in query or "search google" in query or "google" in query:
google_search()
time.sleep(10)
elif "search on wikipedia" in query or "search wikipedia" in query or "wikipedia" in query:
wiki_search()
time.sleep(10)
elif "word" in query:
ms_word()
time.sleep(5)
elif "book" in query:
pdf_read()
time.sleep(10)
elif "speech to text" in query:
big_text()
time.sleep(5)
else:
print("I could'nt understand what you just said!")
speak("I could'nt understand what you just said!")
print("\nDo you want to continue? if yes then say " + Fore.YELLOW + "\"YES\"" + Fore.WHITE + " else say " + Fore.YELLOW + "\"CLOSE PYTHON\"")
speak("Do you want to continue? if yes then say YES else say CLOSE PYTHON")
qry = hear().lower()
if "yes" in qry:
print_menu()
elif "close" in qry:
greet("end")
return 0
else:
speak("You didn't say a valid command. So I am continuing!")
continue
elif "close" in q:
return 0
else:
continue
main()