为什么python pocketsphinx会给出TypeError?

为什么python pocketsphinx会给出TypeError?,python,pocketsphinx,Python,Pocketsphinx,我正在使用Python pocket sphinx教程,根据 (请在此填写代码): 当我运行它时,会收到以下错误消息: Traceback (most recent call last): File "hello.py", line 30, in <module> recognised = decodeSpeech(hmdir,lmd,dictd,wavfile) File "hello.py", line 17, in decodeSpeech speechRec = ps.De

我正在使用Python pocket sphinx教程,根据

(请在此填写代码):

当我运行它时,会收到以下错误消息:

Traceback (most recent call last):
File "hello.py", line 30, in <module>
recognised = decodeSpeech(hmdir,lmd,dictd,wavfile)
File "hello.py", line 17, in decodeSpeech
speechRec = ps.Decoder(hmm = hmmd, lm = lmdir, dict = dictp)
TypeError: __init__() got an unexpected keyword argument 'hmm'
回溯(最近一次呼叫最后一次):
文件“hello.py”,第30行,在
识别=解码语音(hmdir、lmd、dictd、wavfile)
文件“hello.py”,第17行,在decodeSpeech中
speechRec=ps.Decoder(hmm=hmmd,lm=lmdir,dict=dictp)
TypeError:\uuuu init\uuuuuuuuuu()获得了意外的关键字参数“hmm”

你能帮我吗?

看看GitHub上的pocketsphinx代码,我们有一个如何将选项传递给解码器的示例

因此,看起来您的教程是针对旧版本的,您实际上想要:

config = ps.Decoder.default_config()
config.set_string('-hmm', hmmd)
config.set_string('-lm', lmdir)
config.set_string('-dict', dictp) 

speechRec = ps.Decoder(config)

检查你能通过的论点init@galaxyan编辑。抱歉,关于识别。我的意思是错误告诉您hmm不是可以在init中传递的参数。从中可以看到,
Decoder()
类只接受一个
config
参数。我怀疑你的教程已经过时了,找一个不同的教程。如果你提供了
帮助(ps.Decoder)
,它是否提到了它需要的参数?正如Martijn Pieters所说,您的教程可能是针对不同版本的。
config = ps.Decoder.default_config()
config.set_string('-hmm', hmmd)
config.set_string('-lm', lmdir)
config.set_string('-dict', dictp) 

speechRec = ps.Decoder(config)