Menu

issue with using PocketSphinx from python on Raspberry pi (Raspbian)

Help
Mo Valli
2015-04-30
2015-04-30
  • Mo Valli

    Mo Valli - 2015-04-30

    Hi,
    I have install the latest pocket sphinx 5 pre-alpha from the repository and have got it working using pocketsphinx_continuous.

    However, when I try using it from python, I get the following error

    ~~~~~~~~~~~~~~
    Traceback (most recent call last):
    File "./pocket2.py", line 47, in <module>
    recognised = decodeSpeech(hmdir,lmd,dictd,wavfile)
    File "./pocket2.py", line 21, in decodeSpeech
    speechRec = ps.Decoder(hmm = hmmd, lm = lmdir, dict = dictp)
    TypeError: init() got an unexpected keyword argument 'hmm'

    below is the typical sample code I have found from the net
    

    import sys,os

    def decodeSpeech(hmmd,lmdir,dictp,wavfile):

    try:
    
        import pocketsphinx as ps
    
        import sphinxbase
    
    except:
    
        print """Pocket sphinx and sphixbase is not installed
    
        in your system. Please install it with package manager.
    
        """
    
    speechRec = ps.Decoder(hmm = hmmd, lm = lmdir, dict = dictp)
    
    wavFile = file(wavfile,'rb')
    
    wavFile.seek(44)
    
    speechRec.decode_raw(wavFile)
    
    result = speechRec.get_hyp()
    
    return result[0]
    

    if name == "main":

    hmdir = "/usr/local/share/pocketsphinx/model/en-us/en-us"
    
    lmd = "1019.lm"
    
    dictd = "1019.dic"
    
    wavfile = "test.wav"
    
    recognised = decodeSpeech(hmdir,lmd,dictd,wavfile)
    
    print recognised
    

    ~~~~~~~~~~~~~

    Any help appriciated.

    KND RGS

    Mo.

     

    Last edit: Nickolay V. Shmyrev 2015-04-30

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.