-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'Recognizer' object has no attribute 'recognize_google' #743
Comments
@praveenkumarsrivas Could you please paste the entire traceback and the whole script to diagnose the cause? The snippet looks similar to
Looking at your error message, it seems you have modified
- value = r.recognize_google(audio) # SpeechRecognition 3.10.3
+ value = r.recognize_bing(audio,language='en-US') # Your script In my environment
This issue might not be |
yes it was modified just to check, but the issue still persist in origin code. below is the code: import speech_recognition as sr
r = sr.Recognizer()
m = sr.Microphone()
print(m)
try:
print("A moment of silence, please...")
with m as source: r.adjust_for_ambient_noise(source)
print("Set minimum energy threshold to {}".format(r.energy_threshold))
while True:
print("Say something!")
with m as source: audio = r.listen(source)
print("Got it! Now to recognize it...")
try:
# recognize speech using Google Speech Recognition
value = r.recognize_google(audio)
print("You said {}".format(value))
except sr.UnknownValueError:
print("Oops! Didn't catch that")
except sr.RequestError as e:
print("Uh oh! Couldn't request results from Google Speech Recognition service; {0}".format(e))
except KeyboardInterrupt:
pass I think the issue with |
@praveenkumarsrivas Thanks for your reply. I added unit test like the following snippet in the Windows environment with GitHub Action (PR #746), >>> import speech_recognition as sr
>>> r = sr.Recognizer()
>>> attributes = set(dir(r))
>>> "recognize_google" in attributes but test passed (AttributeError did not raise). To assist further in investigating this issue, could you please execute the code and provide me with the complete results, including any error messages you receive? This is essential to determine if the issue might be related to recent refactoring efforts on the |
Set your microphone sensitivity to 45%. It worked for me. Because we are |
Hi @ftnext , import speech_recognition as sr
r = sr.Recognizer()
m = sr.Microphone()
attributes = set(dir(r))
print("recognize_google" in attributes)
try:
print("A moment of silence, please...")
with m as source: r.adjust_for_ambient_noise(source)
print("Set minimum energy threshold to {}".format(r.energy_threshold))
while True:
print("Say something!")
with m as source: audio = r.listen(source)
print("Got it! Now to recognize it...")
try:
# recognize speech using Google Speech Recognition
value = r.recognize_google(audio)
print("You said {}".format(value))
except sr.UnknownValueError:
print("Oops! Didn't catch that")
except sr.RequestError as e:
print("Uh oh! Couldn't request results from Google Speech Recognition service; {0}".format(e))
except KeyboardInterrupt:
pass below is the complete output:
Hence we can clearly see that recognize_google is not in Recognizer attribute. |
|
@praveenkumarsrivas Thanks! The result is very helpful❤️ At the first line of your code ( Could you please execute below code on your Python interpreter and provide me with the complete results again, including any error messages you receive? >>> from speech_recognition.recognizers import google, whisper |
Steps to reproduce
Expected behaviour
it should recognize the speech of the user.
Actual behaviour
Not Recognizing the speech
System information
My system is windows 11.
My Python version is 3.8.3
My Pip version is 22.0.4
My SpeechRecognition library version is 3.10.3
My PyAudio library version is 0.2.11
My working microphones 'Microsoft Sound Mapper - Input', 'Microphone Array (Realtek(R) Au', 'Microsoft Sound Mapper - Output', 'Speakers (Realtek(R) Audio)'
Installed using 'pip install SpeechRecognition'
The text was updated successfully, but these errors were encountered: