0

I'm trying to use pocketsphinx on python 3.2 but I'm very confused. I've placed the builded packages in the site-packages directory, made sure I'm using the right audio file format .According to the documentation python is supported because there are python bindings. I've looked around the forum and it seems that an _init_.py file is needed which is not included so that may be an issue? Any suggestions on how to fix this problem?

I am currently using pocketsphinx and sphinxbase v 0.8 downloaded link and link. The files I put into site packages are all files contained in the Debug folder of the pocketsphinx directory. namely:

  • sphinxbase.dll
  • pocketsphinx(.dll, .exp,.ilk,.lib,.pdb)
  • pocketsphinx_batch(.exe,.ilk,.pdb)
  • pocketsphinx_continuous(.exe,.ilk,.pdb)
  • pocketsphinx_mdef_convert(.exe,.ilk,.pdb)

I am using the following Python code:

import pocketsphinx as ps
from pocketsphinx import sphinxbase

hmmd = 'C:\Python32\Lib\site-packages\pocketsphinx\model\hmm\en_US\hub4wsj_sc_8k'
lmd = 'C:\Python32\Lib\site-packages\pocketsphinx\model\lm\en_US\hub4.5000.DMP'
dictd = 'C:\Python32\Lib\site-packages\pocketsphinx\model\lm\en_US\hub4.5000.dic'
fraw1 = file(r'C:\Users\Stefan\Documents\2012\40I6\test1.wav', 'rb')
fraw1.seek(44)
speechRec = ps.Decoder(hmm = hmmd, lm = lmd, dict = dictd) speechRec.decode_raw(fRaw1)
result = speechRec.get_hyp()
print (result[0])
Anwarvic
  • 12,156
  • 4
  • 49
  • 69
artifex_somnia
  • 438
  • 9
  • 20
  • You need to provide more details about what exactly did you compile, what pocketsphinx version are you using. What Python implementation are you using. Which files exactly did you put in site-packages. You do not need init.py. Pocketsphinx module is compiled into dll which should be called pocketsphinx.dll, that is the file which must be present in site-packages. You also need sphinxbase.dll – Nikolay Shmyrev Mar 08 '13 at 09:32
  • I am currently using **pocketsphinx and sphinxbase v 0.8** downloaded [link](http://sourceforge.net/projects/cmusphinx/files/sphinxbase/) and [link](http://sourceforge.net/projects/cmusphinx/files/pocketsphinx/0.8/). The files I put into site packages are all files contained in the Debug folder of the pocketsphinx directory. namely: sphinxbase.dll, pocketsphinx(.dll, .exp,.ilk,.lib,.pdb), pocketsphinx_batch(.exe,.ilk,.pdb), pocketsphinx_continuous(.exe,.ilk,.pdb), pocketsphinx_mdef_convert(.exe,.ilk,.pdb) – artifex_somnia Mar 08 '13 at 14:59
  • I am using the folling Python code: 'import pocketsphinx as ps from pocketsphinx import sphinxbase hmmd = 'C:\Python32\Lib\site-packages\pocketsphinx\model\hmm\en_US\hub4wsj_sc_8k' lmd = 'C:\Python32\Lib\site-packages\pocketsphinx\model\lm\en_US\hub4.5000.DMP' dictd = 'C:\Python32\Lib\site-packages\pocketsphinx\model\lm\en_US\hub4.5000.dic' fraw1 = file(r'C:\Users\Stefan\Documents\2012\40I6\test1.wav', 'rb') fraw1.seek(44) speechRec = ps.Decoder(hmm = hmmd, lm = lmd, dict = dictd) speechRec.decode_raw(fRaw1) result = speechRec.get_hyp() print (result[0]) ' – artifex_somnia Mar 08 '13 at 15:00
  • It's better to edit the question itself and put information there. It doesn't seem you compiled pocketsphinx python module, standard windows build doesn't include it. Did you compile pocketsphinx wrapper from python? There is setup_win32.py which you need to run. – Nikolay Shmyrev Mar 08 '13 at 15:03
  • I could not find a setup_win32.py file in the directory. Where can I find the pocketsphinx module for python 3.2 in windows? I've searched but came up empty. If you could provide a link that would be great. – artifex_somnia Mar 09 '13 at 23:08

1 Answers1

1

To compile python module do the following:

  1. Build sphinxbase and pocketsphinx with Visual Studio as needed
  2. copy sphinxbase.lib and sphinxbase.dll from sphinxbase/bin/Release to sphinxbase/python and to pocketsphinx/python
  3. copy pocketsphinx.lib and pocketsphinx.dll from pocketsphinx/bin/Release to sphinxbase/python and to pocketsphinx/python
  4. Open terminal
  5. Change directory to sphixnbase/python
  6. Run the command

    python setup_win32.py install

  7. Change directory to pocketsphinx/python

  8. Run the command

    python setup_win32.py install

  9. Run the command to test python

    python ps_test.py

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87