我收到错误AttributeError:'模块'对象没有属性'Decoder'。
我正在使用以下代码。因为没有包含setup.py文件,所以我将dll和库手动移到了python33目录中的相应文件夹中。 (lib中的库文件和dll中的dll)。我能够无错误地导入Pocketsphinx和sphinxbase模块。任何帮助,将不胜感激。

import pocketsphinx
import sphinxbase



lmd="C:\Python33\Lib\site-packages\pocketsphinx\model\lm\HUB4_trigram_lm\language_model.arpaformat"
hmd="C:\Python33\Lib\site-packages\pocketsphinx\model\hmm\en_US"
dictd="C:\Python33\Lib\site-packages\pocketsphinx\model\lm\HUB4_trigram_lm\language_model.vocabulary"

fh = open('test1.wav', 'rb')
fh.seek(44)
decoder = pocketsphinx.Decoder(hmmd,lmd, dictp)
nsamp = Decoder.decode_raw(fh)

hyp, uttid, score = decoder.get_hyp()
print('Got result'+ hyp+'score'+score)

最佳答案

nsamp = Decoder.decode_raw(fh)


此部分必须为decoder.decode_raw(fh)。您正在尝试在默认模块中查找解码器,而不是在对象中查找方法。

关于python - Python 3.3似乎在Pocketsphinx库中找不到解码器模块,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15651210/

10-10 06:24