当前位置: 首页 > news >正文

主题公园网站建设搜索关键词排名一般按照什么收费

主题公园网站建设,搜索关键词排名一般按照什么收费,货架网站开发,奇墙网站建设文章目录 理论文本转换为语音使用 pyttsx使用 SAPI使用 SpeechLib 语音转换为文本 代码和效果01使用pyttsx实现文本_语音02使用SAPI实现文本_语音03使用SpeechLib实现文本_语音04使用PocketSphinx实现语音转换文本 理论 语音识别技术#xff0c;也被称为自动语音识别#xf… 文章目录 理论文本转换为语音使用 pyttsx使用 SAPI使用 SpeechLib 语音转换为文本 代码和效果01使用pyttsx实现文本_语音02使用SAPI实现文本_语音03使用SpeechLib实现文本_语音04使用PocketSphinx实现语音转换文本 理论 语音识别技术也被称为自动语音识别目标是以电脑自动将人类的语音内容转换为相 应的文字和文字转换为语音。 文本转换为语音 使用 pyttsx 使用名为 pyttsx 的 python 包你可以将文本转换为语音。直接使用 pip 就可以进行安装 命令如下 pip install pyttsx3【示例】使用 pyttsx 实现文本转换语音 import pyttsx3 as pyttsx enginepyttsx.init() engine.say(你好 pyttsx) engine.runAndWait() 使用 SAPI 在 python 中你也可以使用 SAPI 来做文本到语音的转换。 【示例】使用 SAPI 实现文本转换语音 from win32com.client import Dispatch msg你好 SAPI speaker Dispatch(SAPI.SpVoice) speaker.Speak(msg) del speaker 使用 SpeechLib 使用 SpeechLib可以从文本文件中获取输入再将其转换为语音。先使用 pip 安装 命令如下 pip install comtypes 【示例】使用 SpeechLib 实现文本转换语音 from comtypes.client import CreateObject engineCreateObject(SAPI.SpVoice) streamCreateObject(SAPI.SpFileStream) from comtypes.gen import SpeechLib infiledemo.txt outfiledemo_audio.wav stream.Open(outfile,SpeechLib.SSFMCreateForWrite) engine.AudioOutputStreamstream fopen(infile,r,encodingutf-8) theTextf.read() f.close() engine.speak(theText) stream.close() 语音转换为文本 使用 PocketSphinx PocketSphinx 是一个用于语音转换文本的开源 API。它是一个轻量级的语音识别引擎 尽管在桌面端也能很好地工作它还专门为手机和移动设备做过调优。 首先使用 pip 命令安装所需模块命令如下 pip install PocketSphinx pip install SpeechRecognition 【示例】使用 PocketSphinx 实现语音转换文本 import speech_recognition as sr audio_filedemo_audio.wav rsr.Recognizer() with sr.AudioFile(audio_file) as source: audio r.record(source) try: # print(文本内容,r.recognize_sphinx(audio,languagezh_CN)) print(文本内容,r.recognize_sphinx(audio)) except Exception as e: print(e) 注意 □ 安装完 speech_recognition 之后是不支持中文的需要在 Sphinx 语音识别工具包里 面 下 载 对 应 的 普 通 话 升 学 和 语 言 模 型 。 下 载 地 址 https://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Mo dels/ □ 将 下 载 好 的 普 通 话 升 学 和 语 言 模 型 放 到 安 装 speech_recognition 模 块 的 pocketsphinx-data 目录下。 代码和效果 01使用pyttsx实现文本_语音 import pyttsx3 as pyttsx enginepyttsx.init() engine.say(好好学习) engine.runAndWait()复制到vscode或其他运行时需要 pip install pyttsx3 02使用SAPI实现文本_语音 from win32com.client import Dispatch speakerDispatch(SAPI.SpVoice) speaker.Speak(大家好) del speaker03使用SpeechLib实现文本_语音 from comtypes.client import CreateObject from comtypes.gen import SpeechLib engineCreateObject(SAPI.SpVoice) streamCreateObject(SAPI.SpFileStream) infiledemo.txt outfiledemo_audio.wav stream.open(outfile,SpeechLib.SSFMCreateForWrite) engine.AudioOutputStreamstream #读取文本内容 fopen(infile,r,encodingutf-8) theTextf.read() f.close() engine.speak(theText) stream.close()需要将文本放到电脑根目录下 04使用PocketSphinx实现语音转换文本 import speech_recognition as sr audio_filedemo_audio.wav rsr.Recognizer() #打开语音文件 with sr.AudioFile(audio_file) as source:audior.record(source)#将语音转换为文本 # print(文本内容,r.recognize_sphinx(audio)) print(文本内容,r.recognize_sphinx(audio,languagezh-CN))一、安装环境库 ModuleNotFoundError: No module named ‘speech_recognition’ 是pip install speechrecognition 再安装pip install PocketSphinx 二、文件放根目录
http://www.w-s-a.com/news/216452/

相关文章:

  • 宿松网站建设推荐秒搜科技国家官方网站
  • 网站的服务器选择wordpress文章底部加分享
  • 天津专业的网站建设公司阿里云服务器 wordpress
  • 家教辅导培训网站建设中东跨境电商平台有哪些
  • 商城形式的网站需要多少钱做医药商城网站的公司吗
  • 贵阳网站设计zu97彩票创建网站
  • 网站建设与分工的论文足球世界排名
  • 网站首页添加标签如何用模板建站
  • 官方网站包括哪几个网站泰安的网站建设公司哪家好
  • 域名虚拟服务器做网站如何搭建企业网站
  • 用手机做网站服务器口碑好的常州网站建设
  • 摄影网站的设计与实现开题报告太原企业自助建站
  • 做如美团式网站要多少钱做网站怎么去文化局备案
  • 桂平市住房和城乡建设局网站网站建设与管理自考题
  • 怎么做公司网站制作凡科官方网
  • 达人设计网官方网站建筑效果图网站有哪些
  • 网站定制哪家快建筑室内设计网
  • 网站创建方案论文旅游网站的设计与制作html
  • 网站建设的数据导入导出开发小程序需要多少钱费用
  • 局网站建设进入前十名wordpress user role editor
  • 网站托管如何收费搜一下百度
  • 中国建设劳动协会网站wordpress 区块链媒体
  • 网站开源是什么意思西安做网站科技有限公司
  • 自己怎么用h5做网站肇庆seo
  • 长沙网站seo优化公司东莞企业官方网站建设
  • 网站个人备案材料北京网站推广价格
  • 百度做任务的网站电子工程网网站
  • 中介订制网站开发玉溪网站建设设计
  • 免费网站免费无遮挡手机页面设计软件
  • 网站建设需求规格说明书中山模板建站公司