Uberi / speech_recognition

Speech recognition module for Python, supporting several engines and APIs, online and offline.
https://pypi.python.org/pypi/SpeechRecognition/
BSD 3-Clause "New" or "Revised" License
8.3k stars 2.39k forks source link

How to improve the accuracy using recognize_sphinx in python #335

Closed vinay047 closed 5 years ago

vinay047 commented 6 years ago

Hi uberi,

Can you please help us to improve the accuracy for the below code!

import speech_recognition as sr

obtain path to "english.wav" in the same folder as this script

from os import path AUDIO_FILE = path.join(path.dirname(path.realpath(file)), "english.wav")

AUDIO_FILE = path.join(path.dirname(path.realpath(file)), "french.aiff")

AUDIO_FILE = path.join(path.dirname(path.realpath(file)), "chinese.flac")

use the audio file as the audio source

r = sr.Recognizer() with sr.AudioFile(AUDIO_FILE) as source: audio = r.record(source) # read the entire audio file

recognize speech using Sphinx

try: print("Sphinx thinks you said " + r.recognize_sphinx(audio)) except sr.UnknownValueError: print("Sphinx could not understand audio") except sr.RequestError as e: print("Sphinx error; {0}".format(e))

Thanks in advance!!

sohrabtowfighi commented 6 years ago

This ticket is probably outside the scope of this project. You should refer to https://cmusphinx.github.io/wiki/tutorial/

palikar commented 5 years ago

Yes, as @sohrabtowfighi, creating a new Sphinx model is not really part of this library. You can however use custom models with sphinx once you have them. For this, just follow the sphinx api documentation