12 lines
351 B
Python
12 lines
351 B
Python
import speech_recognition as sr
|
|
|
|
recognizer = sr.Recognizer()
|
|
with sr.Microphone() as source:
|
|
print("Say something...")
|
|
audio = recognizer.listen(source)
|
|
try:
|
|
text = recognizer.recognize_sphinx(audio)
|
|
print("Sphinx recognized: {}".format(text))
|
|
except sr.UnknownValueError:
|
|
print("Could not understand audio.")
|