搜索本产品文档关键词
文档解析
所有文档
menu

文字识别

文档解析

接口描述

文档解析支持对doc、pdf、图片、xlsx等16种格式文档进行解析,输出文档的版面、表格、阅读顺序、标题层级、旋转角度等信息,可返回Markdown格式内容,将非结构化数据转化为易于处理的结构化数据,识别准确率可达 90% 以上。

文档解析API服务为异步接口,需要先调用提交请求接口获取 task_id,然后调用获取结果接口进行结果轮询,建议提交请求后 5~10 秒轮询。提交请求接口QPS为2,获取结果接口QPS为10。

提交请求接口

请求说明

请求示例

HTTP 方法:POST

请求URL: https://aip.baidubce.com/rest/2.0/brain/online/v2/parser/task

URL参数:

参数
access_token 通过API Key和Secret Key获取的access_token,参考“Access Token获取

Header如下:

参数
Content-Type application/x-www-form-urlencoded

Body中放置请求参数,参数详情如下:

请求参数

参数
是否必选
类型
可选值范围
说明
file_data 和file_url二选一 string - 文件的base64编码数据:
-版式文档:pdf、jpg、jpeg、png、bmp、tif、tiff、ofd、ppt、pptx
-流式文档:doc、docx、txt、xls、xlsx、wps、html
PDF文档大小不超过300M,非PDF文档大小不超过50M,文档页数不超过2000页(流式文档按2000字算一页)
优先级: file_data > file_url,当file_data字段存在时,file_url字段失效
file_url 和file_data二选一 string - 文件数据URL,URL长度不超过1024字节,支持单个URL传入,若文件大小超过50M,须通过该方式上传。其余文件准入标准与file_data一致。
优先级: file_data > file_url,当file_data字段存在时,file_url字段失效
请注意关闭URL防盗链
file_name string - 文件名,请保证文件名后缀正确,例如 "1.pdf "
return_doc_chunks string - JSON 字符串,文档切分的传参结构,Python中,json字符串示例 json.dumps({"switch": True, "chunk_size": -1 }),详细结构详见下方说明,具体调用方式详见下方请求示例
+ switch bool True/False 是否进行文档内容切分,「default=False」
+ chunk_size int (0,∞) 切分块的大小,按照字符数统计。若段落字符数小于或等于chunk_size,则按chunk_size切分;若大于chunk_size,则整段作为一个切分块,不因chunk_size限制而额外切分。
「default=-1」,表示不限制切分块的大小,按照文档的段落进行切分
+ split_type string chunk/mark 切分方式。
chunk:按照字符数「chunk_size」切分;
mark:按照「separators」中的标点符号切分;
「default=chunk」
+ separators list 。/ ;/ !/ ?/ ; / ! / ? 切分标点,仅包含表示一句话结束的标点。
「default=["。", ";", "!", "?", ";", "!", "?"]」
recognize_formula bool True/False 是否对版式类型文档进行公式识别
analysis_chart bool True/False 是否对统计图表进行解析

请求代码示例

提示:使用示例代码前,请记得替换其中的示例Token、文档地址或Base64信息。

Python
1import requests
2import os
3import base64
4
5
6def create_task(url, file_path, file_url):
7    """
8    Args:
9        url: string, 服务请求链接
10        file_path: 本地文件路径
11        file_url: 文件链接
12    Returns: 响应
13    """
14    # 文件请求
15    with open(file_path, "rb") as f:
16        file_data = base64.b64encode(f.read())
17    data = {
18        "file_data": file_data,
19        "file_url": file_url,
20        "file_name": os.path.basename(file_path)
21    }
22    
23    # 文档切分参数,非必传
24    # return_doc_chunks = json.dumps({"switch": True, "chunk_size": -1})
25    # data["return_doc_chunks"] = return_doc_chunks
26    
27    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
28
29    response = requests.post(url, headers=headers, data=data)
30    return response
31
32if __name__ == '__main__':
33    request_host = "https://aip.baidubce.com/rest/2.0/brain/online/v2/parser/task?" \
34                   "access_token={token}"
35    file_path = "./test.pdf"
36    response = create_task(request_host, file_path, "")
37    print(response.json())

