语音识别蟒蛇代码不起作用 [英] speech recognition python code not working

查看:23
本文介绍了语音识别蟒蛇代码不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在安装了pyAudio的Python2.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)。您可以在Speech Recognition

了解更多信息

这篇关于语音识别蟒蛇代码不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