
# 识别结果响应
服务端在收到客户端发送的连续音频数据后， 当服务端识别出结果后会实时向客户端按句推送识别结果响应消息， 以json字符串形式放置在text message中。
#### 响应消息
表1响应参数 
| 参数名       | 参数类型             | 说明                                                                                                            |
|:---|:---|:---|
| resp_type | String           | 响应类型。参数值为RESULT，表示识别结果响应。                                                                                     |
| trace_id  | String           | 服务内部的令牌，可用于在日志中追溯具体流程。                                                                                        |
| segments  | Array of Objects | 多句结果。 请参考[表 segment 数据结构]。 |
   
 表2segment 数据结构 
| 参数名        | 参数类型    | 说明                                                                                                         |
|:---|:---|:---|
| start_time | Integer | 相对时间戳，表示一句的起始，单位为ms。                                                                                       |
| end_time   | Integer | 相对时间戳，表示一句的结束，单位为ms。                                                                                       |
| is_final   | Boolean | 输出是否为最终结果。 true表示是最终结果， false表示为中间临时结果。                                        |
| result     | Object  | 调用成功表示识别结果，调用失败时无此字段。 请参考[表 result数据结构]。 |
   
 表3result数据结构 
| 参数名       | 参数类型            | 说明                                                                                                                                |
|:---|:---|:---|
| text      | String          | 识别结果。                                                                                                                             |
| score     | Float           | 识别结果的置信度，取值范围：0\~1。此值会在实时识别中不断刷新，直到返回最终结果。 说明： 临时结果的置信度作用不是太大，请勿过多依赖此值。 |
| word_info | Array of Object | 分词输出列表。                                                                                                                           |
   
表4word_info 数据结构 
| 参数名        | 是否必选 | 参数类型    | 说明   |
|:---|:---|:---|:---|
| start_time | 否    | Integer | 起始时间 |
| end_time   | 否    | Integer | 结束时间 |
| word       | 否    | String  | 分词   |
   
#### 示例
```
{
  "resp_type": "RESULT",
  "trace_id": "149edb8a-664b-4f0d-9935-847a57b1e3a5",
  "segments": [
    {
      "start_time": 0,
      "end_time": 5480,
      "is_final": true,
      "result": {
        "text": "欢迎大家使用华为云语音交互服务。",
        "score": 0.8452650904655457,
        "word_info": [
          {
            "start_time": 1700,
            "end_time": 1800,
            "word": "欢"
          },
          {
            "start_time": 1940,
            "end_time": 2040,
            "word": "迎"
          },
          {
            "start_time": 2180,
            "end_time": 2280,
            "word": "大"
          },
          {
            "start_time": 2300,
            "end_time": 2400,
            "word": "家"
          },
          {
            "start_time": 2480,
            "end_time": 2580,
            "word": "使"
          },
          {
            "start_time": 2660,
            "end_time": 2760,
            "word": "用"
          },
          {
            "start_time": 2900,
            "end_time": 3000,
            "word": "华"
          },
          {
            "start_time": 3080,
            "end_time": 3180,
            "word": "为"
          },
          {
            "start_time": 3260,
            "end_time": 3360,
            "word": "云"
          },
          {
            "start_time": 3560,
            "end_time": 3660,
            "word": "语"
          },
          {
            "start_time": 3660,
            "end_time": 3720,
            "word": "音"
          },
          {
            "start_time": 3860,
            "end_time": 3960,
            "word": "交"
          },
          {
            "start_time": 4040,
            "end_time": 4140,
            "word": "互"
          },
          {
            "start_time": 4280,
            "end_time": 4380,
            "word": "服"
          },
          {
            "start_time": 4460,
            "end_time": 4560,
            "word": "务"
          }
        ]
      }
    }
  ]
}
```
#### 状态码
状态码请参见[状态码](https://support.huaweicloud.com/api-sis/sis_03_0044.html)。
#### 错误码
错误码请参见[错误码](https://support.huaweicloud.com/api-sis/sis_03_0045.html)。
