-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.py
More file actions
48 lines (37 loc) · 1.13 KB
/
process.py
File metadata and controls
48 lines (37 loc) · 1.13 KB
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
import nltk
import speech_to_text
import text_to_speech
def noun(answer):
if "everything" in answer.lower():
pass
text = nltk.word_tokenize(answer)
tags = nltk.pos_tag(text)
words = [word for word, tag in tags if tag in ('NN','NNP','NNS')]
print words
if len(words)==1:
text_to_speech.get_speech("Are you looking for"+ words[0])
answer = speech_to_text.stt()
print answer
if "yes" in answer.lower() or "ye" in answer.lower():
pass
elif(len(words)>1):
a = ""
a = " or ".join(words)
print a
text_to_speech.get_speech("What are you looking for"+ a)
answer = speech_to_text.stt()
if answer in words:
pass
#vision
def main():
while(True):
text_to_speech.get_speech("command !")
answer = speech_to_text.stt()
print answer
if "vision" in answer.lower():
text_to_speech.get_speech("How may i help you ?")
answer = speech_to_text.stt()
noun(answer)
else:
text_to_speech.get_speech("Oops! Didn't catch that,pardon!")
main()