首页 > 解决方案 > 如何将词典发送到文本到语音

问题描述

我需要将新词典合并到 Azure 文本转语音 API 的帮助。

https://docs.microsoft.com/en-us/previous-versions/office/developer/speech-technologies/hh378492%28v%3doffice.14%29

我已成功发送文本并获得了可以使用的 mp3 文件。现在我正在尝试合并一个发音困难的词典。

我正在使用 Python SDK for Text-to-Speech,文档中的问题很少。

<?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')

标签: pythonazure

解决方案


推荐阅读