Menu

how to use French model with pocketsphinx in python

Help
2019-07-27
2019-08-29
  • sumit vaise

    sumit vaise - 2019-07-27

    Hello friends,
    i am trying to build a french speech recognition app for my desktop.
    I downloaded the french accoustic model from source forge website and included them into my code. The code i got from PyPi pocketsphinx page. It works with english model, but i dont know why it didnt work for french model.

    Below is what i tried:

    import os
    from pocketsphinx import LiveSpeech

    model_path = "pocketsphinx-python/pocketsphinx/model"

    speech = LiveSpeech(
    verbose=False,
    sampling_rate=16000,
    buffer_size=2048,
    no_search=False,
    full_utt=False,
    hmm=os.path.join(model_path, 'fr-ca'),
    lm=os.path.join(model_path, 'fr-small.lm.bin'),
    dic=os.path.join(model_path, 'fr.dict')
    )

    for phrase in speech:
    print(phrase)

    Error what i get is :
    File "/home/garud/Documents/SpeechRecog/SR_fr.py", line 14, in <module>
    dic=os.path.join(model_path, 'fr.dict')
    File "/home/garud/anaconda3/lib/python3.7/site-packages/pocketsphinx/init.py", line 208, in init
    super(LiveSpeech, self).init(*kwargs)
    File "/home/garud/anaconda3/lib/python3.7/site-packages/pocketsphinx/init.py", line 90, in init
    super(Pocketsphinx, self).init(config)
    File "/home/garud/anaconda3/lib/python3.7/site-packages/pocketsphinx/pocketsphinx.py", line 273, in init
    this = _pocketsphinx.new_Decoder(
    args)
    RuntimeError: new_Decoder returned -1</module>

    Is some file which is downloaded is wrong?

     
    • Nickolay V. Shmyrev

      You need to set verbose=True in the code to see the exact error.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.