How to Change Model Pocket Sphinx

Viewed 320

I have set up pocket sphinx in linux and am trying to generate custom language model. I tried to generate my custom language model using this link: http://www.speech.cs.cmu.edu/tools/lmtool-new.html

The code I used to work with provided model works fine but when feeding my custom model I get the following error:

_pocketsphinx.new_Decoder(*args) RuntimeError: new_Decoder returned -1

The used sample code is as follows:

import os
from os import environ, path

from pocketsphinx import LiveSpeech
from sphinxbase import *

pocketsphinx_dir = os.path.dirname(__file__)

print(pocketsphinx_dir)

MODELDIR = "./myModel/model"
MODELDIR1 = "./myModel"
speech = LiveSpeech(
    verbose=False,
    sampling_rate=16000,
    buffer_size=2048,
    no_search=False,
    full_utt=False,
    hmm=os.path.join(MODELDIR, 'en-us/en-us'),
    lm=os.path.join(MODELDIR1, '2506.lm'),
    dic=os.path.join(MODELDIR1, '2506.dic')
)

for phrase in speech: print(phrase)

Also note that I already tried using the absolute path as suggested in this answer but that did not helped my case.

0 Answers
Related