最近更新时间:2021-08-19
将音频转变为特定的文本。本服务目前支持的语音类型为短语音文件,语音合成音频限制30秒之内。适用于在线对话聊天,控制口令等较短的语音识别场景。
调用地址:https://apim.unicloud.com/api/speech/asrsentence/1.0.0
请求方式:POST
返回类型:JSON
Header如下:
| 参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
|---|---|---|---|---|
| Authorization | true | string | Bearer <Token> | 参考Token获取 |
Body如下:
body为二进制音频数据,如在binary中上传一个16K的音频文件,只能识别16Kbit采样率的音频。
curl -k -H "Authorization: Bearer f38406ce-dcfe-3cdb-afb0-07b07ac5b6ad" -H "Content-Type: binary" \
"https://apim.unicloud.com/api/speech/asrsentence/1.0.0" \
--data-binary "@D:/tu/woaitianan.wav"
curl --location --request POST 'https://apim.unicloud.com/api/speech/asrsentence/1.0.0/' \
--header 'audio-format: wav' \
--header 'sample-rate: 16000' \
--header 'add-pct: false' \
--data-binary '@wk.wav'
curl --location --request POST 'https://apim.unicloud.com/api/speech/asrsentence/1.0.0/' \
--header 'audio-format: wav' \
--header 'sample-rate: 16000' \
--header 'add-pct: false' \
--data-binary '@wk.wav'
| 字段 | 类型 | 说明 |
|---|---|---|
| status | string | 识别结果类型: success 完成识别 success_partial 实时识别中间结果 success_timeout音频过长,有识别结果(超过30s) no_appkey appKey不存在 no_contextcodecontextCode不存在 no_resource appKey使用并发超限 no_license 许可不足 error 其他错误 |
| info | string | status为success时为识别文本,其他为空 |
| requestId | string | 唯一请求ID,之后查询调用信息时必须 |
| details | object | 识别结果详情,包含分词等信息 |
{
"appKey": "xxxxxxx",
"details": {
"_hypotheses": [
{
"_conf": 9323,
"_decoder": "first-path-16",
"_items": [
{
"_id": 49,
"_orthography": "",
"_type": "terminal"
},
{
"_amScore": 11126,
"_beginTimeMs": 200,
"_conf": 10000,
"_endTimeMs": 600,
"_id": 198606,
"_lmScore": -2292,
"_orthography": "我爱",
"_phone": [
"ca2",
"chai2",
"chao0",
"bi1"
],
"_type": "terminal"
},
{
"_amScore": 10305,
"_beginTimeMs": 600,
"_conf": 9687,
"_endTimeMs": 960,
"_id": 155744,
"_lmScore": -1278,
"_orthography": "北京",
"_phone": [
"ang1",
"chou4",
"bu4",
"cheng3"
],
"_type": "terminal"
},
{
"_amScore": 23325,
"_beginTimeMs": 960,
"_conf": 9968,
"_endTimeMs": 1880,
"_id": 174700,
"_lmScore": -283,
"_orthography": "天安门",
"_phone": [
"bie4",
"bei3",
"chao0",
"biang2",
"chong1",
"an3"
],
"_type": "terminal"
},
{
"_amScore": 11297,
"_beginTimeMs": 1880,
"_conf": 9823,
"_endTimeMs": 2200,
"_id": 174699,
"_lmScore": -939,
"_orthography": "天安",
"_phone": [
"bie4",
"bei3",
"chao0",
"biang2"
],
"_type": "terminal"
},
{
"_amScore": 10289,
"_beginTimeMs": 2200,
"_conf": 9573,
"_endTimeMs": 2600,
"_id": 290764,
"_lmScore": -345,
"_orthography": "门上",
"_phone": [
"chong1",
"an3",
"ba0",
"cheng1"
],
"_type": "terminal"
},
{
"_amScore": 18683,
"_beginTimeMs": 2600,
"_conf": 7487,
"_endTimeMs": 3520,
"_id": 175316,
"_lmScore": -533,
"_orthography": "太阳升",
"_phone": [
"bie4",
"bi1",
"chang2",
"che0",
"ba0",
"bang2"
],
"_type": "terminal"
},
{
"_id": 35,
"_orthography": "",
"_type": "terminal"
}
],
"_score": 85029,
"_sentence": " 我爱 北京 天安门 天安 门上 太阳升 ",
"_silence_duration": 0.0,
"_speech_rate": 253.01
}
]
},
"info": "我爱北京天安门,天安门上太阳升。",
"requestId": "f687a2c9-66b3-4a3d-a012-0de8837de316",
"status": "success"
}{
"data": {
"trace_id": "1571988259683020",
"text":"今天是星期四",
},
"message":"Success",
"code": "20000"
}{ "data": { "trace_id": "1571988259683020", "text":"今天是星期四",
},
"message":"Success",
"code": "20000"
}