我想使用python的语音识别包,可是运行报错.已确定同一目录下放了这个wav文件,也安装了依赖包。 代码如下:
'''
import speech_recognition as sr
from os import path
file_path = path.join(path.dirname(path.realpath(__file__)), "english.wav")
r = sr.Recognizer()
with sr.WavFile(file_path) as source:
audio = r.record(source)
IBM_USERNAME = 'myemail'
IBM_PASSWORD= 'mypw'
text = r.recognize_ibm(audio, username = IBM_USERNAME, password = IBM_PASSWORD, language = 'en-US')
print text
'''
demo来源:http://t.cn/Rq9w0Z4