语音文件异步结果查询接口

  • 国内: http://api.speech.tuputech.com/v3/recognition/speech/recording/result/<secretId>

secretId 需替换为您的 secretId,请联系我们为您开通 secretId。

http 请求方法: POST

http Content-type: application/json

并发限制: 每个 secretId 每秒最多同时处理 5 个请求

调用建议: 查询间隔最佳为 3 分钟, 每个识别结果仅保留 3 天

请求示例:

{
  "requestId": "your_requestId",
  "timestamp": 1541499770,
  "nonce": 0.8469537531104208,
  "signature": "your_signature"
}

请求参数说明

参数名 类型 是否必填 说明
requestId String 提交的⾳频的唯⼀请求id
timestamp Number 当前的服务器的 Unix 时间戳
nonce Number 随机数
signature String 我们采用的数字证书签名算法是:"RSA-SHA256",签名输出类型是:"base64",具体步骤如下:
1、所有参与签名的参数为:secretId,timestamp,nonce,用英文半角逗号“,”相连,得到sign_string;
2、利用您的私钥,使用算法"RSA-SHA256"签名,输出为 "base64" 格式,得到参数signature的值。
点击管理公钥证书查看如何生成私钥,及如何上传您的公钥用于数字签名的认证;

curl 请求示例

curl -X POST --header 'Content-Type: application/json' \
-d '{
    "requestId": "your_requestId"
    "timestamp": 1541499770,
    "nonce": 0.8469537531104208,
    "signature": "your_signature"
}' \
'http://api.speech.tuputech.com/v3/recognition/speech/recording/result/your_secretId'

返回参数说明

识别任务结束

json 字段数据示例:

{
  "code": 0,
  "message": "success",
  "nonce": "0.01627771095362096",
  "timestamp": 1552391372490,
  "requestId": "tupu_request_id",
  "roomId": "your_room_id",
  "userId": "your_user_id",
  "forumId": "your_forum_id",
  "customInfo": {
    "hello": true,
    "other": "your customInfo"
  },
  "5c8213b9bc807806aab0a574": {
    "violations": [
      {
        "label": 1,
        "review": false,
        "details": [
          {
            "startTime": 5,
            "endTime": 10,
            "label": 1,
            "rate": 0.7449841499328613
          }
        ]
      }
    ]
  },
  "5ca1bd6b3872ecc9afb99132": {
    "text": "床前明月光,疑是地上霜。举头望明月,低头思故乡"
  },
  "5caee6b2a76925c55a09a6d2": {
    "label": "Politics",
    "review": false,
    "rate": 0.896484,
    "action": "block",
    "text": "毛泽东,你好",
    "violations": [
      {
        "startTime": 12,
        "endTime": 15,
        "content": "毛泽东",
        "action": "block",
        "label": "Politics",
        "review": false,
        "rate": 0.896484,
        "details": [
          {
            "keyword": "毛泽东",
            "hint": "毛泽东",
            "mainLabel": "Politics",
            "subLabel": "National_Leader"
          }
        ]
      }
    ]
  },
  "5e6b0164836eb77597849087": {
    "details": [
      {
         "personName":"胡锦涛",
         "similarity":1,
         "typeName":"国家或地区领导人",
         "startTime":0,
         "endTime":8,
         "review":false
      },
      {
         "personName":"胡锦涛",
         "similarity":1,
         "typeName":"国家或地区领导人",
         "startTime":4,
         "endTime":12,
         "review":false
      }
    ]
  }
}

响应结果数据结构

参数名 类型 是否必有 说明
requestId String 客户提交的音频的唯一请求 id
speechInfo Object 语音文件信息
roomId String 房间 ID
userId String 用户 ID
forumId String 板块 ID ,数据 ID
[taskId] Object 审核任务的 id,结构详见以下描述
speechInfo
参数名 类型 是否必有 说明
duration Number 语音文件时长,单位:秒
taskId

与语音文件异步接口回调返回的任务结果结构保持一致

json 字段数据示例:

{
  "code": 0,
  "message": "success",
  "nonce": 0.01627771095362096,
  "timestamp": 1552391372490,
  "requestId": "your_requestId",
  "status": "pending"
}

响应结果数据结构

参数名 类型 是否必有 说明
status String 语音任务处理状态(pending/running)
requestId String 客户提交的音频的唯一请求 id

返回字段特别说明

参数名为: status的字段,仅在查询成功且识别任务还未结束时存在,表示当前请求的音频处理状态
调用者判定步骤:

  1. 先判断code字段是否为公共服务状态码中表示调用成功的值。
  2. 再判断status字段,说明如下:
    • 值为pending: 识别任务等待处理。
    • 值为running: 识别任务正在处理。
    • 无: 识别任务已结束,可以按照语音异步接口的返回结果进行解析。

results matching ""

    No results matching ""