【问题标题】:Google cloud speech API : Nodejs谷歌云语音 API:Nodejs
【发布时间】:2017-07-11 01:30:43
【问题描述】:

我在 google 开发网站以及 git hub https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/speech 上看到了演示。

我的问题是如何传递语言参数?

我是这样使用它的:

var speech = require('@google-cloud/speech')({
                                    projectId: 'xxxxxxxx',
                                    keyFilename: 'xxxxxxx'
                                });
                                speech.recognize(file, {
                                    encoding: 'FLAC',
                                    sampleRate: 44100
                                }, function(err, transcript) {
                                    if(err) {
                                        throw err;
                                    });

它可以识别英文语音。如何根据我们的用法更改该语言?将不胜感激任何帮助。谢谢。

【问题讨论】:

    标签: node.js google-cloud-platform google-speech-api


    【解决方案1】:

    我相信你必须提供languageCode 参数。如需支持的语言列表,请访问
    https://cloud.google.com/speech/docs/languages

    像这样添加语言代码:

    speech.recognize(file, {
                                        encoding: 'FLAC',
                                        sampleRate: 44100,
                                        languageCode : 'your_language_code'
                                    }
    

    【讨论】:

    • 我知道。但是那个选项在哪里?传递语言代码
    • 请在“sampleRate”后面加上这个参数:44100
    猜你喜欢
    • 1970-01-01
    • 2023-04-09
    • 2017-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多