在python中使用Azure认知服务(texttospeach)的lexicon时出现的问题

2024-06-09 15:39:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用python中的AzureCognitiveTTS已经有相当一段时间了,使用他们在web上的示例,效果很好。我有一个问题,必须引入外部词汇,所以我制作了它们并将它们添加到命令中。看起来是这样的:

<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" xml:lang="en-US">
  <voice name="en-US-JennyNeural">
    <lexicon uri="https://www.something.net/get_lexicons_for_ms/lexicon-test.xml"/>
      <mstts:express-as style="newscast-formal">
        <prosody pitch="+0Hz" rate="+0%">Our CEO has resigned</prosody>
      </mstts:express-as> 
   </voice>
</speak>

词典是这样描述的:

<lexicon version="1.0" 
         xmlns="http://www.w3.org/2005/01/pronunciation-lexicon"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.w3.org/2005/01/pronunciation-lexicon
         http://www.w3.org/TR/2007/CR-pronunciation-lexicon-20071212/pls.xsd"
         alphabet="sapi" xml:lang="en-US">

   <lexeme>
      <grapheme>CEO</grapheme>
      <alias>Chief Executive Officer</alias>
   </lexeme>

   <lexeme> 
      <grapheme>CTO</grapheme>
      <alias>Chief Technology Officer</alias>
   </lexeme>
</lexicon>

我用转换后的文本获取音频,我看到Azure正在从web获取我的词典,但我没有像在词典中那样获得正确的文本更改

我做错什么了吗


Tags: orghttpwwwaliasxml词典enus