import speech_recognition as speech


class voiceRecog():
    def __init__(self):
        self.voiceWord=""
    def voice(self):
        s=""
        robot = speech.Recognizer()
        micraphone = speech.Microphone()
        with micraphone as source:
            print("Please say something for the robot.")
            audio = robot.listen(source)
        try:
            print("The sentence was: " + robot.recognize_google(audio))
            s = robot.recognize_google(audio)
        except speech.UnknownValueError:
            print("Not understood, sorry.")
        except speech.RequestError as error:
            print("Something went wrong, error: {0}".format(error))
        self.voiceWord=s





import speech_recognition as speech


class voiceRecog():
    def __init__(self):
        self.voiceWord=""
    def voice(self):
        s=""
        robot = speech.Recognizer()
        micraphone = speech.Microphone()
        with micraphone as source:
            print("Please say something for the robot.")
            audio = robot.listen(source)
        try:
            print("The sentence was: " + robot.recognize_google(audio))
            s = robot.recognize_google(audio)
        except speech.UnknownValueError:
            print("Not understood, sorry.")
        except speech.RequestError as error:
            print("Something went wrong, error: {0}".format(error))
        self.voiceWord=s




