Menu

Attribute Error in decode_raw function

Help
2015-05-27
2015-05-29
  • Sunny Kumar

    Sunny Kumar - 2015-05-27

    Hi,

    I am getting the following error -

    Traceback (most recent call last):
    File "testFolderAction.py", line 47, in <module>
    recognisedSpeech = decodeSpeech(hmdir,lmd,dictd,fn)
    File "testFolderAction.py", line 33, in decodeSpeech
    speechRec.decode_raw(audioFile)
    File "/usr/local/lib/python2.7/site-packages/pocketsphinx/pocketsphinx.py", line 318, in <lambda>
    getattr = lambda self, name: _swig_getattr(self, Decoder, name)
    File "/usr/local/lib/python2.7/site-packages/pocketsphinx/pocketsphinx.py", line 88, in _swig_getattr
    return _swig_getattr_nondynamic(self, class_type, name, 0)
    File "/usr/local/lib/python2.7/site-packages/pocketsphinx/pocketsphinx.py", line 83, in _swig_getattr_nondynamic
    return object.getattr(self, name)
    AttributeError: type object 'object' has no attribute 'getattr'</lambda></module>

    Following is the code I am trying -


    psConfig = ps.Decoder.default_config()
    psConfig.set_string('-hmm', hmmd)
    psConfig.set_string('-lm', lmdir)
    psConfig.set_string('-dict', dictp)
    speechRec = ps.Decoder(psConfig)

    audioFile = file(wavfile,'rb')
    audioFile.seek(44)
    speechRec.decode_raw(audioFile)
    result = speechRec.hyp()
    if result is None:
    transcribed = ''
    else:
    transcribed = result.hypstr
    return (transcribed)


    I am working on RHEL6 (64 bit)

    Thanks for the help.

     
    • bic-user

      bic-user - 2015-05-27

      Hi, Sunny.

      Checking pocketsphinx decoder swig interface in trunk, it doesn't contain wrapping for full file decoding, i.e. "speechRec.decode_raw(audioFile)". Did you add that yourself? Does pocketsphinx/swig/python/test/decoder_test.py works for you?

       
    • Nickolay V. Shmyrev

      decode_raw was removed from API because it is incompatible with Python3. You can decode chunk by chunk, pocketsphinx/swig/python/test/decoder_test.py demonstrates how to do that.

       

Log in to post a comment.