作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在将 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/
我是一名优秀的程序员,十分优秀!