我在安装了 pyAudio 的 Python 2.7 中运行以下代码。
import speech_recognition as sr
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
try:
print("You said " + r.recognize(audio)) # recognize speech using Google Speech Recognition
except LookupError: # speech is unintelligible
print("Could not understand audio")
输出给出一个闪烁的指针。就是这样。
可能的原因可能是recognizer_instance.energy_threshold
属性可能设置为太高而无法开始的值。您应该降低此阈值,或致电recognizer_instance.adjust_for_ambient_noise(source, duration = 1)
。您可以在以下位置了解更多信息语音识别 https://github.com/Uberi/speech_recognition
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)