如何改变语音发音——有条件的SSML?
How to change speech pronunciation -- conditional SSML?
我有以下查看代码
template ("Here's an AltBrain by #{value(this.author)} on #{value(this.name)}") {speech ("Here's an AltBrain by #{value(this.author)} on #{value(this.name)}")}
当遇到 value(this.author) = "GitLab" 时,它会将发音改为 "Gitlib." 我该如何纠正?
我发现我可以像这样使用 SSML 的 speak 和 sub 命令
<speak> ... <sub alias = \"Git Lab\"> ... but how do I do this dynamically where I want it to adjust this.name if and only if it is a term that has a different pronunciation?
请注意,随着我继续探索这个问题,我意识到存在一个根本问题,即 Bixby 遇到的任何地方 "GitLab" 她都会发错音。我们需要一种全局更改机制,例如对话框文件。有这种东西吗?
这是一个可怕的 hack,只提供了部分解决方案。
if (exists(this.author) && this.author == 'GitLab')
{ template ("Here's an AltBrain by **GitLab** on #{value(this.name)}")
{speech ("Here's a AltBrain by **Git Lab** on #{value(this.name)}")}}
else ...
首先,这听起来像是一个需要 Bixby 平台修复的 TTS 错误。我会为此提交一张票。
但是,在某些情况下,开发人员可能希望显示和语音有所不同。一种技巧是使用值对话框。展示的时候用raw,演讲的时候用value。
这是值对话框:
dialog (Value) {
match: TextSource (this)
if (this == 'GitLab') {
template("Git Lab")
}
else {
template("#{raw(this)}")
}
}
以下是如何利用值对话框。
message {
template ("From #{raw(action.question.source)}, #{value(action.question.textQuestion)}") {
speech ("From #{value(action.question.source)}, #{value(action.question.textQuestion)}")
}
}
要测试完整的胶囊,download it from Github。我已经为其他目的制作了胶囊,但请尝试使用话语 "try one question" 并查看输入视图。
我有以下查看代码
template ("Here's an AltBrain by #{value(this.author)} on #{value(this.name)}") {speech ("Here's an AltBrain by #{value(this.author)} on #{value(this.name)}")}
当遇到 value(this.author) = "GitLab" 时,它会将发音改为 "Gitlib." 我该如何纠正?
我发现我可以像这样使用 SSML 的 speak 和 sub 命令
<speak> ... <sub alias = \"Git Lab\"> ... but how do I do this dynamically where I want it to adjust this.name if and only if it is a term that has a different pronunciation?
请注意,随着我继续探索这个问题,我意识到存在一个根本问题,即 Bixby 遇到的任何地方 "GitLab" 她都会发错音。我们需要一种全局更改机制,例如对话框文件。有这种东西吗?
这是一个可怕的 hack,只提供了部分解决方案。
if (exists(this.author) && this.author == 'GitLab')
{ template ("Here's an AltBrain by **GitLab** on #{value(this.name)}")
{speech ("Here's a AltBrain by **Git Lab** on #{value(this.name)}")}}
else ...
首先,这听起来像是一个需要 Bixby 平台修复的 TTS 错误。我会为此提交一张票。
但是,在某些情况下,开发人员可能希望显示和语音有所不同。一种技巧是使用值对话框。展示的时候用raw,演讲的时候用value。
这是值对话框:
dialog (Value) {
match: TextSource (this)
if (this == 'GitLab') {
template("Git Lab")
}
else {
template("#{raw(this)}")
}
}
以下是如何利用值对话框。
message {
template ("From #{raw(action.question.source)}, #{value(action.question.textQuestion)}") {
speech ("From #{value(action.question.source)}, #{value(action.question.textQuestion)}")
}
}
要测试完整的胶囊,download it from Github。我已经为其他目的制作了胶囊,但请尝试使用话语 "try one question" 并查看输入视图。