2

I use the raspberry pi with pocketsphinx python and I found an example here. From that script I use the same path as described in the script. When I try to run this script it give me an error:

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

Does anyone know what the problem is?

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
input
  • 31
  • 5

1 Answers1

3

Better use absolute path, for ex: if your 'deps' dir present under '/home/pi' then your code will looks like below:

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)
g10dras
  • 399
  • 2
  • 11
  • Thanks for the reply. But the dir pocketsphinx is in my root /pocketsphinx/tests test.py – input Aug 14 '16 at 13:06
  • oh you asked similar question in CMUSphinx Forum yesterday, and you didnt understand the answer. https://sourceforge.net/p/cmusphinx/discussion/help/thread/afac44ac/ – g10dras Aug 14 '16 at 15:56
  • 1
    The question that I ask in CMUSphinx forum is a different script than I have now. But I am sure that my path is correct. I think it have to do with deps/pocketsphinx/model/en-us/en-us' does not contain acoustic model definition 'mdef' But I looked in us-en/us-en en de mdef file is there. – input Aug 14 '16 at 16:14
  • did you try absolute path ? – g10dras Aug 15 '16 at 05:37
  • Yes I have my pocketsphinx folder in root. And I tried different paths.The script continuoes_test.py in the dir test is working. – input Aug 15 '16 at 07:09
  • script test_continuous.py is using relative path. – g10dras Aug 15 '16 at 07:29