更新时间:2025-07-22 GMT+08:00
分享

查询ocr解析结果

功能介绍

查询ocr解析结果

URI

GET /v1/koosearch/doc-search/ocr-results

表1 Query参数

参数

是否必选

参数类型

描述

task_id

String

解析任务id

pages

String

页码集合,查询哪些页的ocr结果,多页以逗号分隔,如1,2,3,4,5

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

接口鉴权使用的Token,Token获取方式参考:3.2节 认证鉴权。

约束限制:

不涉及。

响应参数

状态码:200

表3 响应Body参数

参数

参数类型

描述

[数组元素]

Array of PageOcrResult objects

获取ocr结果响应信息

表4 PageOcrResult

参数

参数类型

描述

page_num

Integer

文档页码

ocr_result

RawOcrResult object

文字识别结果

表5 RawOcrResult

参数

参数类型

描述

result

SmartDocumentRecognizerResult object

文字识别结果

表6 SmartDocumentRecognizerResult

参数

参数类型

描述

table_result

SmartDocumentRecognizerTableResult object

表格识别结果

layout_result

SmartDocumentRecognizerLayoutResult object

版式识别结果

kv_result

SmartDocumentRecognizerKvResult object

键值对识别结果

ocr_result

SmartDocumentRecognizerOcrResult object

文字识别结果

表7 SmartDocumentRecognizerTableResult

参数

参数类型

描述

table_count

Integer

表格的数量

table_list

Array of SmartDocumentRecognizerTableBlock objects

ocr表格数据

表8 SmartDocumentRecognizerTableBlock

参数

参数类型

描述

location

Array<Array<Integer>>

文字块的区域位置信息,列表形式,包含文字区域四个顶点的二维坐标(x,y);坐标原点为图片左上角,x轴沿水平方向,y轴沿竖直方向

words_block_count

Integer

表格中所包含的单元格数量。

words_block_list

Array of SmartDocumentRecognizerTableWordsBlock objects

单元格识别结果列表

表9 SmartDocumentRecognizerTableWordsBlock

参数

参数类型

描述

words

String

单元格内的文字识别结果

rows

Array of integers

文字块占用的行信息,编号从0开始,列表形式,数据类型为Integer

columns

Array of integers

文字块占用的列信息,编号从0开始,列表形式,数据类型为Integer

表10 SmartDocumentRecognizerLayoutResult

参数

参数类型

描述

layout_block_count

Integer

模型识别到的文档版面区域数量

layout_block_list

Array of SmartDocumentRecognizerLayoutBlock objects

文档版面区域识别结果列表

表11 SmartDocumentRecognizerLayoutBlock

参数

参数类型

描述

location

Array<Array<Integer>>

文字块的区域位置信息,列表形式,包含文字区域四个顶点的二维坐标(x,y);坐标原点为图片左上角,x轴沿水平方向,y轴沿竖直方向

type

String

文档区域类别,包含text、table等类别

text

String

文档区域文字内容

words_ids

Array of integers

文字识别结果索引列表,表示ocr_result的words_block_list中哪些文本框位于该文档区域内

表12 SmartDocumentRecognizerKvResult

参数

参数类型

描述

kv_block_count

Integer

模型识别到的键值对数量

kv_block_list

Array of SmartDocumentRecognizerKVBlock objects

键值对识别结果列表

表13 SmartDocumentRecognizerKVBlock

参数

参数类型

描述

key

String

key-value对(键值对)中的key

value

String

key-value对(键值对)中的value

words_block_count

Integer

该键值对中所包含的文本框数量

words_block_list

Array of SmartDocumentRecognizerKVWordsBlock objects

键值对文本框识别结果列表

表14 SmartDocumentRecognizerKVWordsBlock

参数

参数类型

描述

location

Array<Array<Integer>>

文字块的区域位置信息,列表形式,包含文字区域四个顶点的二维坐标(x,y);坐标原点为图片左上角,x轴沿水平方向,y轴沿竖直方向

type

String

类型

words

String

文字块识别结果

表15 SmartDocumentRecognizerOcrResult

参数

参数类型

描述

direction

Float

图片朝向

words_block_count

Integer

识别文字块数目

words_block_list

Array of SmartDocumentRecognizerWordsBlockList objects

识别文字块列表,输出顺序从左到右,先上后下

表16 SmartDocumentRecognizerWordsBlockList

参数

参数类型

描述

location

Array<Array<Integer>>

文字块的区域位置信息,列表形式,包含文字区域四个顶点的二维坐标(x,y);坐标原点为图片左上角,x轴沿水平方向,y轴沿竖直方向

confidence

Float

文字块识别结果的置信度

words

String

文字块识别结果

状态码:400

表17 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

状态码:401

表18 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

状态码:500

表19 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

请求示例

响应示例

状态码

状态码

描述

200

ocr解析结果

400

请求参数异常

401

鉴权认证异常

500

服务内容异常

错误码

请参见错误码

相关文档