返回说明

返回参数

字段
类型
说明
log_id uint64 唯一的log id,用于问题定位
error_code int 错误码
error_msg string 错误描述信息
result dict 返回的结果列表
+ task_id string 该请求生成的task_id,后续使用该task_id获取审查结果

返回示例

成功返回示例:

JSON
1{
2    "error_code": 0,
3    "error_msg": "",
4    "log_id": "10138598131137362685273505665433",
5    "result": {
6        "task_id": "task-3zy9Bg8CHt1M4pPOcX2q5bg28j26801S"
7    }
8}

失败返回示例(详细的错误码说明见API文档-错误码):

JSON
1{
2    "error_code": 282003,
3    "error_msg": "missing parameters",
4    "log_id": "37507631033585544507983253924141",
5    "result": "null"
6}

获取结果接口

请求说明

请求示例

HTTP 方法:POST

请求URL: https://aip.baidubce.com/rest/2.0/brain/online/v2/parser/task/query

URL参数:

参数
access_token 通过API Key和Secret Key获取的access_token,参考“Access Token获取

Header如下:

参数
Content-Type application/x-www-form-urlencoded

Body中放置请求参数,参数详情如下:

请求参数

参数
是否必选
类型
说明
task_id string 发送提交请求时返回的task_id

请求代码示例

提示:使用示例代码前,请记得替换其中的示例Token、task_id。

Python
1import requests
2
3def query_task(url, task_id):
4    """
5    Args:
6        url: string, 请求链接
7        task_id: string, task id
8    Returns: 响应
9    """
10    data = {
11        "task_id": task_id
12    }
13    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
14    print(url)
15    response = requests.post(url, headers=headers, data=data)
16    return response
17
18
19if __name__ == '__main__':
20    # 需要替换为实际的任务id
21    task_id = "task_id"
22    # {access_token} 需要替换为实际调用鉴权接口获取的access_token
23    request_host = "https://aip.baidubce.com/rest/2.0/brain/online/v2/parser/task/query?access_token={access_token}"
24    resp = query_task(request_host, task_id)
25    print(resp.json())

返回说明

返回参数

字段
类型
说明
log_id uint64 唯一的log id,用于问题定位
error_code int 错误码
error_msg string 错误描述信息
result dict 返回的结果列表
+ task_id string 任务ID
+ status string 任务状态,pending:排队中;processing:运行中;success:成功;failed:失败
+ task_error string 解析报错信息,包含任务失败、额度不够
+ markdown_url string 文档解析结果的markdown格式链接,链接有效期30天
+ parse_result_url string 文档解析结果的bos链接,链接有效期30天

可通过parse_result_url下载解析结果的JSON文件,parse_result_url的返回参数如下:

字段
类型
说明
file_name string 文档名称
file_id string 文档ID
+ pages list 文件单页解析内容
++ page_id string 页码ID
++ page_num int 页码数
++ text string 当前页的所有纯文字内容
++ layouts list 页面内容版式分析的结果
+++ layout_id string layout ID,layout元素唯一标志,以"xxxxx-layout-{global_layout_index}"形式,global_layout_index为layout元素整个文档的全局索引
+++ text string layout对应的文本内容。注:当type为table, image时该字段为空, 需要根据type和layout_id分别到tables, images字段里找到对应的内容
+++ position list layout元素在页面中的位置,[x, y, w, h] box框,左上角和宽高
+++ type string layout元素类型, 当前可取值:
• para:段落
• table:表格
• head_tail:页面顶部
• image:文档中的插图
• contents:目录
• seal:印章
• title:标题
• formula:公式
+++ sub_type string layout元素子类型, 当type为title、image时,subtype有值。
title类的 subtype 包含:
• title_{n},代表n级标题, 比如title_2代表二级标题
• image_title:图标题
• table_title:表标题
image类的 subtype 包含:
• chart:统计图表
• figure:普通插图
• QR_code:二维码
• Bar_code:条形码
+++ parent string 标题层级树中父节点的layout ID,若当前layout为一级标题,其parent为 "root"。在table和image的内嵌版面信息中暂时都为空
+++ children list 标题层级树中子节点的layout ID。在table和image的内嵌版面信息中暂时都为空
++ tables list 页面表格解析结果
+++ layout_id string layout ID,与layouts中的元素type为table的元素的layout ID对应
+++ markdown string 表格内容的markdown形式
+++ table_title_id list 表格标题对应的layout_id,默认为null
+++ position list 边框数据 「x, y, w, h」(x, y)为坐标点坐标,w为box宽度,h为box高度(以页面坐标为原点),版式格式时有效
+++ cells list 单元格的内嵌版面信息,layout类型为表格时有值
+++ matrix list 二位数组 表示表格内布局位置信息,每个元素对应cells列表中元素的索引
+++ merge_table string 「begin」- 跨页表格开始、「inner」- 跨页表格中间表格(表格跨页超过两页)、「end」- 跨页表格结束;非跨页表格该字段为空
++ images list 页面中图片解析结果
+++ layout_id string layout ID,与layouts中的元素type为image的元素的layout ID对应
+++ image_title_id list 图片标题对应的layout_id,默认为null
+++ position list 边框数据 「x, y, w, h」(x, y)为坐标点坐标,w为box宽度,h为box高度(以页面坐标为原点),版式格式时有效
+++ content_layouts list 图片的内嵌版面信息
+++ data_url string 图片存储链接
+++ image_description string 对统计图表进行内容解析和描述,输出结果为json字符串,可通过json.loads结构化为json格式
++ meta dict 页面元信息
+++ page_width int 页面宽度
+++ page_height int 页面高度
+++ is_scan bool 是否扫描件
+++ page_angle int 页面倾斜角度
+++ page_type string 页面属性「text」- 正文、「contents」- 目录、「appendix」- 附录、「others」- 其他
+++ sheet_name string excel的sheet名
+ chunks list 文件内容切分结果,return_doc_chunks中switch为True时有值
++ chunk_id string 切片的ID
++ content string 切片的内容
++ type string 切片类型, 为text或者table
++ meta dict chunk元信息
+++ title list chunk所属的多级标题内容
+++ position list chunk的位置,根据分块算法有可能chunk跨多个页
+++ box list chunk的位置坐标
+++ page_num int chunk内容所在页数

表格解析结构说明

以下图为例: 文档解析-表格示例.png

