Installing SpeechRecognition
SpeechRecognition is compatible with Python 2.7 and 3.3+, but requires some additional installation steps for Python 2. For this tutorial, I’ll assume you are using Python 3.3+.
1.install SpeechRecognition:
You can install SpeechRecognition from a terminal with pip:
$ pip install SpeechRecognition
2. install pyaudio:
$ pip install pyaudio
3.Let's copy this code and paste it in your code editor which is given below.
#coding with sayed import speech_recognition as sr # get audio from the microphone r = sr.Recognizer() with sr.Microphone() as source: print("Speak now :") audio = r.listen(source) try: print("You said " + r.recognize_google(audio)) except sr.UnknownValueError: print("Could not understand audio") except sr.RequestError as e: print("Could not request results; {0}".format(e))
4.Run this code.
#enjoy
#Happy Coding...
#enjoy
#Happy Coding...
0 comments:
Post a Comment