【问题标题】:Pocketsphinx new_Decoder error, cannot ad new language to livespeech, how to fix?Pocketsphinx 新解码器错误,无法向 livepeech 添加新语言,如何解决?
【发布时间】:2026-01-28 14:05:01
【问题描述】:

我下载了新的语言包并在 github https://github.com/bambocher/pocketsphinx-python 中设置了所有内容,但我收到了这个错误

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

我的语言包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

我的代码

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()

【问题讨论】:

    标签: python speech-recognition pocketsphinx


    【解决方案1】:

    在较新版本的 sphinx 中,您无法添加语言包,您可以使用 google 识别,或重建您的包。

    【讨论】: