-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpygoogleapi.py
51 lines (38 loc) · 1.06 KB
/
pygoogleapi.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
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 30 22:48:51 2016
@author: sangam
"""
#import tkinter
import enchant
#from enchant.tokenize import get_tokenizer
#top=tkinter.Tk()
d=enchant.Dict("en_US")
f=enchant.Dict("fr_FR")
import speech_recognition as sr
#socgen_word= {XONE: }
#tknzr = get_tokenizer("en_US")
#spell = []
r = sr.Recognizer()
with sr.Microphone() as source:
print("Hi This is Kiku!!Say Something!!!")
audio = r.listen(source)
try:
print("You said: " + r.recognize_google(audio))
except sr.UnknownValueError:
print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Google Speech Recognition service; {0}".format(e))
# top.mainloop()
b= r.recognize_google(audio)
print(b)
for word in b.split():
a=d.check(word)
#print(word)
#print(a)
if (a == True):
print('english')
else:
for word in b.split():
a=f.check(word)
print('French')