2013-03-08 34 views
0

我想在python 3.2上使用pocketsphinx,但我很困惑。我已经将建好的软件包放在site-packages目录中,确保我使用的是正确的音频文件格式。根据文档,Python支持,因为有python绑定。我环顾了论坛,似乎初始化 .py文件是不需要的,这可能是一个问题?有关如何解决此问题的任何建议?导入pocketsphinx不工作python 3.2(Windows)。 “ImportError:没有模块名为pocketsphinx”

我目前使用pocketsphinx和sphinxbase v 0.8下载链接和链接。我放入网站包的文件是包含在pocketsphinx目录的Debug文件夹中的所有文件。即:sphinxbase.dll,pocketsphinx(.dll,.exp,.ilk,.lib,.pdb),pocketsphinx_batch(.exe,.ilk,.pdb),pocketsphinx_continuous(.exe,.ilk,.pdb),pocketsphinx_mdef_convert( .EXE,.ilk,.PDB) - 我使用folling Python代码:

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])

+0

您需要提供什么你究竟详情编译,你使用的是什么pocketsphinx版本。你使用的是什么Python实现。你把哪些文件放在网站包中。 你不需要init.py. Pocketsphinx模块被编译成应该被称为pocketsphinx.dll的dll,也就是必须存在于站点包中的文件。您还需要sphinxbase.dll – 2013-03-08 09:32:51

+0

我目前正在使用** pocketsphinx和sphinxbase v 0.8 **下载[链接](http://sourceforge.net/projects/cmusphinx/files/sphinxbase/)和[链接](http:///sourceforge.net/projects/cmusphinx/files/pocketsphinx/0.8/)。我放入网站包的文件是包含在pocketsphinx目录的Debug文件夹中的所有文件。即:sphinxbase.dll,pocketsphinx(.dll,.exp,.ilk,.lib,.pdb),pocketsphinx_batch(.exe,.ilk,.pdb),pocketsphinx_continuous(.exe,.ilk,.pdb),pocketsphinx_mdef_convert( .EXE,.ilk ,.PDB) – 2013-03-08 14:59:43

+0

我使用folling Python代码:“进口pocketsphinx为PS 从pocketsphinx进口sphinxbase HMMD = 'C:\ Python32 \ LIB \站点包\ pocketsphinx \型号\嗯\ 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) resu lt = speechRec.get_hyp() print(result [0]) ' – 2013-03-08 15:00:45

回答

1

编译Python模块执行以下操作:

  1. 构建sphinxbase和pocketsphinx与Visual Studio为需要
  2. 将sphinxbase.lib和sphinxbase.dll从sphinxbase/bin/Release复制到sphinxbase/python以及poc从pocketsphinx/bin中/释放ketsphinx /蟒
  3. 拷贝pocketsphinx.lib和pocketsphinx.dll到sphinxbase /蟒和pocketsphinx /蟒
  4. 打开终端
  5. 改变目录到sphixnbase /蟒
  6. 执行命令

    蟒蛇setup_win32.py安装

  7. 更改目录pocketsphinx /蟒蛇

  8. 运行命令

    蟒蛇setup_win32.py安装

  9. 运行命令测试蟒蛇

    蟒蛇ps_test.py

相关问题