【问题标题】:Pocketsphinx decoder initialization returns -1Pocketsphinx 解码器初始化返回 -1
【发布时间】:2016-08-14 10:44:51
【问题描述】:

我将树莓派与pocketsphinx python 一起使用,并找到了一个示例here。从该脚本中,我使用与脚本中描述的相同的路径。当我尝试运行此脚本时,它给了我一个错误:

ERROR: "acmod.c", line 83: Folder 'deps/pocketsphinx/model/en-us/en-us' does not contain acoustic model definition 'mdef'
Traceback (most recent call last):
  File "test.py", line 15, in <module>
    decoder = ps.Decoder(config)
  File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 271, in __init__
    this = _pocketsphinx.new_Decoder(*args)
RuntimeError: new_Decoder returned -1

有谁知道问题出在哪里?

【问题讨论】:

    标签: python pocketsphinx


    【解决方案1】:

    最好使用绝对路径,例如:如果您的 'deps' 目录存在于 '/home/pi' 下,那么您的代码将如下所示:

    MODELDIR = '/home/pi/deps/pocketsphinx/model'
    DATADIR = '/home/pi/deps/pocketsphinx/test/data'
    
    # Create a decoder with certain model
    config = ps.Decoder.default_config()
    config.set_string('-hmm', os.path.join(MODELDIR, 'en-us/en-us'))
    config.set_string('-lm', os.path.join(MODELDIR, 'en-us/en-us.lm.bin'))
    
    config.set_string('-dict', os.path.join(MODELDIR, 'en-us/cmudict-en-us.dict'))
    decoder = ps.Decoder(config)
    

    【讨论】:

    • 感谢您的回复。但是目录 pocketsphinx 在我的根目录 /pocketsphinx/tests test.py
    • 哦,你昨天在CMUSphinx论坛上问了类似的问题,你没看懂答案。 sourceforge.net/p/cmusphinx/discussion/help/thread/afac44ac
    • 我在 CMUSphinx 论坛上提出的问题与我现在的脚本不同。但我确信我的道路是正确的。我认为它与 deps/pocketsphinx/model/en-us/en-us' 不包含声学模型定义 'mdef' 但我查看了 us-en/us-en en de mdef 文件有关。跨度>
    • 你试过绝对路径吗?
    • 是的,我的 pocketsphinx 文件夹在根目录下。我尝试了不同的路径。目录测试中的脚本 continuoes_test.py 正在运行。
    猜你喜欢
    • 1970-01-01
    • 2011-02-06
    • 1970-01-01
    • 2017-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多