pythonspeech-recognitionpocketsphinx

Pocketsphinx new_Decoder error, cannot ad new language to livespeech, how to fix?


i download new language package and set everything like in github https://github.com/bambocher/pocketsphinx-python but i got this error

Traceback (most recent call last):
  File "D:\Dev\PetProjects\PythonPetProjects\Darling\darling\main.py", line 39, in <module>
    main()
  File "D:\Dev\PetProjects\PythonPetProjects\Darling\darling\main.py", line 18, in main
    speech = LiveSpeech(
  File "C:\Users\PANDEMIC\AppData\Local\pypoetry\Cache\virtualenvs\darling-0MBR-P4T-py3.9\lib\site-packages\pocketsphinx\__init__.py", line 208, in __init__
    super(LiveSpeech, self).__init__(**kwargs)
  File "C:\Users\PANDEMIC\AppData\Local\pypoetry\Cache\virtualenvs\darling-0MBR-P4T-py3.9\lib\site-packages\pocketsphinx\__init__.py", line 90, in __init__
    super(Pocketsphinx, self).__init__(config)
  File "C:\Users\PANDEMIC\AppData\Local\pypoetry\Cache\virtualenvs\darling-0MBR-P4T-py3.9\lib\site-packages\pocketsphinx\pocketsphinx.py", line 273, in __init__
    this = _pocketsphinx.new_Decoder(*args)
RuntimeError: new_Decoder returned -1

My language pack https://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/Russian/zero_ru_cont_8k_v3.tar.gz/download?use_mirror=altushost-swe&download=&failedmirror=deac-riga.dl.sourceforge.net

My code

import os

from pocketsphinx import LiveSpeech, get_model_path



BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SOURCES = os.path.join(BASE_DIR, 'src')




def main():
    print('Darling is runnig')

    ru_model_path = os.path.join(get_model_path(), 'ru-ru')

    speech = LiveSpeech(
        verbose=False,
        sampling_rate=16000,
        buffer_size=2048,
        no_search=False,
        full_utt=False,
        hmm=ru_model_path,
        lm=os.path.join(ru_model_path, 'ru.lm'),
        dic=os.path.join(ru_model_path, 'ru.dic')
    )

if __name__ == '__main__':
    main()

Solution

  • In newer version of sphinx, you cannot to add your language pack, you can use google recognition, or rebuild you pack.