JSON
1{
2# cells列表包含14个元素,matrix中的每个数字表示一个单元格在cells列表中的索引。
3    "cells": [
4        {"layout_id": "layout-xxxx",
5         "position": [90, 376, 21, 10],
6         "text": "序号"
7         ...
8         }, # ... 其他单元格信息
9    ],
10    "matrix": [
11        [0, 1, 2],
12        [3, 4, 5],
13        [6, 7, 8],
14        [9, 10, 11],
15        [12, 12, 13],
16        [12, 12, 14]
17    
18}

返回示例

成功返回示例:

JSON
1{
2    "log_id": "23596597899286921761579365582373",
3    "error_code": 0,
4    "error_msg": "",
5    "result":
6    {
7        "task_id": "task-UnvGsgbYZp9pS3BZRHn11ifzjNvKzTgf",
8        "status": "success",
9        "task_error": null,
10        "duration": 902.0,
11        "parse_result_url": "https:xxxxxxxxxxxxxxxxxxx"
12    }
13}

解析结果示例:

JSON
1{
2    "file_name": "示例文件1(文字+表格)更新-改-1.pdf",
3    "file_id": "file-u9kVDu6dtwMyNrizbejMlF8A852aJLm2",
4    "pages": [
5        {
6            "page_id": "2aJLm2-page-0",
7            "page_num": 0,
8            "text": "买卖合同\n甲、乙双方根据《中华人民共和国合同法》及其它相关法律、法规的规定,本着平等、自愿、互利的原则,经友好协商,订立本合同,以资共同信守:\n1.合同标的物信息\n| 序号 | 商品名称 | 产品简称 | 单价 | 数量 | 总价 | 税率 | 备注 |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n| 1 | 软件-AI  | 中台内网-推理平台+训练平台 | 95,000  | 1  | 905,000  | 13%  | 第一单元 |\n| 2 | 硬件【A】 | 服务器 | 30,250  | 37  | 1,11950  | 13%  | 第一单元 |\n\n本合同一式【2】份,经双方代表签字盖章生效。甲乙双方各执【3】份,具有同等法律效力。\n1 \n",
9            "layouts": [
10                {
11                    "layout_id": "2aJLm2-layout-1",
12                    "text": "买卖合同",
13                    "position": [
14                        263,
15                        109,
16                        103,
17                        28
18                    ],
19                    "type": "title",
20                    "sub_type": "title_1",
21                    "parent": "root",
22                    "children": [
23                        "2aJLm2-layout-2",
24                        "2aJLm2-layout-3"
25                    ]
26                },
27                {
28                    "layout_id": "2aJLm2-layout-2",
29                    "text": "甲、乙双方根据《中华人民共和国合同法》及其它相关法律、法规的规定,本着平等、自愿、互利的原则,经友好协商,订立本合同,以资共同信守:",
30                    "position": [
31                        84,
32                        160,
33                        444,
34                        31
35                    ],
36                    "type": "text",
37                    "sub_type": "",
38                    "parent": "2aJLm2-layout-1",
39                    "children": [
40
41                    ]
42                },
43                {
44                    "layout_id": "2aJLm2-layout-3",
45                    "text": "1.合同标的物信息",
46                    "position": [
47                        79,
48                        206,
49                        110,
50                        14
51                    ],
52                    "type": "title",
53                    "sub_type": "title_2",
54                    "parent": "2aJLm2-layout-1",
55                    "children": [
56                        "2aJLm2-layout-4",
57                        "2aJLm2-layout-5",
58                        "2aJLm2-layout-6"
59                    ]
60                },
61                {
62                    "layout_id": "2aJLm2-layout-4",
63                    "text": "",
64                    "position": [
65                        82,
66                        224,
67                        452,
68                        97
69                    ],
70                    "type": "table",
71                    "sub_type": "",
72                    "parent": "2aJLm2-layout-3",
73                    "children": [
74
75                    ]
76                },
77                {
78                    "layout_id": "2aJLm2-layout-5",
79                    "text": "本合同一式【2】份,经双方代表签字盖章生效。甲乙双方各执【3】份,具有同等法律效力。",
80                    "position": [
81                        79,
82                        348,
83                        456,
84                        31
85                    ],
86                    "type": "text",
87                    "sub_type": "",
88                    "parent": "2aJLm2-layout-3",
89                    "children": [
90
91                    ]
92                },
93                {
94                    "layout_id": "2aJLm2-layout-6",
95                    "text": "1",
96                    "position": [
97                        305,
98                        745,
99                        11,
100                        12
101                    ],
102                    "type": "head_tail",
103                    "sub_type": "",
104                    "parent": "2aJLm2-layout-3",
105                    "children": [
106
107                    ]
108                }
109            ],
110            "tables": [
111                {
112                    "layout_id": "2aJLm2-layout-4",
113                    "markdown": "| 序号 | 商品名称 | 产品简称 | 单价 | 数量 | 总价 | 税率 | 备注 |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n| 1 | 软件-AI  | 中台内网-推理平台+训练平台 | 95,000  | 1  | 905,000  | 13%  | 第一单元 |\n| 2 | 硬件【A】 | 服务器 | 30,250  | 37  | 1,11950  | 13%  | 第一单元 |\n",
114                    "position": [
115                        82,
116                        224,
117                        452,
118                        97
119                    ],
120                    "cells": [
121                        {
122                            "layout_id": "2aJLm2-layout-4-0",
123                            "text": "序号",
124                            "position": [
125                                82,
126                                224,
127                                36,
128                                28
129                            ],
130                            "type": "text",
131                            "sub_type": "",
132                            "parent": "",
133                            "children": null
134                        },
135                        {
136                            "layout_id": "2aJLm2-layout-4-1",
137                            "text": "商品名称",
138                            "position": [
139                                118,
140                                224,
141                                78,
142                                28
143                            ],
144                            "type": "text",
145                            "sub_type": "",
146                            "parent": "",
147                            "children": null
148                        },
149                        {
150                            "layout_id": "2aJLm2-layout-4-2",
151                            "text": "产品简称",
152                            "position": [
153                                196,
154                                224,
155                                92,
156                                28
157                            ],
158                            "type": "text",
159                            "sub_type": "",
160                            "parent": "",
161                            "children": null
162                        },
163                        {
164                            "layout_id": "2aJLm2-layout-4-3",
165                            "text": "单价",
166                            "position": [
167                                288,
168                                224,
169                                57,
170                                28
171                            ],
172                            "type": "text",
173                            "sub_type": "",
174                            "parent": "",
175                            "children": null
176                        },
177                        {
178                            "layout_id": "2aJLm2-layout-4-4",
179                            "text": "数量",
180                            "position": [
181                                345,
182                                224,
183                                43,
184                                28
185                            ],
186                            "type": "text",
187                            "sub_type": "",
188                            "parent": "",
189                            "children": null
190                        },
191                        {
192                            "layout_id": "2aJLm2-layout-4-5",
193                            "text": "总价",
194                            "position": [
195                                387,
196                                224,
197                                61,
198                                28
199                            ],
200                            "type": "text",
201                            "sub_type": "",
202                            "parent": "",
203                            "children": null
204                        },
205                        {
206                            "layout_id": "2aJLm2-layout-4-6",
207                            "text": "税率",
208                            "position": [
209                                448,
210                                224,
211                                46,
212                                28
213                            ],
214                            "type": "text",
215                            "sub_type": "",
216                            "parent": "",
217                            "children": null
218                        },
219                        {
220                            "layout_id": "2aJLm2-layout-4-7",
221                            "text": "备注",
222                            "position": [
223                                494,
224                                224,
225                                41,
226                                28
227                            ],
228                            "type": "text",
229                            "sub_type": "",
230                            "parent": "",
231                            "children": null
232                        },
233                        {
234                            "layout_id": "2aJLm2-layout-4-8",
235                            "text": "1",
236                            "position": [
237                                82,
238                                252,
239                                36,
240                                44
241                            ],
242                            "type": "text",
243                            "sub_type": "",
244                            "parent": "",
245                            "children": null
246                        },
247                        {
248                            "layout_id": "2aJLm2-layout-4-9",
249                            "text": "软件-AI ",
250                            "position": [
251                                118,
252                                252,
253                                78,
254                                44
255                            ],
256                            "type": "text",
257                            "sub_type": "",
258                            "parent": "",
259                            "children": null
260                        },
261                        {
262                            "layout_id": "2aJLm2-layout-4-10",
263                            "text": "中台内网-推理平台+训练平台",
264                            "position": [
265                                196,
266                                252,
267                                92,
268                                44
269                            ],
270                            "type": "text",
271                            "sub_type": "",
272                            "parent": "",
273                            "children": null
274                        },
275                        {
276                            "layout_id": "2aJLm2-layout-4-11",
277                            "text": "95,000",
278                            "position": [
279                                288,
280                                252,
281                                57,
282                                44
283                            ],
284                            "type": "text",
285                            "sub_type": "",
286                            "parent": "",
287                            "children": null
288                        },
289                        {
290                            "layout_id": "2aJLm2-layout-4-12",
291                            "text": "1",
292                            "position": [
293                                345,
294                                252,
295                                43,
296                                44
297                            ],
298                            "type": "text",
299                            "sub_type": "",
300                            "parent": "",
301                            "children": null
302                        },
303                        {
304                            "layout_id": "2aJLm2-layout-4-13",
305                            "text": "905,000",
306                            "position": [
307                                387,
308                                252,
309                                61,
310                                44
311                            ],
312                            "type": "text",
313                            "sub_type": "",
314                            "parent": "",
315                            "children": null
316                        },
317                        {
318                            "layout_id": "2aJLm2-layout-4-14",
319                            "text": "13% ",
320                            "position": [
321                                448,
322                                252,
323                                46,
324                                44
325                            ],
326                            "type": "text",
327                            "sub_type": "",
328                            "parent": "",
329                            "children": null
330                        },
331                        {
332                            "layout_id": "2aJLm2-layout-4-15",
333                            "text": "第一单元",
334                            "position": [
335                                494,
336                                252,
337                                41,
338                                71
339                            ],
340                            "type": "text",
341                            "sub_type": "",
342                            "parent": "",
343                            "children": null
344                        },
345                        {
346                            "layout_id": "2aJLm2-layout-4-16",
347                            "text": "2",
348                            "position": [
349                                82,
350                                295,
351                                36,
352                                28
353                            ],
354                            "type": "text",
355                            "sub_type": "",
356                            "parent": "",
357                            "children": null
358                        },
359                        {
360                            "layout_id": "2aJLm2-layout-4-17",
361                            "text": "硬件【A】",
362                            "position": [
363                                118,
364                                295,
365                                78,
366                                28
367                            ],
368                            "type": "text",
369                            "sub_type": "",
370                            "parent": "",
371                            "children": null
372                        },
373                        {
374                            "layout_id": "2aJLm2-layout-4-18",
375                            "text": "服务器",
376                            "position": [
377                                196,
378                                295,
379                                92,
380                                28
381                            ],
382                            "type": "text",
383                            "sub_type": "",
384                            "parent": "",
385                            "children": null
386                        },
387                        {
388                            "layout_id": "2aJLm2-layout-4-19",
389                            "text": "30,250",
390                            "position": [
391                                288,
392                                295,
393                                57,
394                                28
395                            ],
396                            "type": "text",
397                            "sub_type": "",
398                            "parent": "",
399                            "children": null
400                        },
401                        {
402                            "layout_id": "2aJLm2-layout-4-20",
403                            "text": "37",
404                            "position": [
405                                345,
406                                295,
407                                43,
408                                28
409                            ],
410                            "type": "text",
411                            "sub_type": "",
412                            "parent": "",
413                            "children": null
414                        },
415                        {
416                            "layout_id": "2aJLm2-layout-4-21",
417                            "text": "1,11950",
418                            "position": [
419                                387,
420                                295,
421                                61,
422                                28
423                            ],
424                            "type": "text",
425                            "sub_type": "",
426                            "parent": "",
427                            "children": null
428                        },
429                        {
430                            "layout_id": "2aJLm2-layout-4-22",
431                            "text": "13% ",
432                            "position": [
433                                448,
434                                295,
435                                46,
436                                28
437                            ],
438                            "type": "text",
439                            "sub_type": "",
440                            "parent": "",
441                            "children": null
442                        }
443                    ],
444                    "matrix": [
445                        [
446                            0,
447                            1,
448                            2,
449                            3,
450                            4,
451                            5,
452                            6,
453                            7
454                        ],
455                        [
456                            8,
457                            9,
458                            10,
459                            11,
460                            12,
461                            13,
462                            14,
463                            15
464                        ],
465                        [
466                            16,
467                            17,
468                            18,
469                            19,
470                            20,
471                            21,
472                            22,
473                            15
474                        ]
475                    ],
476                    "merge_table": ""
477                }
478            ],
479            "images": [
480                {
481                    "layout_id": "Kr9RM7-layout-10",
482                    "image_title_id": null,
483                    "position":
484                    [
485                        90,
486                        549,
487                        422,
488                        221
489                    ],
490                    "data_url": " ",
491                    "image_description": " {\n    \"title\": \"None\",\n    \"source\": \"None\",\n    \"x_title\": \"图2 统计图\",\n    \"y_title\": [\n        \"None\",\n        \"None\"\n    ],\n    \"values\": {\n        \"轻客出口(万辆)\": {\n            \"2017\": \"2.0\",\n            \"2018\": \"1.9\",\n            \"2019\": \"2.0\",\n            \"2020\": \"1.2\",\n            \"2021\": \"1.1\",\n            \"2022\": \"1.4\",\n            \"2023Q1\": \"0.4\"\n        },\n        \"中客出口(万辆)\": {\n            \"2017\": \"0.4\",\n            \"2018\": \"0.2\",\n            \"2019\": \"0.4\",\n            \"2020\": \"0.4\",\n            \"2021\": \"0.3\",\n            \"2022\": \"0.6\",\n            \"2023Q1\": \"0.0\"\n        },\n        \"大客出口(万辆)\": {\n            \"2017\": \"3.3\",\n            \"2018\": \"3.6\",\n            \"2019\": \"4.1\",\n            \"2020\": \"2.5\",\n            \"2021\": \"2.3\",\n            \"2022\": \"2.8\",\n            \"2023Q1\": \"0.7\"\n        },\n        \"客车出口占客车总销量的比例(%)\": {\n            \"2017\": \"10.8\",\n            \"2018\": \"11.6\",\n            \"2019\": \"13.6\",\n            \"2020\": \"9.1\",\n            \"2021\": \"7.3\",\n            \"2022\": \"11.8\",\n            \"2023Q1\": \"12.0\"\n        }\n    }\n}"
492                }
493            ],
494            "meta": {
495                "page_width": 612,
496                "page_height": 792,
497                "is_scan": false,
498                "page_angle": 0,
499                "page_type": "text",
500                "sheet_name": ""
501            }
502    ],
503    "chunks": [
504        {
505            "chunk_id": "2aJLm2-chunk-0",
506            "content": "甲、乙双方根据《中华人民共和国合同法》及其它相关法律、法规的规定,本着平等、自愿、互利的原则,经友好协商,订立本合同,以资共同信守:",
507            "type": "text",
508            "meta": {
509                "title": [
510                    "买卖合同"
511                ],
512                "position": [
513                    {
514                        "box": [
515                            84,
516                            160,
517                            444,
518                            31
519                        ],
520                        "page_num": 0
521                    }
522                ]
523            }
524        },
525        {
526            "chunk_id": "2aJLm2-chunk-1",
527            "content": "| 序号 | 商品名称 | 产品简称 | 单价 | 数量 | 总价 | 税率 | 备注 |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n| 1 | 软件-AI  | 中台内网-推理平台+训练平台 | 95,000  | 1  | 905,000  | 13%  | 第一单元 |\n| 2 | 硬件【A】 | 服务器 | 30,250  | 37  | 1,11950  | 13%  | 第一单元 |\n",
528            "type": "table",
529            "meta": {
530                "title": [
531                    "买卖合同",
532                    "1.合同标的物信息"
533                ],
534                "position": [
535                    {
536                        "box": [
537                            82,
538                            224,
539                            452,
540                            97
541                        ],
542                        "page_num": 0
543                    }
544                ]
545            }
546        },
547        {
548            "chunk_id": "2aJLm2-chunk-2",
549            "content": "本合同一式【2】份,经双方代表签字盖章生效。甲乙双方各执【3】份,具有同等法律效力。",
550            "type": "text",
551            "meta": {
552                "title": [
553                    "买卖合同",
554                    "1.合同标的物信息"
555                ],
556                "position": [
557                    {
558                        "box": [
559                            79,
560                            348,
561                            456,
562                            31
563                        ],
564                        "page_num": 0
565                    }
566                ]
567            }
568        }
569    ]
570}

失败返回示例(详细的错误码说明见API文档-错误码):

JSON
1  {"log_id": "13665091038742503867108513247608", 
2  "error_code": "282007", 
3  "error_msg": "task not exist, please check task id", 
4  "result": "null"}
上一篇
智能结构化
下一篇
卡证文字识别