简体   繁体   English

Python 3.3似乎在Pocketsphinx库中找不到解码器模块

[英]Python 3.3 can't seem to find the decoder module in pocketsphinx library

I am getting the error AttributeError: 'module' object has no attribute 'Decoder'. 我收到错误AttributeError:'模块'对象没有属性'Decoder'。 I am using the following code. 我正在使用以下代码。 Because there was no setup.py file included I moved the dlls and libraries into their respective folders in the python33 directory manually. 因为没有包含setup.py文件,所以我将dll和库手动移到了python33目录中的相应文件夹中。 (Library files in lib and dlls in DLLs). (lib中的库文件和dll中的dll)。 I am able to import the pocketsphinx and sphinxbase modules without error. 我能够无错误地导入Pocketsphinx和sphinxbase模块。 Any help would be appreciated. 任何帮助,将不胜感激。

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) nsamp = Decoder.decode_raw(fh)

This part must be decoder.decode_raw(fh) . 这部分必须是decoder.decode_raw(fh) You are trying to look for Decoder in default module instead of method in an object. 您正在尝试在默认模块中查找解码器,而不是在对象中查找方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM