0
votes

I have seen demo on google dev site as well as on git hub https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/speech.

My question is how to pass language parameter ?

I am using it like this :

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

It recognizes the speech in english. How to change that langugae as per our usage ? Will appreciate any help. Thanks.

1

1 Answers

2
votes

I believe you have to provide languageCode parameter. For the list of supported languages please visit
https://cloud.google.com/speech/docs/languages

Add languageCode like this :

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