Speech Recognition using Google Speech Recognition

(1)Install SpeechRecognition

pip install SpeechRecognition

(2)Run from command prompt as below:

python -m speech_recognition

Copy /paste the below code in Eclipse:

import speech_recognition as sr

# Record Audio

r = sr.Recognizer()

with sr.Microphone() as source:

    print(“Say something!”)

    audio = r.listen(source)

try:

    print(“You said: “ + r.recognize_google(audio))

except sr.UnknownValueError:

    print(“Google Speech Recognition could not understand audio”)

except sr.RequestError as e:

    print(“Could not request results from Google Speech Recognition service; {0}”.format(e))

Credit to https://pythonspot.com/en/speech-recognition-using-google-speech-api/

Advertisements

About qainterviews

Software Geek,QA Expert,Blogger
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s