MCPcopy Index your code
hub / github.com/geekcomputers/Python / takeCommand

Function takeCommand

diction.py:17–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15
16
17def takeCommand():
18 r = sr.Recognizer()
19 with sr.Microphone() as source:
20 print("Listening...")
21 r.pause_threshold = 1
22 r.energy_threshold = 494
23 r.adjust_for_ambient_noise(source, duration=1.5)
24 audio = r.listen(source)
25
26 try:
27 print("Recognizing..")
28 query = r.recognize_google(audio, language="en-in")
29 print(f"User said: {query}\n")
30
31 except Exception:
32 # print(e)
33
34 print("Say that again please...")
35 return "None"
36 return query
37
38
39def translate(word):

Callers 1

translateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected