Whisper 安装困难?Python 语音识别库有哪些其他选择?

ID:21340 / 打印

whisper 安装困难?python 语音识别库有哪些其他选择?

python 语音识别库的推荐

对于需要实现语音转文字功能的用户,在经历了 whisper 库的安装困境和运行卡顿后,不妨考虑其他可选的语音识别库。

speechrecognition 库

speechrecognition 库提供了对多种语音识别 api 的支持,包括:

立即学习“Python免费学习笔记(深入)”;

  • google web speech api
  • microsoft bing voice recognition
  • ibm speech to text

该库使用简单,可以轻松地集成到 python 项目中。以下是使用 speechrecognition 库进行语音转文字的示例代码:

PHP
import speech_recognition as sr  r = sr.Recognizer() with sr.Microphone() as source:     # 从麦克风获取音频输入     audio = r.listen(source)  try:     # 使用 Google Web Speech API 识别音频     text = r.recognize_google(audio)     print("识别结果:", text) except sr.RequestError:     print("与 Speech Recognition 服务通信时出现错误。") except sr.UnknownValueError:     print("无法识别语音。")

speechrecognition 库易于使用、支持多种 api,是一个适合语音转文字任务的强大选择。

上一篇: 用 Python 的 Turtle 模块绘制星号组成的正方形,应该怎么做?
下一篇: 自动化桌面脚本:新手如何快速上手库和框架?

作者:admin @ 24资源网   2025-01-14

本站所有软件、源码、文章均有网友提供,如有侵权联系308410122@qq.com

与本文相关文章

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。