Google语音识别API结果为空 [英] Google Speech Recognition API Result is Empty
问题描述
我正在对Google云语音API执行异步请求,但我不知道如何获得操作结果:
请求POST: https://speech.googleapis.com/v1beta1/speech:asyncrecognize
正文:
{
config:{
languageCode:pt-BR,
encoding:LINEAR16,
sampleRate:16000
},
audio:{
uri:gs://bucket/audio.flac
}
}
返回:
{ name:469432517}
所以,我做了一个POST: https://speech.googleapis.com/v1beta1/operations/469432517
返回:
{
name:469432517 ,
metadata:{
@type:type.googleapis.com/google.cloud.speech.v1beta1.AsyncRecognizeMetadata,
progressPercent:100,
startTime:2016-08-11T21:18:29.985053Z,
lastUpdateTime:2016-08-11T21:18:31.888412Z
},
完成:true,
响应:{
@type:type.googleapis.com/google.cloud.speech.v1beta1.AsyncRecognizeResponse
}
}
我需要得到操作的结果:转录的文本。 b
我该怎么做?
您已获得操作结果是空的。空格结果的原因是格式不匹配。您应该已经提交了LINEAR16文件(PCM未压缩数据,基本上是WAV文件),并且您尝试提交FLAC(压缩格式)。
其他原因可能是空的不正确的采样率,不正确的频道数量等。
最后,纯沉默的文件将导致空响应。
I'm performing an asynchronous request to Google Cloud Speech API, and I do not know how to get the result of operation:
Request POST: https://speech.googleapis.com/v1beta1/speech:asyncrecognize
Body:
{
"config":{
"languageCode" : "pt-BR",
"encoding" : "LINEAR16",
"sampleRate" : 16000
},
"audio":{
"uri":"gs://bucket/audio.flac"
}
}
Which returns:
{ "name": "469432517" }
So, I do a POST: https://speech.googleapis.com/v1beta1/operations/469432517
Which returns:
{
"name": "469432517",
"metadata": {
"@type": "type.googleapis.com/google.cloud.speech.v1beta1.AsyncRecognizeMetadata",
"progressPercent": 100,
"startTime": "2016-08-11T21:18:29.985053Z",
"lastUpdateTime": "2016-08-11T21:18:31.888412Z"
},
"done": true,
"response": {
"@type": "type.googleapis.com/google.cloud.speech.v1beta1.AsyncRecognizeResponse"
}
}
I need to get the result of the operation: the transcribed text.
How can I do that?
You've got the result of the operation and it is empty. The reason of the empty result is format mismatch. You should have submitted "LINEAR16" file (PCM uncompressed data, basically WAV file) and you try to submit FLAC (compressed format).
Other reason of the empty result might be incorrect sample rate, incorrect number of channels and so on.
Last, the file with pure silence will result in empty response.
这篇关于Google语音识别API结果为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!