简体   繁体   English

Google Text to Speech:带减号的单词返回 Timepoint second = 0

[英]Google Text to Speech: word with minus character returns Timepoint second = 0

What I'm going to do : I'd like to generate an mp3 file and timepoint information with Google Text to Speech.我要做什么:我想用 Google Text to Speech 生成一个 mp3 文件和时间点信息。

Context : I'm using Java and the google-cloud-texttospeech library in version 2.4.0.上下文:我在 2.4.0 版中使用 Java 和google-cloud-texttospeech库。 Timepoint is v1beta1.Timepoint .时间v1beta1.Timepoint Timepoint

Problem : When I send the SSML string <speak>Hallo <mark name="p1s0"/>Schmetterlings-Arten.</speak> then the time_seconds in Timepoint in the response is 0 .问题:当我发送 SSML 字符串<speak>Hallo <mark name="p1s0"/>Schmetterlings-Arten.</speak> Timepoint ,响应中time_seconds中的 time_seconds 为0

What works : When I exchange the German word "Schmetterlings-Arten" by "Schmetterlingsarten", everything is OK and the time_seconds in Timepoint in the response is 0.419, which is fine.什么有效:当我用“Schmetterlings-Arten”交换德语单词“Schmetterlings-Arten”时,一切正常,响应中time_seconds中的Timepoint为 0.419,这很好。

Additional info : I'm using the voice for "language_code" = "de-DE" , "name" = "de-DE-Wavenet-E" , "audio_encoding" = "MP3" and "enable_time_pointing" = "SSML_MARK" .附加信息:我正在使用"language_code" = "de-DE""name" = "de-DE-Wavenet-E""audio_encoding" = "MP3""enable_time_pointing" = "SSML_MARK"的语音。

Question : Is there something special about a minus character in a word?问题:单词中的减号有什么特别之处吗? Do I have to escape it somehow (and if so: how)?我是否必须以某种方式逃避它(如果是这样:如何)?

What I tried : I tried some other names for that mark, added some spaces, added some other tags (eg START mark, END mark, some breaks, ...), tried to escape the minus character with a backslash, .... Nothing of that changed the result.我尝试了什么:我尝试了该标记的其他名称,添加了一些空格,添加了一些其他标签(例如开始标记,结束标记,一些中断,...),尝试用反斜杠转义减号,... . 这一切都没有改变结果。

As of now, this is an expected behavior when using any German language from the supported voices and languages of text-to-speech .截至目前,当使用来自支持的声音和 text-to-speech 语言的任何德语时,这是一种预期的行为。 The team for Cloud Text-to-Speech product is constantly making changes to try to improve issues like this. Cloud Text-to-Speech产品的团队不断进行更改以尝试改进此类问题。

Possible workaround for now is to pre-process your input SSML and remove the hyphen(-) by using REGEX REPLACE similar to below sample using java.目前可能的解决方法是预处理您的输入 SSML并使用REGEX REPLACE删除连字符 (-),类似于使用 java 的示例。

String original_SSML = "<speak>Hallo <mark name='p1s0'/>Schmetterlings-Arten.</speak>";
String updated_SSML = original_SSML.replace("-", "");

And then pass the updated variable to the text-to-speech's input SSML of your request body .然后将更新后的变量传递给您的请求正文text-to-speech 的输入 SSML

In addition, you may also file a bug for this specific issue on German language and star it if you want to be notified regarding the filed bug.此外,如果您想收到有关已提交错误的通知,您还可以针对此特定问题提交德语版错误加注星标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM