#!/usr/bin/env python3importspeech_recognitionassr# obtain path to "english.wav" in the same folder as this scriptfromosimportpathAUDIO_FILE=path.join(path.dirname(path.realpath(__file__)),"prueba1.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 sourcer=sr.Recognizer()withsr.AudioFile(AUDIO_FILE)assource:audio=r.record(source)# read the entire audio filer.recognize_sphinx(audio,language="es-PE")# recognize speech using Sphinxtry:print("Sphinx thinks you said "+r.recognize_sphinx(audio))exceptsr.UnknownValueError:print("Sphinx could not understand audio")exceptsr.RequestErrorase:print("Sphinx error; {0}".format(e))
when running this code I get the following error:
Traceback (most recent call last):
File "audio_transcribe.py", line 17, in <module>
r.recognize_sphinx(audio, language = "es-PE")
File "/usr/lib/python3.6/site-packages/speech_recognition/__init__.py", line 671, in recognize_sphinx
raise RequestError("missing PocketSphinx language model file: \"{}\"".format(language_model_file))
speech_recognition.RequestError: missing PocketSphinx language model file: "/usr/lib/python3.6/site-packages/speech_recognition/pocketsphinx-data/es-PE/language-model.lm.bin"
My question is how to configure the language parameter correctly in the code and if the error that comes out is due to that or my language model is wrong.
Thanks for your time.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to recognize the words of an audio that is in Spanish, I followed the steps of this guide: https://github.com/Uberi/speech_recognition/blob/master/reference/pocketsphinx.rst#installing-other-languages. I can configure the folder for another language and I gave the name: es-PE and use this example code:
when running this code I get the following error:
My question is how to configure the language parameter correctly in the code and if the error that comes out is due to that or my language model is wrong.
Thanks for your time.