2017-08-08 75 views
1

我遵循社區谷歌雲平臺連接到twilio捕獲語音通話,並保存到桶。但是,由於以下錯誤消息,它無法翻譯語音。有誰知道爲什麼 google.cloud.speech.v1.RecognizeRequest無法識別桶?Google.cloud.speech.v1.RecognizeRequest無法識別存儲桶?

(網址:https://cloud.google.com/community/tutorials/cloud-functions-twilio-voice-record

"Error: .google.cloud.speech.v1.RecognizeRequest#bucket is not a field: undefined at Error (native) at MessagePrototype.set (/user_code/node_modules/@google-cloud/speech/node_modules/protobufjs/dist/protobuf.js:2490:35) at MessagePrototype.set (/user_code/node_modules/@google-cloud/speech/node_modules/protobufjs/dist/protobuf.js:2483:38) at Message (/user_code/node_modules/@google-cloud/speech/node_modules/protobufjs/dist/protobuf.js:2411:34) at serialize (/user_code/node_modules/@google-cloud/speech/node_modules/grpc/src/node/src/protobuf_js_5_common.js:81:23) at ServiceClient.Client.makeUnaryRequest (/user_code/node_modules/@google-cloud/speech/node_modules/grpc/src/node/src/client.js:530:17) at apply (/user_code/node_modules/@google-cloud/speech/node_modules/lodash/lodash.js:499:17) at ServiceClient.wrapper [as recognize] (/user_code/node_modules/@google-cloud/speech/node_modules/lodash/lodash.js:5356:16) at /user_code/node_modules/@google-cloud/speech/src/v1/speech_client.js:111:41 at timeoutFunc (/user_code/node_modules/@google-cloud/speech/node_modules/google-gax/lib/api_callable.js:177:12)"
timestamp: "2017-08-07T17:27:02.601Z"

回答

1

我解決了這個用下面的代碼:

var config = { 
    sampleRateHertz: 8000, 
    encoding: 'LINEAR16', 
    languageCode: 'en-US' 


}; 
var uri = `gs://${object.bucket}/${object.name}`; 
var audio = { 
    uri : uri 
}; 
var request = { 
    config: config, 
    audio: audio 
}; 

// Transcribe the audio file 
return speech.recognize(request) 

順便說一句:我也有以下注釋掉「註釋」功能得到它去工作

+0

我遇到了同樣的問題...你可以發佈你的完整文件的要點或東西?如果您註釋掉註釋功能,這是否意味着您沒有進行任何分析? – Alteredorange

+0

我沒有完整的解決方案。我用這個例子爲我自己的用例創建了一些東西。 – user3592803