【问题标题】:How to use SpeechContext to Google Cloud Speech如何使用 SpeechContext 到 Google Cloud Speech
【发布时间】:2016-12-02 23:59:51
【问题描述】:

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

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

谢谢!

蒂亚戈

【问题讨论】:

    标签: javascript google-app-engine speech-recognition google-cloud-platform


    【解决方案1】:

    这就是我形成包含 SpeechContext 以提供关键短语的 json 有效负载的方式,在本例中为“烤土豆”和“kerfuffle”:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-01
      • 2020-03-21
      • 1970-01-01
      • 1970-01-01
      • 2018-06-14
      • 1970-01-01
      • 1970-01-01
      • 2022-09-26
      相关资源
      最近更新 更多