【发布时间】: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
我的代码
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