win+python实现离线语音识别
2018年12月05日 19:28:29 面-包 阅读数:38更多
个人分类: python学习
安装SpeechRecognition模块
使用recognize_sphinx(),安装PocketSphinx
使用测试:
import speech_recognition as sr
# obtain audio from the microphone
r = sr.Recognizer()
print(r)
harvard = sr.AudioFile('input.wav')
print(harvard)
with harvard as source:
audio = r.record(source)
# recognize speech using Sphinx
try:
print("Sphinx thinks you said " + r.recognize_sphinx(audio))
except sr.UnknownValueError:
print("Sphinx could not understand audio")
except sr.RequestError as e:
print("Sphinx error; {0}".format(e))
参考文献:
https://blog.csdn.net/zhangbijun1230/article/details/83420031