gpt4 book ai didi

javascript - 如何将 SpeechContext 用于 Google Cloud Speech

转载 作者:行者123 更新时间:2023-11-30 00:05:41 28 4
gpt4 key购买 nike

我正在将 Google Cloud Speechem 集成到我的应用程序中,并希望使用文档中描述的 SpeechContext 功能:https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1#speechcontext

有没有人知道(教程)如何使用 SpeechContext 这个功能

谢谢!

蒂亚戈

最佳答案

这就是我如何形成包含 SpeechContext 的 json 有效负载以提供关键短语,在本例中为“baked potato”和“kerfuffle”:

{
"config": {
"encoding": "LINEAR16",
"sampleRateHertz": 16000,
"languageCode": locale,
"speechContexts": [
{
"phrases": [
"baked potato",
"kerfuffle",
],
}
],
},
"audio": {
"content": encoded_audio,
}
}

其中 locale 是保存语言代码的变量,encoded_audio 是保存音频的字节串。

提供此 SpeechContext 可以很好地解决 Google 翻译在解析我的应用程序特定关键短语时遇到的问题。

关于javascript - 如何将 SpeechContext 用于 Google Cloud Speech,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38638977/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com