python - 如何将词典发送到文本到语音
问题描述
我需要将新词典合并到 Azure 文本转语音 API 的帮助。
我已成功发送文本并获得了可以使用的 mp3 文件。现在我正在尝试合并一个发音困难的词典。
我正在使用 Python SDK for Text-to-Speech,文档中的问题很少。
此参考“词典元素 SSML (Microsoft.Speech)”是否已过时?
我使用什么 URI?
当我使用本文档中的说明时,我收到以下错误消息:状态代码:400。出了点问题。检查您的订阅密钥和标题。我该如何解决或调查此问题?
词典必须采用什么格式?我在文档中看到了一个示例,该示例引用了 .pls 格式的词典。我如何创建这个?这是参考:
<?xml version="1.0"?>
<speak
version="1.0"
xmlns="http://www.w3.org/2001/10/synthesis"
xml:lang="en-US">
<lexicon
uri="c:\Test\whatchamacallit.pls"
type="application/pls+xml"/>
Gimme the whatchamacallit. </speak>
这是我正在使用的 Python 的一部分:
xml_body = ElementTree.Element('speak', version='1.0')
xml_body.set('{http://www.w3.org/XML/1998/namespace}lang', 'en-us')
lexicon = ElementTree.SubElement(xml_body, 'lexicon')
lexicon.set('uri', '/User/.../Desktop/MedLex.pls')
lexicon.set('type', 'application/pls+xml')
解决方案
推荐阅读
- java - 在java中使用文件时只读取一行的逻辑错误
- python - 如何在 Python 中的 Matplotlib 中保存图形
- d3.js - 使用 d3-transition 作为单独的 npm 模块
- machine-learning - Catboost 超参数搜索
- point-cloud-library - 如何使用 PCL 可视化器 (Windows) 并避免在可视化器关闭时关闭我的应用程序的 WM_QUIT 消息
- .net - 如何在控制器 .net 核心 MVC 中将值附加到 ViewBag?
- pentaho - Pentaho Data Integration (kettle) 6.0.1 将无法识别命令行参数
- android - 如何使用滑动调整占位符可绘制图像的大小?
- delphi - 如何删除行之间的 DBGrid 边框
- python - 如何将迭代数组存储为一个?