Python 中的语音识别
我找到了语音模块,我可以让我的电脑说出我写的东西。但问题是当我尝试这里的示例代码时: http://pypi. python.org/pypi/speech/0.5.1 它给了我一个错误并且无法做到这一点。这是我得到的错误:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
response = speech.input("Say something, please.")
File "build\bdist.win32\egg\speech.py", line 162, in input
listener = listenforanything(response)
File "build\bdist.win32\egg\speech.py", line 193, in listenforanything
return _startlistening(None, callback)
File "build\bdist.win32\egg\speech.py", line 222, in _startlistening
context = _recognizer.CreateRecoContext()
File "C:\Python26\lib\site-packages\win32com\gen_py\C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4.py", line 2648, in CreateRecoContext
ret = self._oleobj_.InvokeTypes(10, LCID, 1, (9, 0), (),)
com_error: (-2147352567, 'Exception raised.', (0, None, None, None, 0, -2147200905), None)
我真的希望有人可以帮助我。
预先非常感谢,
杰克
I found the speech module and i can get my computer to say the stuff i write. But the problem is when i try out the example code from here: http://pypi.python.org/pypi/speech/0.5.1 It gives me an error and can't do it. This is the error i get:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
response = speech.input("Say something, please.")
File "build\bdist.win32\egg\speech.py", line 162, in input
listener = listenforanything(response)
File "build\bdist.win32\egg\speech.py", line 193, in listenforanything
return _startlistening(None, callback)
File "build\bdist.win32\egg\speech.py", line 222, in _startlistening
context = _recognizer.CreateRecoContext()
File "C:\Python26\lib\site-packages\win32com\gen_py\C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4.py", line 2648, in CreateRecoContext
ret = self._oleobj_.InvokeTypes(10, LCID, 1, (9, 0), (),)
com_error: (-2147352567, 'Exception raised.', (0, None, None, None, 0, -2147200905), None)
I really hope someone can help me.
Thanks alot in advance,
Jake
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了使语音模块正常工作,您还必须安装 pywin32。
In order for the speech module to function properly you must also install pywin32.