2014-11-22 87 views
1

我試圖在我的一個程序中實現語音識別,並已決定使用SpeechRecognition 1.1.3庫來實現此目的。Python 3.4 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

回答

2

我只是打開了這個項目拉請求 - 但問題是向後兼容的更新一個星期前。您可以拉我的版本來自: https://github.com/develra/speech_recognition/

進入speech_recognition/初始化 .py文件,並更改

如果系統== 「窗口」 和platform.machine()在集( 「386」, 「86」, 「x86_64的」, 「AMD64」):#Windows NT中,使用捆綁FLAC轉換工具

如果系統== 「窗口」 和platform.machine()在組([ 「I386」, 「86」, 「x86_64的」, 「AMD64」]):#Windows NT中,使用捆綁FLAC轉換實用

elif的系統== 「Linux的」,並在集platform.machine()( 「I386」, 「86」, 「x86_64的」, 「AMD64」):

elif的系統== 「的Linux」 和platform.machine( )in set([「i386」,「x86」,「x86_64」,「AMD64」]):