0

I'm trying to run pocketsphinx in Ubuntu 14.04LTS and python 2.7 pocketsphinx & sphenixbase is compiled from latest git source. When I'm trying to run the code I'm getting following error:

Traceback (most recent call last):
  File "test.py", line 28, in <module>
    hyp, uttid, score = speechRec.get_hyp()
  File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 252, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Decoder, name)
  File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 75, in _swig_getattr
    raise AttributeError(name)
AttributeError: get_hyp

The code I'm trying to execute:

#!/usr/bin/ python

import sys
import pocketsphinx

if __name__ == "__main__":

   hmdir = "./lang/model/en_us"
   lmdir = "./lang/etc/cmusphinx-5.0-en-us.lm.dmp"
   dictd = "./lang/etc/cmu07a.dic"
   wavfile = sys.argv[1]

   config = pocketsphinx.Decoder.default_config()
   config.set_string('-hmm', hmdir)
   config.set_string('-lm', lmdir)
   config.set_string('-dict', dictd)

   speechRec = pocketsphinx.Decoder(config)
   audioFile = file(wavfile, 'rb')
   speechRec.decode_raw(audioFile)
   hyp, uttid, score = speechRec.get_hyp()

   print 'Got result'+ hyp+'score'+score

1 Answers1

1

It's hyp, not get_hyp. You can find a few code samples in swig/python/test directory of the pocketsphinx distribution.

Alexander Solovets
  • 2,447
  • 15
  • 22