PYTHON SPEECH TO TEXT OR SPEECH-RECOGNITION USING PYTHON :
STEP -1 :
PYTHON LIBRARIES
- Speech_Recognition.(pip install SpeechRecognition)
Step#2:
Open your favorite IDE, we are choosing IDLE , and write the below code:
For English Language:
import speech_recognition as sr
r=sr.Recognizer()
with sr.Microphone() as source:
print("Listening......")
audio=r.listen(source)
print("Done")
try:
print("You said :",r.recognize_google(audio))
except:
print("Sorry,I didn't Catch That")
For Hindi Language:
import speech_recognition as sr
r=sr.Recognizer()
with sr.Microphone() as source:
print("Listening......")
audio=r.listen(source)
print("Done")
try:
print("You said :",r.recognize_google(audio, language='HI-IN'))
except:
print("Sorry,I didn't Catch That")
For Bengali Language:
import speech_recognition as sr
r=sr.Recognizer()
with sr.Microphone() as source:
print("Listening......")
audio=r.listen(source)
print("Done")
try:
print("You said :",r.recognize_google(audio, language='BN-IN'))
except:
print("Sorry,I didn't Catch That")
THIS IS THE WAY TO YOU CAN CONVERT SPEECH TO TEXT IN PYTHON.
Open your favorite IDE, we are choosing IDLE , and write the below code:
For English Language:
import speech_recognition as sr
r=sr.Recognizer()
with sr.Microphone() as source:
print("Listening......")
audio=r.listen(source)
print("Done")
try:
print("You said :",r.recognize_google(audio))
except:
print("Sorry,I didn't Catch That")
For Hindi Language:
import speech_recognition as sr
r=sr.Recognizer()
with sr.Microphone() as source:
print("Listening......")
audio=r.listen(source)
print("Done")
try:
print("You said :",r.recognize_google(audio, language='HI-IN'))
except:
print("Sorry,I didn't Catch That")
For Bengali Language:
import speech_recognition as sr
r=sr.Recognizer()
with sr.Microphone() as source:
print("Listening......")
audio=r.listen(source)
print("Done")
try:
print("You said :",r.recognize_google(audio, language='BN-IN'))
except:
print("Sorry,I didn't Catch That")
THIS IS THE WAY TO YOU CAN CONVERT SPEECH TO TEXT IN PYTHON.
Comments
Post a Comment