-1
import speech_recognition as sr

r = sr.Recognizer()     # a recogniser to understand my voice 

with sr.Microphone() as source: # use the default microphone as the voice
        print('Listening....')
        voice = r.listen(source) # call speech recogniser to recognise the first phrase
try:        
    command = r.recognizer_google(voice) #  pass the audio to google
    print(command)
except:
    print('Could Not Understand Audio')

However i am getting this error returned

Instance of 'Recognizer' has no 'recognizer_google' member

Can someone help me fix this ? I have downgraded to python 3.8.1 from 3.8.2 but the problem persists

Joe Ferndz
  • 8,417
  • 2
  • 13
  • 33
Jahmai123
  • 11
  • 2

2 Answers2

1

You should check the version of speech_recognition library. The version that you are using doesn't seem to have recognizer_google function.

Prateek
  • 71
  • 2
1

Here is the updated code:

import speech_recognition as sr

r = sr.Recognizer()     # a recogniser to understand my voice 

with sr.Microphone() as source: # use the default microphone as the voice
        print('Listening....')
        voice = r.listen(source) # call speech recogniser to recognise the first phrase
try:        
    command = r.recognize_google(voice) #  pass the audio to google
    print(command)
except:
    print('Could Not Understand Audio')

The Error You Have Done Here:

  1. There isn't any member called r.recognizer_google() but there is a member called r.recognize_google() in the Recognizer()
  2. It is best if you upgrade your version of python to the newest, as well as the speech_recognition module, if the above code didn't work
Vishal Ram
  • 69
  • 7