测试用例1:test_emf 无图映射
解析结果
boxes1:
{'x0': 70.0, 'x1': 308.6666666666667, 'top': 76.0, 'text': 'Test with three images in unusual formats', 'bottom': 90.0, 'page_number': 1, 'layout_type': ''}
{'x0': 70.66666666666667, 'x1': 152.33333333333334, 'top': 109.66666666666667, 'text': 'Raster in emf:', 'bottom': 123.66666666666667, 'page_number': 1, 'layout_type': 'text', 'layoutno': 'text-0'}
{'x0': 70.66666666666667, 'x1': 152.33333333333334, 'top': 296.3333333333333, 'text': 'Vector in emf:', 'bottom': 310.3333333333333, 'page_number': 1, 'layout_type': 'figure caption', 'layoutno': 'figure caption-0'}
{'x0': 70.66666666666667, 'x1': 159.66666666666666, 'top': 481.0, 'text': 'Raster in webp:', 'bottom': 495.0, 'page_number': 1, 'layout_type': 'figure caption', 'layoutno': 'figure caption-1'}
{'score': 0.8413426876068115, 'x0': 66.65048726399739, 'x1': 219.40877278645834, 'top': 1717.9829915364583, 'bottom': 1870.0290120442708, 'page_number': 0, 'text': '', 'layout_type': 'figure', 'layoutno': 'figure-0'}
{'score': 0.4555538594722748, 'x0': 65.49385070800781, 'x1': 207.45137532552084, 'top': 1908.0685221354167, 'bottom': 2049.4119466145835, 'page_number': 0, 'text': '', 'layout_type': 'figure', 'layoutno': 'figure-1'}
{'score': 0.7353739142417908, 'x0': 62.302530924479164, 'x1': 498.6632486979167, 'top': 2095.770548502604, 'bottom': 2248.6739501953125, 'page_number': 0, 'text': '', 'layout_type': 'figure', 'layoutno': 'figure-2'}
{'x0': 87.33333333333333, 'x1': 519.0, 'top': 869.6666666666666, 'text': '是从(一个字典)中通过获取的。cks r_dictr_dict.get("cks")', 'bottom': 887.0, 'page_number': 2, 'layout_type': 'text', 'layoutno': 'text-0'}
{'x0': 71.66666666666667, 'x1': 538.0, 'top': 901.6666666666666, 'text': '假设是从Redis 中读取的数据,那么可能是一个列表或字r_dict cks ', 'bottom': 918.3333333333334, 'page_number': 2, 'layout_type': 'text', 'layoutno': 'text-0'}
{'x0': 71.66666666666667, 'x1': 288.6666666666667, 'top': 933.0, 'text': '典,存储了需要处理的文档内容。', 'bottom': 949.6666666666666, 'page_number': 2, 'layout_type': 'text', 'layoutno': 'text-0'}
{'x0': 74.0, 'x1': 94.0, 'top': 968.6666666666666, 'text': '绿巨能', 'bottom': 977.6666666666666, 'page_number': 2, 'layout_type': ''}
{'x0': 84.66666666666667, 'x1': 94.0, 'top': 993.3333333333334, 'text': 'T410', 'bottom': 999.0, 'page_number': 2, 'layout_type': ''}
{'x0': 74.0, 'x1': 103.0, 'top': 1000.6666666666666, 'text': '5100mA', 'bottom': 1013.0, 'page_number': 2, 'layout_type': ''}
{'x0': 73.66666666666667, 'x1': 104.0, 'top': 1011.0, 'text': '双芯控温不伤机', 'bottom': 1020.0, 'page_number': 2, 'layout_type': ''}
{'x0': 79.0, 'x1': 98.0, 'top': 1021.3333333333334, 'text': '足量不虚板', 'bottom': 1028.0, 'page_number': 2, 'layout_type': ''}
{'x0': 312.6666666666667, 'x1': 339.3333333333333, 'top': 1069.3333333333333, 'text': '绿巨能', 'bottom': 1080.6666666666667, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 0, 'R_top': 1068.7568957010906, 'R_bott': 1092.6059672037761}
{'x0': 317.6666666666667, 'x1': 346.6666666666667, 'top': 1094.6666666666667, 'text': '联想笔记本电池', 'bottom': 1100.6666666666667, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 1, 'R_top': 1085.8118260701497, 'R_bott': 1129.8890889485676}
{'x0': 324.3333333333333, 'x1': 340.0, 'top': 1100.6666666666667, 'text': 'T410', 'bottom': 1107.0, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 1, 'R_top': 1085.8118260701497, 'R_bott': 1129.8890889485676}
{'x0': 314.3333333333333, 'x1': 349.3333333333333, 'top': 1109.6666666666667, 'text': '5100mAk', 'bottom': 1121.3333333333333, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 1, 'R_top': 1085.8118260701497, 'R_bott': 1129.8890889485676}
{'x0': 312.3333333333333, 'x1': 352.3333333333333, 'top': 1120.6666666666667, 'text': '双芯控温不伤机', 'bottom': 1132.0, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 2, 'R_top': 1120.3406473795574, 'R_bott': 1185.4308369954426}
{'x0': 320.0, 'x1': 346.6666666666667, 'top': 1133.6666666666667, 'text': '足量不虚标', 'bottom': 1139.3333333333333, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 2, 'R_top': 1120.3406473795574, 'R_bott': 1185.4308369954426}
{'x0': 317.6666666666667, 'x1': 348.3333333333333, 'top': 1140.0, 'text': '安全不易鼓包', 'bottom': 1146.0, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 2, 'R_top': 1120.3406473795574, 'R_bott': 1185.4308369954426}
{'x0': 316.6666666666667, 'x1': 347.6666666666667, 'top': 1146.0, 'text': '续航更强劲', 'bottom': 1154.3333333333333, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 2, 'R_top': 1120.3406473795574, 'R_bott': 1185.4308369954426}
{'x0': 319.3333333333333, 'x1': 343.3333333333333, 'top': 1155.0, 'text': '两年质保', 'bottom': 1163.3333333333333, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 2, 'R_top': 1120.3406473795574, 'R_bott': 1185.4308369954426}
{'x0': 72.33333333333333, 'x1': 79.0, 'top': 1196.3333333333333, 'text': '3 ', 'bottom': 1204.6666666666667, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 3, 'R_top': 1191.4506530761719, 'R_bott': 1262.236551920573, 'H_top': 1168.9876302083333, 'H_bott': 1330.83544921875, 'H_left': 70.26321411132812, 'H_right': 167.18827311197916, 'SP': 0}
{'x0': 198.66666666666666, 'x1': 247.66666666666666, 'top': 1192.0, 'text': '浅香ASAKA丨系伍威护专门', 'bottom': 1200.3333333333333, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 3, 'R_top': 1191.4506530761719, 'R_bott': 1262.236551920573}
{'x0': 269.6666666666667, 'x1': 293.6666666666667, 'top': 1200.0, 'text': '润茶发质好措档', 'bottom': 1266.6666666666667, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 3, 'R_top': 1191.4506530761719, 'R_bott': 1262.236551920573}
{'x0': 432.3333333333333, 'x1': 436.6666666666667, 'top': 1197.0, 'text': '5', 'bottom': 1203.0, 'page_number': 2, 'layout_type': 'table', 'layoutno': 'table-0', 'R': 3, 'R_top': 1191.4506530761719, 'R_bott': 1262.236551920573}
tables1(_extract_table_figure):
((<PIL.Image.Image image mode=RGB size=1484x1440 at 0x131536810>, '<table><caption>Vector in emf:Raster in webp:</caption>\n<tr><td></td><td></td><td >绿巨能</td><td></td></tr>\n<tr><td></td><td></td><td >联想笔记本电池 T410 5100mAk</td><td></td></tr>\n<tr><td></td><td></td><td >双芯控温不伤机 足量不虚标 安全不易鼓包 续航更强劲 两年质保</td><td></td></tr>\n<tr><td >3 </td><td >浅香ASAKA丨系伍威护专门</td><td >润茶发质好措档</td><td >5</td></tr>\n</table>'), [(0, 70.66666666666667, 159.66666666666666, 296.3333333333333, 495.0), (1, 58.418619791666664, 553.1382242838541, 273.0113118489583, 554.2704264322916)])
boxes2([(b["text"], self._line_tag(b, zoomin)) for b in self.boxes):
('Test with three images in unusual formats', '@@1\t70.0\t308.7\t76.0\t90.0##')
('Raster in emf:', '@@1\t70.7\t152.3\t109.7\t123.7##')
('是从(一个字典)中通过获取的。cks r_dictr_dict.get("cks")假设是从Redis 中读取的数据,那么可能是一个列表或字r_dict cks典,存储了需要处理的文档内容。', '@@2\t71.7\t538.0\t77.7\t157.7##')
('绿巨能', '@@2\t74.0\t94.0\t176.7\t185.7##')
('T410', '@@2\t84.7\t94.0\t201.3\t207.0##')
('5100mA', '@@2\t74.0\t103.0\t208.7\t221.0##')
('双芯控温不伤机', '@@2\t73.7\t104.0\t219.0\t228.0##')
('足量不虚板', '@@2\t79.0\t98.0\t229.3\t236.0##')
res(tokenize_table):
{'docnm_kwd': 'test_emf_docx(28).pdf', 'title_tks': 'test_emf_docx ( 28 )', 'title_sm_tks': 'test_emf_docx ( 28 )', 'content_with_weight': '<table><caption>Vector in emf:Raster in webp:</caption>\n<tr><td></td><td></td><td >绿巨能</td><td></td></tr>\n<tr><td></td><td></td><td >联想笔记本电池 T410 5100mAk</td><td></td></tr>\n<tr><td></td><td></td><td >双芯控温不伤机 足量不虚标 安全不易鼓包 续航更强劲 两年质保</td><td></td></tr>\n<tr><td >3 </td><td >浅香ASAKA丨系伍威护专门</td><td >润茶发质好措档</td><td >5</td></tr>\n</table>', 'content_ltks': 'vector in emf : raster in webp : \n 绿 巨能 \n 联想 笔记本 电池 t 410 5100 mak \n 双 芯 控温 不 伤 机 足量 不虚 标 安全 不易 鼓包 续航 更 强劲 两年 质保 \n 3 浅 香 asaka 丨 系 伍 威 护 专门 润 茶 发 质 好 措 档 5 \n ', 'content_sm_ltks': 'vector in emf : raster in webp : \n 绿 巨能 \n 联想 笔记 本 电池 t 410 5100 mak \n 双 芯 控温 不 伤 机 足量 不虚 标 安全 不易 鼓包 续航 更 强劲 两年 质保 \n 3 浅 香 asaka 丨 系 伍 威 护 专门 润 茶 发 质 好 措 档 5 \n ', 'image': <PIL.Image.Image image mode=RGB size=1484x1440 at 0x131536A50>, 'page_num_int': [1, 2], 'position_int': [(1, 70, 159, 296, 495), (2, 58, 553, 273, 554)], 'top_int': [296, 273]}
chunk1(naive_merge):
Test with three images in unusual formatsRaster in emf:是从(一个字典)中通过获取的。cks r_dictr_dict.get("cks")假设是从Redis 中读取的数据,那么可能是一个列表或字r_dict cks典,存储了需要处理的文档内容。@@2 71.7 538.0 77.7 157.7##绿巨能T4105100mA双芯控温不伤机@@2 73.7 104.0 219.0 228.0##足量不虚板
chunk2(tokenize_chunks(chunks, doc, eng, pdf_parser)):
{'docnm_kwd': 'test_emf_docx(28).pdf', 'title_tks': 'test_emf_docx ( 28 )', 'title_sm_tks': 'test_emf_docx ( 28 )', 'image': <PIL.Image.Image image mode=RGB size=1399x848 at 0x127388C10>, 'page_num_int': [2, 2], 'position_int': [(2, 71, 538, 77, 157), (2, 73, 540, 219, 228)], 'top_int': [77, 219], 'content_with_weight': 'Test with three images in unusual formatsRaster in emf:是从(一个字典)中通过获取的。cks r_dictr_dict.get("cks")假设是从Redis 中读取的数据,那么可能是一个列表或字r_dict cks典,存储了需要处理的文档内容。绿巨能T4105100mA双芯控温不伤机足量不虚板', 'content_ltks': 'test with three imagin unusu formatsrast in emf : 是从 ( 一个 字典 ) 中 通过 获取 的 。 ckr _ dictr _ dict.get ( " ck " ) 假设 是从 redi 中 读取 的 数据 , 那么 可能 是 一个 列表 或 字 r _ dict ck 典 , 存储 了 需要 处理 的 文档 内容 。 绿 巨能 t 4105100 ma 双 芯 控温 不 伤 机 足量 不虚 板', 'content_sm_ltks': 'test with three imagin unusu formatsrast in emf : 是从 ( 一个 字典 ) 中 通过 获取 的 。 ckr _ dictr _ dict.get ( " ck " ) 假设 是从 redi 中 读取 的 数据 , 那么 可能 是 一个 列表 或 字 r _ dict ck 典 , 存储 了 需要 处理 的 文档 内容 。 绿 巨能 t 4105100 ma 双 芯 控温 不 伤 机 足量 不虚 板'}
res2(res.extend(tokenize_chunks(chunks, doc, eng, pdf_parser)))
{'docnm_kwd': 'test_emf_docx(28).pdf', 'title_tks': 'test_emf_docx ( 28 )', 'title_sm_tks': 'test_emf_docx ( 28 )', 'content_with_weight': '<table><caption>Vector in emf:Raster in webp:</caption>\n<tr><td></td><td></td><td >绿巨能</td><td></td></tr>\n<tr><td></td><td></td><td >联想笔记本电池 T410 5100mAk</td><td></td></tr>\n<tr><td></td><td></td><td >双芯控温不伤机 足量不虚标 安全不易鼓包 续航更强劲 两年质保</td><td></td></tr>\n<tr><td >3 </td><td >浅香ASAKA丨系伍威护专门</td><td >润茶发质好措档</td><td >5</td></tr>\n</table>', 'content_ltks': 'vector in emf : raster in webp : \n 绿 巨能 \n 联想 笔记本 电池 t 410 5100 mak \n 双 芯 控温 不 伤 机 足量 不虚 标 安全 不易 鼓包 续航 更 强劲 两年 质保 \n 3 浅 香 asaka 丨 系 伍 威 护 专门 润 茶 发 质 好 措 档 5 \n ', 'content_sm_ltks': 'vector in emf : raster in webp : \n 绿 巨能 \n 联想 笔记 本 电池 t 410 5100 mak \n 双 芯 控温 不 伤 机 足量 不虚 标 安全 不易 鼓包 续航 更 强劲 两年 质保 \n 3 浅 香 asaka 丨 系 伍 威 护 专门 润 茶 发 质 好 措 档 5 \n ', 'image': <PIL.Image.Image image mode=RGB size=1484x1440 at 0x117070210>, 'page_num_int': [1, 2], 'position_int': [(1, 70, 159, 296, 495), (2, 58, 553, 273, 554)], 'top_int': [296, 273]}
{'docnm_kwd': 'test_emf_docx(28).pdf', 'title_tks': 'test_emf_docx ( 28 )', 'title_sm_tks': 'test_emf_docx ( 28 )', 'image': <PIL.Image.Image image mode=RGB size=1399x848 at 0x127388D90>, 'page_num_int': [2, 2], 'position_int': [(2, 71, 538, 77, 157), (2, 73, 540, 219, 228)], 'top_int': [77, 219], 'content_with_weight': 'Test with three images in unusual formatsRaster in emf:是从(一个字典)中通过获取的。cks r_dictr_dict.get("cks")假设是从Redis 中读取的数据,那么可能是一个列表或字r_dict cks典,存储了需要处理的文档内容。绿巨能T4105100mA双芯控温不伤机足量不虚板', 'content_ltks': 'test with three imagin unusu formatsrast in emf : 是从 ( 一个 字典 ) 中 通过 获取 的 。 ckr _ dictr _ dict.get ( " ck " ) 假设 是从 redi 中 读取 的 数据 , 那么 可能 是 一个 列表 或 字 r _ dict ck 典 , 存储 了 需要 处理 的 文档 内容 。 绿 巨能 t 4105100 ma 双 芯 控温 不 伤 机 足量 不虚 板', 'content_sm_ltks': 'test with three imagin unusu formatsrast in emf : 是从 ( 一个 字典 ) 中 通过 获取 的 。 ckr _ dictr _ dict.get ( " ck " ) 假设 是从 redi 中 读取 的 数据 , 那么 可能 是 一个 列表 或 字 r _ dict ck 典 , 存储 了 需要 处理 的 文档 内容 。 绿 巨能 t 4105100 ma 双 芯 控温 不 伤 机 足量 不虚 板'}