LookupError: Speech is unintelligible
Abonia1 opened this issue · comments
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
r.adjust_for_ambient_noise(source, duration = 5)
print("listening...")
# read the audio data from the default microphone
audio_data = r.record(source, duration=5)
print("Recognizing...")
# convert speech to text
text = r.recognize(audio_data)
print(text)
LookupError Traceback (most recent call last)
in
8 print("Recognizing...")
9 # convert speech to text
---> 10 text = r.recognize(audio_data)
11 print(text)
~/opt/anaconda3/lib/python3.8/site-packages/speech_recognition/init.py in recognize(self, audio_data, show_all)
337 # make sure we have a list of transcriptions
338 if "alternative" not in actual_result:
--> 339 raise LookupError("Speech is unintelligible")
340
341 # return the best guess unless told to do otherwise
LookupError: Speech is unintelligible
Thanks in advance!