Python 3.4 SpeechRecognition 1.1.3错误

时间:2014-11-22 19:48:37

标签: python-3.x speech-recognition

我正试图在我的一个程序中实现语音识别,并决定使用SpeechRecognition 1.1.3库来完成此任务。

我试图运行的代码,以及相关的错误是:

>>> r = sr.Recognizer()
>>> with sr.Microphone() as source:                # use the default microphone as the audio source
...     audio = r.listen(source)                   # listen for the first phrase and extract it into audio data
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "C:\Python34\lib\site-packages\speechrecognition-1.1.3-py3.4.egg\speech_recognition\__init__.py", line 201, in listen
    return AudioData(source.RATE, self.samples_to_flac(source, frame_data))
  File "C:\Python34\lib\site-packages\speechrecognition-1.1.3-py3.4.egg\speech_recognition\__init__.py", line 124, in samples_to_flac
    if system == "Windows" and platform.machine() in set("i386", "x86", "x86_64", "AMD64"): # Windows NT, use the bundled FLAC conversion utility
TypeError: set expected at most 1 arguments, got 4

我已经完成并下载了每个所需下载的正确版本。 我已经广泛搜索了它,并且无法找到原因。 这个以及阻止我转录特定Wav文件的另一个错误阻碍了我的项目,所以如果有人可以提供帮助,那将是值得赞赏的。

我正在运行Windows 8.1

1 个答案:

答案 0 :(得分:2)

我刚刚为此打开了项目的拉取请求 - 但问题是一周前向后兼容性的更新。您可以从我的版本中提取: https://github.com/develra/speech_recognition/

进入speech_recognition / init .py文件并更改

如果system ==“Windows”和platform.machine()in set(“i386”,“x86”,“x86_64”,“AMD64”):#Windows NT,请使用捆绑的FLAC转换实用程序

如果系统==“Windows”和platform.machine()in set([“i386”,“x86”,“x86_64”,“AMD64”]):#Windows NT,请使用捆绑的FLAC转换实用程序

elif system ==“Linux”和platform.machine()in set(“i386”,“x86”,“x86_64”,“AMD64”):

elif system ==“Linux”和platform.machine()in set([“i386”,“x86”,“x86_64”,“AMD64”]):