[go: up one dir, main page]

CN116311300A - Table generating method, device, electronic device and storage medium - Google Patents

Table generating method, device, electronic device and storage medium Download PDF

Info

Publication number
CN116311300A
CN116311300A CN202310172183.4A CN202310172183A CN116311300A CN 116311300 A CN116311300 A CN 116311300A CN 202310172183 A CN202310172183 A CN 202310172183A CN 116311300 A CN116311300 A CN 116311300A
Authority
CN
China
Prior art keywords
information
cell
text
target
obtaining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310172183.4A
Other languages
Chinese (zh)
Inventor
韩光耀
许海洋
岳洪达
王艺
苏磊
陈禹燊
段博坤
章良杰
李治平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202310172183.4A priority Critical patent/CN116311300A/en
Publication of CN116311300A publication Critical patent/CN116311300A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/412Layout analysis of documents structured with printed lines or input boxes, e.g. business forms or tables
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/106Display of layout of documents; Previewing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/414Extracting the geometrical structure, e.g. layout tree; Block segmentation, e.g. bounding boxes for graphics or text

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Document Processing Apparatus (AREA)

Abstract

本公开公开了一种表格生成方法、装置、电子设备以及存储介质,涉及计算机技术领域,尤其涉及光学字符识别技术领域。具体实现方案为:获取文本内容信息和目标页面的布局信息,目标页面的布局信息包括页面参数信息、单元格布局信息和文字布局信息。根据页面参数信息、单元格布局信息和文字布局信息,得到单元格坐标信息。根据文字布局信息和单元格坐标信息,得到文字坐标信息。根据单元格坐标信息、文字坐标信息和文本内容信息,生成目标表格和与目标表格对应的标注数据。

Figure 202310172183

The disclosure discloses a table generation method, device, electronic equipment and storage medium, and relates to the technical field of computers, in particular to the technical field of optical character recognition. The specific implementation scheme is: acquiring text content information and layout information of the target page, where the layout information of the target page includes page parameter information, cell layout information and text layout information. According to the page parameter information, the cell layout information and the text layout information, the cell coordinate information is obtained. According to the text layout information and the cell coordinate information, the text coordinate information is obtained. According to the cell coordinate information, the text coordinate information and the text content information, a target table and label data corresponding to the target table are generated.

Figure 202310172183

Description

表格生成方法、装置、电子设备以及存储介质Table generating method, device, electronic device and storage medium

技术领域technical field

本公开涉及计算机技术领域,尤其涉及光学字符识别技术领域,具体涉及一种表格生成方法、装置、电子设备以及存储介质。The present disclosure relates to the technical field of computers, in particular to the technical field of optical character recognition, and in particular to a table generation method, device, electronic equipment and storage medium.

背景技术Background technique

光学字符识别技术是指对文本资料进行扫描后对图像文件进行分析处理,获取文字及版面信息的过程。Optical character recognition technology refers to the process of analyzing and processing image files after scanning text materials to obtain text and layout information.

随着光学字符识别技术的发展,可以利用训练好的表格结构化模型,对表格图像中的文本数据进行识别和提取。在训练表格结构化模型的过程中,需要大量的样本表格图像和样本表格图像的标注数据。With the development of optical character recognition technology, the trained form structured model can be used to identify and extract text data in form images. In the process of training the table structured model, a large amount of sample table images and labeled data of the sample table images are required.

发明内容Contents of the invention

本公开提供了一种用于表格生成方法、装置、电子设备以及存储介质。The present disclosure provides a table generation method, device, electronic equipment and storage medium.

根据本公开的一方面,提供了一种表格生成方法,包括:According to an aspect of the present disclosure, a method for generating a table is provided, including:

获取文本内容信息和目标页面的布局信息,目标页面的布局信息包括页面参数信息、单元格布局信息和文字布局信息。根据页面参数信息、单元格布局信息和文字布局信息,得到单元格坐标信息。根据文字布局信息和单元格坐标信息,得到文字坐标信息。根据单元格坐标信息、文字坐标信息和文本内容信息,生成目标表格和与目标表格对应的标注数据。The text content information and the layout information of the target page are acquired, and the layout information of the target page includes page parameter information, cell layout information and text layout information. According to the page parameter information, the cell layout information and the text layout information, the cell coordinate information is obtained. According to the text layout information and the cell coordinate information, the text coordinate information is obtained. A target table and label data corresponding to the target table are generated according to the cell coordinate information, the text coordinate information and the text content information.

根据本公开的另一方面,提供了一种表格生成装置,包括:第一获取模块、第一获得模块、第二获得模块和生成模块。其中,第一获取模块,用于获取文本内容信息和目标页面的布局信息,目标页面的布局信息包括页面参数信息、单元格布局信息和文字布局信息。第一获得模块,用于根据页面参数信息、单元格布局信息和文字布局信息,得到单元格坐标信息。第二获得模块,用于根据文字布局信息和单元格坐标信息,得到文字坐标信息。生成模块,用于根据单元格坐标信息、文字坐标信息和文本内容信息,生成目标表格和与目标表格对应的标注数据。According to another aspect of the present disclosure, a form generation device is provided, including: a first obtaining module, a first obtaining module, a second obtaining module and a generating module. Wherein, the first obtaining module is used to obtain text content information and layout information of the target page, and the layout information of the target page includes page parameter information, cell layout information and text layout information. The first obtaining module is used to obtain cell coordinate information according to page parameter information, cell layout information and text layout information. The second obtaining module is used to obtain text coordinate information according to text layout information and cell coordinate information. The generating module is used to generate a target table and label data corresponding to the target table according to cell coordinate information, text coordinate information and text content information.

根据本公开的另一方面,提供了一种电子设备,包括:至少一个处理器;以及与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如上所述的方法。According to another aspect of the present disclosure, there is provided an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; Instructions executed by the at least one processor to enable the at least one processor to perform the method as described above.

根据本公开的另一方面,提供了一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行如上所述的方法。According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the above method.

根据本公开的另一方面,提供了一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现如上所述的方法。According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method as described above.

应当理解,本部分所描述的内容并非旨在标识本公开的实施例的关键或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的说明书而变得容易理解。It should be understood that what is described in this section is not intended to identify key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will be readily understood through the following description.

附图说明Description of drawings

附图用于更好地理解本方案,不构成对本公开的限定。其中:The accompanying drawings are used to better understand the present solution, and do not constitute a limitation to the present disclosure. in:

图1示意性示出了根据本公开实施例的可以应用表格生成方法及装置的示例性系统架构;FIG. 1 schematically shows an exemplary system architecture to which a table generating method and device can be applied according to an embodiment of the present disclosure;

图2示意性示出了根据本公开实施例的表格生成方法的流程图;Fig. 2 schematically shows a flowchart of a table generation method according to an embodiment of the present disclosure;

图3示意性示出了根据本公开实施例的生成单元格坐标信息的示意图;Fig. 3 schematically shows a schematic diagram of generating cell coordinate information according to an embodiment of the present disclosure;

图4示意性示出了根据本公开实施例的表格中的单元格示意图;Fig. 4 schematically shows a schematic diagram of cells in a table according to an embodiment of the present disclosure;

图5示意性示出了根据本公开实施例的根据文字排布方式确定的文字在单元格中的展示效果示意图;Fig. 5 schematically shows a schematic diagram of the display effect of text in a cell determined according to the text arrangement according to an embodiment of the present disclosure;

图6示意性示出了根据本公开一些实施例的表格示意图;Fig. 6 schematically shows a schematic diagram of a table according to some embodiments of the present disclosure;

图7示意性示出了根据本公开一些实施例的带有边框线的表格示意图;Fig. 7 schematically shows a schematic diagram of a table with border lines according to some embodiments of the present disclosure;

图8示意性示出了根据本公开一些实施例的带有印章的表格示意图;Fig. 8 schematically shows a schematic diagram of a form with stamps according to some embodiments of the present disclosure;

图9示意性示出了根据本公开一些实施例的经过滤波处理的表格示意图;Fig. 9 schematically shows a schematic diagram of a filtered table according to some embodiments of the present disclosure;

图10示意性示出了根据本公开实施例的表格生成装置的框图;以及Fig. 10 schematically shows a block diagram of a table generating device according to an embodiment of the present disclosure; and

图11示意性示出了根据本公开实施例的适于实现表格生成方法的电子设备的框图。Fig. 11 schematically shows a block diagram of an electronic device suitable for implementing a table generation method according to an embodiment of the present disclosure.

具体实施方式Detailed ways

以下结合附图对本公开的示范性实施例做出说明,其中包括本公开实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本公开的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and they should be regarded as exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

在利用光学识别技术对表格图像进行识别和信息提取的过程中,不仅需要识别表格图像中的文字,还需要识别表格结构,并对识别结果进行行列信息的结构化处理。In the process of using optical recognition technology to identify and extract information from form images, it is not only necessary to recognize the text in the form image, but also to identify the structure of the form, and perform structured processing of the row and column information on the recognition results.

因此,在训练用于识别表格图像的文字及表格结构的模型之前,需要采集大量的样本表格图像,并对样本表格图像中的文字及表格结构进行标注得到标注数据,利用样本表格图像和标注数据对模型进行训练。Therefore, before training the model used to recognize the text and table structure of the table image, it is necessary to collect a large number of sample table images, and label the text and table structure in the sample table image to obtain the labeled data. Using the sample table image and the labeled data Train the model.

但是,在相关技术中,采用人工标注的方式得到标注数据,不仅标注效率较低且标注结果的准确率也较低,尤其对于金融领域中的表格图像,例如:资产负债表、现金流量表、利润表等,这些表格图像中表格结构较为复杂,采用人工标注的方式对表格图像中的数据进行标注时,存在较大的困难。直接影响了模型训练的效果。However, in related technologies, manual labeling is used to obtain labeled data, which not only has low labeling efficiency but also low accuracy of labeling results, especially for table images in the financial field, such as: balance sheet, cash flow statement, Income statement, etc., the table structure in these table images is relatively complex, and there are great difficulties in labeling the data in the table image by manual labeling. It directly affects the effect of model training.

有鉴于此,本公开实施例提供了一种表格生成方法,包括:In view of this, an embodiment of the present disclosure provides a table generation method, including:

获取文本内容信息和目标页面的布局信息,目标页面的布局信息包括页面参数信息、单元格布局信息和文字布局信息。根据页面参数信息、单元格布局信息和文字布局信息,得到单元格坐标信息。根据文字布局信息和单元格坐标信息,得到文字坐标信息。根据单元格坐标信息、文字坐标信息和文本内容信息,生成目标表格和与目标表格对应的标注数据。可以生成应用于金融技术领域中的结构复杂的表格,并且在生成表格的同时自动生成与表格对应的标注数据,无需再进行人工标注。The text content information and the layout information of the target page are acquired, and the layout information of the target page includes page parameter information, cell layout information and text layout information. According to the page parameter information, the cell layout information and the text layout information, the cell coordinate information is obtained. According to the text layout information and the cell coordinate information, the text coordinate information is obtained. A target table and label data corresponding to the target table are generated according to the cell coordinate information, the text coordinate information and the text content information. It can generate tables with complex structures applied in the field of financial technology, and automatically generate label data corresponding to the tables while generating the tables, eliminating the need for manual labeling.

图1示意性示出了根据本公开实施例的可以应用表格生成方法及装置的示例性系统架构。Fig. 1 schematically shows an exemplary system architecture to which the method and device for generating a table can be applied according to an embodiment of the present disclosure.

需要注意的是,图1所示仅为可以应用本公开实施例的系统架构的示例,以帮助本领域技术人员理解本公开的技术内容,但并不意味着本公开实施例不可以用于其他设备、系统、环境或场景。例如,在另一实施例中,可以应用表格生成方法及装置的示例性系统架构可以包括终端设备,但终端设备可以无需与服务器进行交互,即可实现本公开实施例提供的表格生成方法及装置。It should be noted that, what is shown in FIG. 1 is only an example of the system architecture to which the embodiments of the present disclosure can be applied, so as to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other device, system, environment or scenario. For example, in another embodiment, the exemplary system architecture to which the form generation method and apparatus can be applied may include terminal equipment, but the terminal equipment can implement the form generation method and apparatus provided by the embodiments of the present disclosure without interacting with the server .

如图1所示,根据该实施例的系统架构100可以包括终端设备101、102、103,网络104和服务器105。网络104用以在终端设备101、102、103和服务器105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线和/或无线通信链路等等。As shown in FIG. 1 , a system architecture 100 according to this embodiment may include terminal devices 101 , 102 , 103 , a network 104 and a server 105 . The network 104 is used as a medium for providing communication links between the terminal devices 101 , 102 , 103 and the server 105 . Network 104 may include various connection types, such as wired and/or wireless communication links, among others.

用户可以使用终端设备101、102、103通过网络104与服务器105交互,以接收或发送消息等。终端设备101、102、103上可以安装有各种通讯客户端应用,例如知识阅读类应用、网页浏览器应用、搜索类应用、即时通信工具、邮箱客户端和/或社交平台软件等(仅为示例)。Users can use terminal devices 101 , 102 , 103 to interact with server 105 via network 104 to receive or send messages and the like. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients and/or social platform software, etc. (only example).

终端设备101、102、103可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。The terminal devices 101, 102, 103 may be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers and the like.

服务器105可以是提供各种服务的服务器,例如对用户利用终端设备101、102、103所浏览的内容提供支持的后台管理服务器(仅为示例)。后台管理服务器可以对接收到的用户请求等数据进行分析等处理,并将处理结果(例如根据用户请求获取或生成的网页、信息、或数据等)反馈给终端设备。The server 105 may be a server that provides various services, such as a background management server that supports content browsed by users using the terminal devices 101 , 102 , 103 (just an example). The background management server can analyze and process received data such as user requests, and feed back processing results (such as webpages, information, or data obtained or generated according to user requests) to the terminal device.

需要说明的是,本公开实施例所提供的表格生成方法一般可以由终端设备101、102、或103执行。相应地,本公开实施例所提供的表格生成装置也可以设置于终端设备101、102、或103中。It should be noted that, generally, the method for generating a table provided by the embodiment of the present disclosure may be executed by the terminal device 101 , 102 , or 103 . Correspondingly, the table generation apparatus provided by the embodiment of the present disclosure may also be set in the terminal device 101 , 102 , or 103 .

或者,本公开实施例所提供的表格生成方法一般也可以由服务器105执行。相应地,本公开实施例所提供的表格生成装置一般可以设置于服务器105中。本公开实施例所提供的表格生成方法也可以由不同于服务器105且能够与终端设备101、102、103和/或服务器105通信的服务器或服务器集群执行。相应地,本公开实施例所提供的表格生成装置也可以设置于不同于服务器105且能够与终端设备101、102、103和/或服务器105通信的服务器或服务器集群中。Alternatively, the table generation method provided by the embodiment of the present disclosure may generally be executed by the server 105 . Correspondingly, the table generating apparatus provided by the embodiment of the present disclosure can generally be set in the server 105 . The form generation method provided by the embodiments of the present disclosure may also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101 , 102 , 103 and/or the server 105 . Correspondingly, the form generation apparatus provided by the embodiments of the present disclosure may also be set in a server or a server cluster that is different from the server 105 and can communicate with the terminal devices 101 , 102 , 103 and/or the server 105 .

例如,在用户在线发送表格生成请求时,终端设备101、102、103可以获取用户从数据库中选择的文本内容信息和目标页面的布局信息,然后将获取的文本内容信息和目标页面的布局信息发送给服务器105,由服务器105根据页面参数信息、单元格布局信息和文字布局信息,到单元格坐标信息。根据文字布局信息和单元格坐标信息,得到文字坐标信息。以及根据单元格坐标信息、文字坐标信息和文本内容信息,生成目标表格和与目标表格对应的标注数据。或者由能够与终端设备101、102、103和/或服务器105通信的服务器或服务器集群对目标内容进行分析,并最终实现摘抄用户感兴趣的内容。For example, when a user sends a form generation request online, the terminal devices 101, 102, and 103 can obtain the text content information and the layout information of the target page selected by the user from the database, and then send the acquired text content information and the layout information of the target page To the server 105, the server 105 obtains the cell coordinate information according to the page parameter information, cell layout information and text layout information. According to the text layout information and the cell coordinate information, the text coordinate information is obtained. And according to the cell coordinate information, text coordinate information and text content information, generate a target table and label data corresponding to the target table. Alternatively, a server or server cluster capable of communicating with the terminal devices 101, 102, 103 and/or the server 105 analyzes the target content, and finally extracts the content that the user is interested in.

应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the numbers of terminal devices, networks and servers in Fig. 1 are only illustrative. According to the implementation needs, there can be any number of terminal devices, networks and servers.

图2示意性示出了根据本公开实施例的表格生成方法的流程图。Fig. 2 schematically shows a flowchart of a table generation method according to an embodiment of the present disclosure.

如图2所示,该方法包括操作S210~S240。As shown in FIG. 2, the method includes operations S210-S240.

在操作S210,获取文本内容信息和目标页面的布局信息,目标页面的布局信息包括页面参数信息、单元格布局信息和文字布局信息。In operation S210, the text content information and the layout information of the target page are acquired, and the layout information of the target page includes page parameter information, cell layout information and text layout information.

在操作S220,根据页面参数信息、单元格布局信息和文字布局信息,得到单元格坐标信息。In operation S220, cell coordinate information is obtained according to the page parameter information, cell layout information, and text layout information.

在操作S230,根据文字布局信息和单元格坐标信息,得到文字坐标信息。In operation S230, the text coordinate information is obtained according to the text layout information and the cell coordinate information.

在操作S240,根据单元格坐标信息、文字坐标信息和文本内容信息,生成目标表格和与目标表格对应的标注数据。In operation S240, a target table and label data corresponding to the target table are generated according to the cell coordinate information, text coordinate information, and text content information.

根据本公开的实施例,文本内容信息可以是用于展示在表格的单元格中的表格内容信息。例如:在XX交易清单表格中,表格内容信息可以包括:账号信息、户名信息、查询起始日期信息、查询截止日期信息、查询时间信息、查询柜员信息、币种信息、交易日期信息、记账日期、交易地点信息、交易类型信息、借贷状态信息、交易金额信息等。According to an embodiment of the present disclosure, the text content information may be table content information for displaying in a cell of a table. For example: in the XX transaction list form, the table content information can include: account information, account name information, query start date information, query deadline information, query time information, query teller information, currency information, transaction date information, record Account date, transaction location information, transaction type information, loan status information, transaction amount information, etc.

根据本公开的实施例,上述文本内容信息可以根据真实表格的内容信息进行配置,并将配置的文本内容信息作为表格内容候选集存储在表头字典中。以便通过遍历表头字典,获取所需的文本内容信息。According to an embodiment of the present disclosure, the above text content information may be configured according to the content information of the real form, and the configured text content information may be stored in the table header dictionary as a table content candidate set. In order to obtain the required text content information by traversing the header dictionary.

根据本公开的实施例,页面参数信息可以包括页面宽度信息、页面长度信息、页面行数信息、页面列数信息。According to an embodiment of the present disclosure, the page parameter information may include page width information, page length information, page row number information, and page column number information.

根据本公开的实施例,单元格布局信息可以包括列宽比例信息及单元格之间的相对位置信息。列宽比例信息一般可以对表格中列数最多的一行进行设备,以其中最小单元格为基准,其他的单元格的宽度均以最小单元格的宽度按上述列宽度比例信息进行缩放。例如:在同一行中可以包括3个单元格,上述3个单元格之间的列宽度比例依次为:第1个单元格与该行最小单元格的列宽度比例为“2”、第2个单元格与该行最小单元格的列宽度比例为“1.7”、第3个单元为该行最小单元格。According to an embodiment of the present disclosure, the cell layout information may include column width ratio information and relative position information between cells. The column width ratio information can generally be configured for the row with the largest number of columns in the table, based on the smallest cell, and the width of other cells is scaled based on the width of the smallest cell according to the above-mentioned column width ratio information. For example: 3 cells can be included in the same row, and the column width ratio between the above 3 cells is as follows: the column width ratio of the first cell to the smallest cell in the row is "2", the second The column width ratio of the cell to the smallest cell in the row is "1.7", and the third cell is the smallest cell in the row.

例如:页面宽度为100,页面长度为300,页面行数为10行,页面列数最多的一行中包括4列单元格。该列的列宽比例从左到右依次可以为:第1个单元格的列宽比例为“1”、第2个单元格的列宽比例为“1.5”、第3个单元格的列宽比例为“1”、第4个单元格的列宽比例为“1.5”,则可以得到该列的单元格的宽度依次为:20、30、20、30。For example: the page width is 100, the page length is 300, the number of page rows is 10, and the row with the largest number of page columns includes 4 columns of cells. The column width ratio of the column from left to right can be: the column width ratio of the first cell is "1", the column width ratio of the second cell is "1.5", and the column width of the third cell If the ratio is "1" and the column width ratio of the fourth cell is "1.5", then the width of the cells in this column can be obtained in order: 20, 30, 20, 30.

根据本公开的实施例,同理,也可以根据页面长度和页面行高比例信息,得到某一列中最小单元格的高度信息。其他单元格的高度按行高比例进行缩放,得到某一列中全部单元格的高度信息,在此不做赘述。According to the embodiments of the present disclosure, similarly, the height information of the smallest cell in a certain column may also be obtained according to the page length and page row height ratio information. The height of other cells is scaled according to the row height ratio to obtain the height information of all cells in a column, which will not be described here.

根据本公开的实施例,单元格之间的相对位置信息可以表示某一行中的单元格与其他行中的单元格之间的相对位置信息。例如:第一行中可以包括4个单元格,分别为单元格CellA1、单元格CellA2、单元格CellA3、单元格CellA4。第二行中可以包括7个单元格,分别为单元格CellB1、单元格CellB2、单元格CellB3、单元格CellB4、单元格CellB5、单元格CellB6、单元格CellB7。单元格之间的相对位置关系可以表示为:单元格CellA1(1,1)、单元格CellA2(2,3)、单元格CellA3(4,5)、单元格CellA4(6,7)。According to an embodiment of the present disclosure, the relative position information between cells may represent relative position information between cells in a certain row and cells in other rows. For example: the first row may include 4 cells, which are cell CellA 1 , cell CellA 2 , cell CellA 3 , and cell CellA 4 . The second row may include 7 cells, which are cell CellB 1 , cell CellB 2 , cell CellB 3 , cell CellB 4 , cell CellB 5 , cell CellB 6 , and cell CellB 7 . The relative position relationship between cells can be expressed as: cell CellA 1 (1, 1), cell CellA 2 (2, 3), cell CellA 3 (4, 5), cell CellA 4 (6, 7 ).

根据本公开的实施例,根据单元格之间的相对位置关系,可以得知单元格CellA1与单元格CellB1是上下对齐的位置关系,即单元格CellA1与单元格CellB1的宽度相同。单元格CellA2跨越了单元格CellB2、单元格CellB3,即单元格CellA2的宽度等于单元格CellB2和单元格CellB3的宽度之和。依次类推,在此不做赘述。According to the embodiment of the present disclosure, according to the relative positional relationship between the cells, it can be known that the cell CellA 1 and the cell CellB 1 are in a vertically aligned positional relationship, that is, the cell CellA 1 and the cell CellB 1 have the same width. Cell CellA 2 spans cell CellB 2 and cell CellB 3 , that is, the width of cell CellA 2 is equal to the sum of the widths of cell CellB 2 and cell CellB 3 . And so on, so I won't repeat them here.

例如:第二行中的单元格的宽度依次可以为:单元格CellB1的宽度为“10”、单元格CellB2的宽度为“15”、单元格CellB3的宽度为“10”、单元格CellB4的宽度为“5”、单元格CellB5的宽度为“20”、单元格CellB6的宽度为“20”、单元格CellB7的宽度为“20”。可以根据上述单元格之间的相对位置关系,得到单元格CellA1的宽度为“10”、单元格CellA2的宽度为“25”、单元格CellA3的宽度为“25”、单元格CellA4的宽度为“40”。For example: the width of the cells in the second row can be: the width of the cell CellB 1 is "10", the width of the cell CellB 2 is "15", the width of the cell CellB 3 is "10", the width of the cell CellB 4 has a width of "5", cell CellB 5 has a width of "20", cell CellB 6 has a width of "20", and cell CellB 7 has a width of "20". According to the relative positional relationship between the above cells, the width of the cell CellA 1 is "10", the width of the cell CellA 2 is "25", the width of the cell CellA 3 is "25", and the width of the cell CellA 4 is has a width of "40".

根据本公开的实施例,文字布局信息可以包括文字在单元格中的排布方式、文字的字号信息。文字在单元格中的排布方式可以包括文字在单元格的顶部对齐排布、居中对齐排布、底部对齐排布等。文字的字号信息可以包括文字的高度信息、文字的宽度信息等。According to an embodiment of the present disclosure, the text layout information may include an arrangement manner of text in a cell, and font size information of the text. The way of arranging the text in the cell may include aligning the text at the top of the cell, aligning the center, and aligning the bottom of the cell. The font size information of the text may include information about the height of the text, information about the width of the text, and the like.

根据本公开的实施例,以文字在单元格中的排布方式为顶部对齐排布为例,且文字在单元格中单行排列,则可以确定文字的高度的等于单元格的高度。According to an embodiment of the present disclosure, taking the top-aligned arrangement of the text in the cell as an example, and the text is arranged in a single row in the cell, it can be determined that the height of the text is equal to the height of the cell.

例如:第一行中的第1个单元格CellA1的宽度为“10”,文字高度可以为“5”,可以确定单元格CellA1的坐标信息:“(0,0)、(10,0)、(0,5)、(10,5)”。For example: the width of the first cell CellA 1 in the first row is "10", the height of the text can be "5", and the coordinate information of the cell CellA 1 can be determined: "(0,0), (10,0 ), (0,5), (10,5)".

根据本公开的实施例,以文字在单元格中的排布方式为顶部对齐排布为例,且文字在单元格中单行排列。例如:文字的宽度可以为“1”,在第一行中的第1个单元格CellA1中的文本内容信息可以为“账号”两个字,则“账”字的坐标可以为“(0,0)、(1,0)、(0,5)、(1,5)”。“号”字的坐标可以为“(1,0)、(2,0)、(1,5)、(2,5)”。According to an embodiment of the present disclosure, it is assumed that texts are arranged in a top-aligned manner in a cell as an example, and the texts are arranged in a single row in a cell. For example: the width of the text can be "1", the text content information in the first cell CellA 1 in the first row can be "account number", then the coordinates of the word "account" can be "(0 ,0), (1,0), (0,5), (1,5)". The coordinates of the word "number" can be "(1,0), (2,0), (1,5), (2,5)".

根据本公开的实施例,可以按照文字坐标信息将文本内容填充至对应的单元格中,即可得到目标表格。According to the embodiment of the present disclosure, the text content can be filled into the corresponding cell according to the text coordinate information, and the target table can be obtained.

根据本公开的实施例,与目标表格对应的标注数据表征文本内容信息与所在单元格坐标信息组合的结构化标注数据。例如:单元格CellA1的标注数据可以包括:单元格CellA1的坐标信息和单元格CellA1中的文本内容信息。According to an embodiment of the present disclosure, the annotation data corresponding to the target table represents structured annotation data combined with text content information and cell coordinate information. For example, the label data of the cell CellA 1 may include: the coordinate information of the cell CellA 1 and the text content information of the cell CellA 1 .

根据本公开实施例,在生成目标表格的过程中,文本内容信息中可以包括表头信息和与表头对应的随机数信息。例如:表头信息可以为“账号”,与表头对应的随机数信息可以为“000XXX1111”。According to an embodiment of the present disclosure, during the process of generating the target table, the text content information may include header information and random number information corresponding to the header. For example: the header information can be "account number", and the random number information corresponding to the header can be "000XXX1111".

根据本公开的实施例,通过获取文本内容信息和目标页面的布局信息,可以灵活生成不同单元格布局和文字布局的目标表格,实现了快速生成用于模型训练的目标表格及与目标表格对应的标注数据。由于标注数据是直接在生成目标表格的过程中得到的单元格的坐标信息、文字坐标信息和文本内容信息,提高了标注数据的准确率和效率。According to the embodiments of the present disclosure, target tables with different cell layouts and text layouts can be flexibly generated by acquiring text content information and target page layout information, realizing rapid generation of target tables for model training and corresponding target tables. Annotate the data. Since the labeling data is the cell coordinate information, text coordinate information and text content information obtained directly in the process of generating the target table, the accuracy and efficiency of the labeling data are improved.

下面参考图3~图9,结合具体实施例对图2所示的方法做进一步说明。The method shown in FIG. 2 will be further described below in conjunction with specific embodiments with reference to FIGS. 3 to 9 .

图3示意性示出了根据本公开实施例的生成单元格坐标信息的示意图。Fig. 3 schematically shows a schematic diagram of generating cell coordinate information according to an embodiment of the present disclosure.

如图3所示,在300中,根据页面参数信息3201和单元格的尺寸比例信息3202得到最小单元格尺寸信息3203。然后根据最小单元格尺寸信息3203和相对位置关系信息3204得到单元格尺寸信息3205。在根据单元格尺寸信息3205和页面参数信息3201得到单元格在目标页面上的排布位置信息3206。根据单元格在目标页面上的排布位置信息3206可以确定位于同一行的多个目标单元格3207。根据换行标识信息3208可以得到文字在单元格内的排布行数信息3209。根据文字在单元格内的排布行数信息3209可以得到多个目标单元格的高度信息3210。根据位于同一行的多个目标单元格3207和多个目标单元格的高度信息3210可以得到单元格坐标信息3211。As shown in FIG. 3 , in step 300 , minimum cell size information 3203 is obtained according to page parameter information 3201 and cell size ratio information 3202 . Then the cell size information 3205 is obtained according to the minimum cell size information 3203 and the relative position relationship information 3204 . According to the cell size information 3205 and the page parameter information 3201, the arrangement position information 3206 of the cells on the target page is obtained. Multiple target cells 3207 in the same row can be determined according to the arrangement position information 3206 of the cells on the target page. According to the newline identification information 3208, the information 3209 on the number of lines arranged in the cell can be obtained. The height information 3210 of a plurality of target cells can be obtained according to the information 3209 on the number of rows of characters arranged in the cell. Cell coordinate information 3211 can be obtained according to the multiple target cells 3207 located in the same row and the height information 3210 of the multiple target cells.

根据本公开的实施例,单元格的尺寸比例信息可以包括列宽比例信息和行高比例信息。下面以列宽比例信息为例,详细说明单元格宽度信息的确定过程。According to an embodiment of the present disclosure, the size ratio information of a cell may include column width ratio information and row height ratio information. The following takes the column width ratio information as an example to describe the process of determining the cell width information in detail.

根据本公开的实施例,由于单元格的列宽比例信息一般是选择目标表格中列数最多的一行进行设定的。例如:页面宽度为100,列数最多的一行可以包括3列单元格,列宽比例信息依次为:第1列单元格的列宽比例可以为“6”、第2列单元格的列宽比例可以为“1”,第3列单元格的列宽比例可以为“3”,可以得到最小单元格宽度为10。According to the embodiments of the present disclosure, generally, the row with the largest number of columns in the target table is selected for setting the column width ratio information of the cell. For example: the page width is 100, the row with the most columns can include 3 columns of cells, and the column width ratio information is as follows: the column width ratio of the cells in the first column can be "6", and the column width ratio of the cells in the second column It can be "1", the column width ratio of the third column cell can be "3", and the minimum cell width can be 10.

根据本公开的实施例,单元格之间的相对位置关系可以表征单元格所在的列与其他单元格所在的列之间的列宽跨度信息。例如:单元格CellA1可以是位于第一行第一列的单元格,单元格CellB1和单元格CellB2可以是分别位于第二行第一列和第二列的单元格。单元格CellA1所在列的列宽跨越了单元格CellB1和单元格CellB2所在列的列宽,则单元格之间的相对位置关系可以表示为:单元格CellA1(单元格CellB1,单元格CellB2)。即单元格CellA1的宽度等于单元格CellB1和单元格CellB2的宽度之和。According to an embodiment of the present disclosure, the relative positional relationship between the cells may represent the column width span information between the column where the cell is located and the columns where other cells are located. For example: the cell CellA 1 can be the cell located in the first row and the first column, and the cells CellB 1 and CellB 2 can be the cells located in the second row, the first column and the second column respectively. The column width of the column where cell CellA 1 is located spans the column width of the column where cell CellB 1 and cell CellB 2 are located, then the relative positional relationship between the cells can be expressed as: cell CellA 1 (cell CellB 1 , cell CellB 2 ). That is, the width of cell CellA 1 is equal to the sum of the widths of cell CellB 1 and cell CellB 2 .

根据最小单元格宽度和单元格之间的相对位置关系,可以按照公式(1)得到单元格宽度信息:According to the minimum cell width and the relative positional relationship between cells, the cell width information can be obtained according to formula (1):

单元格宽度=最小单元格宽度×SUM[列宽比例(列宽跨度信息)] (1)Cell width = minimum cell width × SUM [column width ratio (column width span information)] (1)

例如:最小单元格宽度为10,单元格CellB1的列宽比例为2,单元格CellB2的列宽比例为1.5,列宽跨度信息为:单元格CellA1(单元格CellB1,单元格CellB2),可以得到单元格CellA1的宽度为35。For example: the minimum cell width is 10, the column width ratio of cell CellB 1 is 2, the column width ratio of cell CellB 2 is 1.5, and the column width span information is: cell CellA 1 (cell CellB 1 , cell CellB 2 ), the width of cell CellA 1 can be obtained as 35.

根据本公开的实施例,文字布局信息包括文字在单元格内的换行标识信息,根据单元格宽度信息、页面参数信息和文字布局信息,得到单元格坐标信息,可以包括如下操作:According to an embodiment of the present disclosure, the text layout information includes the line break identification information of the text in the cell, and the cell coordinate information is obtained according to the cell width information, page parameter information, and text layout information, which may include the following operations:

识别换行标识信息,得到文字在单元格内的排布行数信息。根据单元格宽度信息和页面参数信息,得到单元格在目标页面上的排布位置信息。根据排布位置信息和排布行数信息,得到单元格坐标信息。Identify the newline identification information, and get the information on the number of rows of text in the cell. According to the cell width information and the page parameter information, the arrangement position information of the cells on the target page is obtained. Cell coordinate information is obtained according to the arrangement position information and the arrangement row number information.

根据本公开的实施例,在真实的表格中,每一个单元格中的文字可能存在跨行排布的情况,因此,可以通过设置文字在单元格内的换行标识信息,得到文字在单元格内的排布行数信息。According to the embodiment of the present disclosure, in a real table, the text in each cell may be arranged across rows. Therefore, by setting the line break identification information of the text in the cell, the text in the cell can be obtained. Arrange the number of rows information.

例如:在单元格CellA1中,文本内容信息可以为“账号/卡号:\nAccount/Card.No:”,其中,“\n”可以表示换行标识信息。For example: in the cell CellA 1 , the text content information may be "account/card number:\nAccount/Card.No:", where "\n" may indicate newline identification information.

根据本公开的实施例,通过识别换行标识信息,可以得到上述文字内容信息在单元格CellA1中的排布行数信息为2行。According to an embodiment of the present disclosure, by identifying the newline identification information, it can be obtained that the number of rows of the text content information in the cell CellA 1 is 2 rows.

根据本公开的实施例,由于最小单元格宽度是以列数最多一行进行设置的,其他单元格的宽度也是根据单元格与最小单元格所在行上的单元格之间的列宽跨度信息得到的。因此,可以根据单元格宽度信息和页面参数信息,得到单元格在目标页面上的排布位置信息。According to the embodiment of the present disclosure, since the minimum cell width is set with the number of columns at most one row, the width of other cells is also obtained according to the column width span information between the cell and the cell on the row where the minimum cell is located . Therefore, the arrangement position information of the cells on the target page can be obtained according to the cell width information and the page parameter information.

例如:列数最多的一行可以为第6行,其他单元格的列宽跨度信息均可以以第6行的单元格之间的相对位置关系确定。例如:第5行的第1个单元格的列宽跨度信息可以为(1,2),则表示第5行的第1个单元格的列宽等于第6行的第1个单元格和第2个单元格的宽度之和。第4行的第1个单元格的列宽跨度信息可以为(1,2,3),则表示第4行的第1个单元格的列宽等于第6行的第第1个单元格~第3个单元格的宽度之和。For example, the row with the largest number of columns may be the sixth row, and the column width and span information of other cells may be determined based on the relative positional relationship between the cells in the sixth row. For example: the column width span information of the first cell in the fifth row can be (1, 2), which means that the column width of the first cell in the fifth row is equal to the first cell and the first cell in the sixth row The sum of the widths of the 2 cells. The column width span information of the first cell in row 4 can be (1, 2, 3), which means that the column width of the first cell in row 4 is equal to the first cell in row 6~ The sum of the width of the 3rd cell.

根据本公开的实施例,由于当前每一个单元格的高度仅考虑了页面参数信息和行高比例,在真实表格图像中,每一行中的单元格中的高度应该是相同的。因此,在确定单元格在目标页面上的相对排布位置的基础上,可以结合同一行的多个单元格的高度,最终确定该行单元格的高度信息。According to the embodiments of the present disclosure, since the current height of each cell only considers the page parameter information and the row height ratio, in a real table image, the heights of the cells in each row should be the same. Therefore, on the basis of determining the relative arrangement position of the cells on the target page, the height information of the cells in the row can be finally determined by combining the heights of multiple cells in the same row.

根据本公开的实施例,根据排布位置信息和排布行数信息,得到单元格坐标信息,可以包括如下操作:According to an embodiment of the present disclosure, obtaining the cell coordinate information according to the arrangement position information and the arrangement row number information may include the following operations:

根据排布位置信息,得到位于同一行的多个目标单元格。根据排布行数信息,得到多个目标单元格的高度信息。根据排布位置信息和高度信息,得到单元格坐标信息。According to the arrangement position information, multiple target cells in the same row are obtained. According to the arrangement row number information, the height information of multiple target cells is obtained. According to the arrangement position information and the height information, the cell coordinate information is obtained.

例如:根据排布位置信息,可以确定位于同一行的多个目标单元格,例如:目标单元格可以包括3个单元格,分别是单元格CellM1、单元格CellM2、单元格CellM3。可以根据每一个单元格中文字的排布行数,得到每一个单元格的高度信息,例如:单元格CellM1中的文字排布行数为2行,单元格CellM2中的文字排布行数为3行,单元格CellM3中的文字排布行数为2行。For example: according to the arrangement position information, multiple target cells located in the same row can be determined, for example: the target cell can include 3 cells, which are cell CellM 1 , cell CellM 2 , and cell CellM 3 . The height information of each cell can be obtained according to the number of rows of text in each cell, for example: the number of rows of text in cell CellM 1 is 2 rows, and the number of rows of text in cell CellM 2 The number is 3 rows, and the number of rows of text in cell CellM 3 is 2 rows.

根据本公开的实施例,根据排布行数信息,得到多个目标单元格的高度信息,可以包括如下操作:According to an embodiment of the present disclosure, obtaining the height information of a plurality of target cells according to the number of arranged rows may include the following operations:

将多个目标单元格的排布行数信息进行排序,得到排序结果。根据排序结果,得到高度信息。Sorting the row number information of multiple target cells to obtain a sorting result. According to the sorting results, the height information is obtained.

例如:上述3个单元格按照排布行数信息进行排序,得到的排序结果可以为:单元格CellM2、单元格CellM1、单元格CellM3。可以将每一行中单元格中文字排布行数最多的单元格的高度确定为该行全部单元格的最终高度。例如:单元格CellM2的高度可以为5,则单元格CellM1、单元格CellM3也为5。For example, the above 3 cells are sorted according to the row number information, and the sorting result can be: cell CellM 2 , cell CellM 1 , and cell CellM 3 . In each row, the height of the cell with the largest number of character arrangement rows can be determined as the final height of all the cells in the row. For example: the height of the cell CellM 2 can be 5, then the cell CellM 1 and the cell CellM 3 are also 5.

图4示意性示出了根据本公开实施例的表格中的单元格示意图。Fig. 4 schematically shows a schematic diagram of cells in a table according to an embodiment of the present disclosure.

如图4所示,在400中,单元格A~单元格P均可以表示跨列表头所在的单元格。其中,列数最多的一行可以为单元格Q所在的行,该行表示表头。单元格A的列宽跨越了单元格Q~单元格V6个单元格的宽度。单元格B、单元格F、单元格J、单元格N的列宽与单元格Q的列宽相同。单元格C、单元格G、单元格K、单元格O的列宽等于单元格R和单元格S的列宽之和。单元格D、单元格H、单元格L的列宽等于单元格T、单元格U的列宽之和。单元格P的列宽等于单元格T、单元格U、单元格V的列宽之和。单元格E、单元格I、单元格M的列宽等于单元格V的列宽。自上至下,从单元格a1所在行开始至单元格an所在行,均为表格体所在单元格,表格体所在单元格的结构与表头所在单元格的结构相同。As shown in FIG. 4 , in 400 , cells A to P can all represent the cells where the head of the cross-column is located. Among them, the row with the largest number of columns may be the row where the cell Q is located, and this row represents the table header. The column width of cell A spans the width of 6 cells from cell Q to cell V. Cell B, Cell F, Cell J, Cell N have the same column width as Cell Q. The column width of cells C, G, K, and O is equal to the sum of the column widths of cells R and S. The column width of cell D, cell H, and cell L is equal to the sum of the column widths of cell T and cell U. The column width of cell P is equal to the sum of the column widths of cell T, cell U, and cell V. The column width of cell E, cell I, and cell M is equal to the column width of cell V. From top to bottom, from the row where cell a1 is located to the row where cell an is located, they are all cells where the body of the table is located, and the structure of the cell where the table body is located is the same as that of the cell where the header is located.

根据本公开的实施例,文字布局信息包括文字在单元格内的排布方式信息、文字尺寸信息和文字在单元格内的换行标识信息。上述操作S230可以包括如下操作:According to an embodiment of the present disclosure, the text layout information includes text layout information in the cell, text size information, and text line break identification information in the cell. The above operation S230 may include the following operations:

根据排布方式信息,确定目标策略。根据换行标识信息,得到文字在单元格内的排布行数信息。基于目标策略,根据单元格坐标信息、文字尺寸信息、排布方式信息和排布行数信息,得到文字坐标信息。Determine the target strategy based on the arrangement information. According to the newline identification information, the information on the number of rows of the text in the cell is obtained. Based on the target strategy, the text coordinate information is obtained according to the cell coordinate information, text size information, arrangement mode information and arrangement row number information.

根据本公开的实施例,文字的排布方式可以包括文字在单元格中水平方向的排布方式和竖直方向的排布方式。其中,水平方向的排布方式可以包括:左侧对齐、居中对齐、右侧对齐。竖直方向的排布方式可以包括:顶部对齐、居中对齐和底部对齐。文字在单元格中的排布方式可以包括以下9种方式:左侧对齐+顶部对齐、左侧对齐+居中对齐、左侧对齐+底部对齐、居中对齐+顶部对齐、居中对齐+居中对齐、居中对齐+底部对齐、右侧对齐+顶部对齐、右侧对齐+居中对齐、右侧对齐+底部对齐。According to an embodiment of the present disclosure, the arrangement of characters may include a horizontal arrangement and a vertical arrangement of the characters in the cell. Wherein, the arrangement in the horizontal direction may include: left alignment, center alignment, and right alignment. The vertical arrangement methods may include: top alignment, center alignment and bottom alignment. The arrangement of text in the cell can include the following 9 ways: Left Alignment + Top Alignment, Left Alignment + Center Alignment, Left Alignment + Bottom Alignment, Center Alignment + Top Alignment, Center Alignment + Center Alignment, Center Align + Bottom, Right + Top, Right + Center, Right + Bottom.

图5示意性示出了根据本公开实施例的根据文字排布方式确定的文字在单元格中的展示效果示意图。Fig. 5 schematically shows a schematic diagram of a display effect of text in a cell determined according to a text arrangement method according to an embodiment of the present disclosure.

如图5所示,左侧对齐+顶部对齐的展示效果如5321所示,文字从单元格的左上顶角的位置开始排布。居中对齐+居中对齐的展示效果如532i所示,文字从单元格的中间位置开始排布。右侧对齐+底部对齐的展示效果如532I所示,文字从单元格中的靠右侧底部开始排布,最后一个文字位于单元格右下顶角的位置。As shown in Figure 5, the display effect of left alignment + top alignment is shown in 5321, and the text is arranged from the top left corner of the cell. The display effect of center alignment + center alignment is shown in 532i, and the text is arranged from the middle of the cell. The display effect of right alignment + bottom alignment is shown in 532I. The text is arranged from the bottom right of the cell, and the last text is located at the bottom right top corner of the cell.

根据本公开的实施例,目标策略可以表征针对不同排布方式配置的不同的文字坐标的计算策略。According to an embodiment of the present disclosure, the target strategy may represent a calculation strategy for different text coordinates configured in different arrangements.

根据本公开的实施例,文字尺寸信息包括文字高度信息和文字宽度信息。基于目标策略,根据单元格坐标信息、文字尺寸信息、排布方式信息和排布行数信息,得到文字坐标信息,可以包括如下操作:According to an embodiment of the present disclosure, the text size information includes text height information and text width information. Based on the target strategy, the text coordinate information can be obtained according to the cell coordinate information, text size information, layout information, and layout row number information, which can include the following operations:

根据单元格坐标信息、文字宽度信息和排布方式信息,得到文字横坐标信息。基于目标策略,根据单元格坐标信息、文字高度信息和排布行数信息,得到文字纵坐标信息。根据文字横坐标信息和文字纵坐标信息,得到文字坐标信息。According to the cell coordinate information, the text width information and the layout information, the text abscissa information is obtained. Based on the target strategy, the vertical coordinate information of the text is obtained according to the cell coordinate information, the text height information and the arrangement row number information. The text coordinate information is obtained according to the text abscissa information and the text ordinate information.

根据本公开的实施例,可以根据文字在单元格中水平方向的排布方式,配置自定义的偏移参数阈值范围,例如:[0,1]。在文字在单元格中水平方向的排布方式为左侧对齐时,可以确定文字在水平方向上的偏移参数为0。在文字在单元格中水平方向的排布方式为居中对齐时,可以确定文字在水平方向上的偏移参数为0.5。在文字在单元格中水平方向上的排布方式为右侧对齐时,可以确定文字在水平方向上的偏移参数为1。According to an embodiment of the present disclosure, a custom offset parameter threshold range can be configured according to the horizontal arrangement of text in the cell, for example: [0, 1]. When the horizontal arrangement of the text in the cell is aligned to the left, it can be determined that the offset parameter of the text in the horizontal direction is 0. When the text is aligned in the center in the horizontal direction in the cell, the offset parameter of the text in the horizontal direction can be determined to be 0.5. When the text is aligned to the right in the horizontal direction in the cell, the offset parameter of the text in the horizontal direction can be determined to be 1.

根据本公开的实施例,由于在真实表格中,表格的边框线会占据一定的宽度。为了避免靠近单元格边框线的文字被部分覆盖,可以根据实际需要变更上述的偏移参数阈值范围。例如:可以变更为[0.2,0.8]。According to the embodiment of the present disclosure, in a real table, the border line of the table will occupy a certain width. In order to prevent the text close to the cell border from being partially covered, the threshold range of the offset parameter above can be changed according to actual needs. For example: can be changed to [0.2, 0.8].

根据本公开的实施例,根据偏移参数信息、文字宽度信息和单元格坐标信息,得到文字横坐标信息,可以包括如下操作:According to an embodiment of the present disclosure, obtaining the text abscissa information according to the offset parameter information, text width information, and cell coordinate information may include the following operations:

根据左顶点坐标信息和右顶点坐标信息,得到单元格宽度信息。在确定排布方式信息为居中对齐的情况下,根据左顶点坐标信息和单元格宽度信息和文字宽度信息,得到文字横坐标信息。在确定排布方式信息为左侧对齐的情况下,根据左顶点坐标信息和偏移参数信息,得到文字横坐标信息。在确定排布方式信息为右侧对齐的情况下,根据右顶点坐标信息、文字宽度信息和偏移参数信息,得到文字横坐标信息。According to the coordinate information of the left vertex and the coordinate information of the right vertex, the cell width information is obtained. In the case that the arrangement information is determined to be center-aligned, the abscissa information of the text is obtained according to the left vertex coordinate information, the cell width information, and the text width information. In the case where it is determined that the arrangement information is left-aligned, the text abscissa information is obtained according to the coordinate information of the left vertex and the offset parameter information. When it is determined that the arrangement information is right-aligned, the abscissa information of the text is obtained according to the coordinate information of the right vertex, the text width information, and the offset parameter information.

根据本公开的实施例,文字宽度信息可以表征该单元格中全部文本内容按照预设文字字号得到的全部文字的宽度信息。According to an embodiment of the present disclosure, the text width information may represent the width information of all texts in the cell obtained according to a preset text size.

根据本公开的实施例,在确定排布方式信息为居中对齐的情况下,可以按照公式(2)得到文字横坐标信息:According to an embodiment of the present disclosure, when it is determined that the arrangement information is centered, the abscissa information of the text can be obtained according to the formula (2):

文字横坐标=左顶点坐标+单元格宽度/2-文字宽度/2(2)Text abscissa = left vertex coordinate + cell width/2-text width/2(2)

例如:单元格的左顶点横坐标可以为0,单元格宽度可以为5,文字宽度可以为3,可以确定文字的起始横坐标为1。For example: the abscissa of the left vertex of the cell can be 0, the cell width can be 5, the text width can be 3, and the initial abscissa of the text can be determined as 1.

根据本公开的实施例,在确定排布方式信息为左侧对齐的情况下,可以按照公式(3)得到文字横坐标信息:According to an embodiment of the present disclosure, when it is determined that the arrangement information is left-aligned, the text abscissa information can be obtained according to formula (3):

文字横坐标=左顶点坐标+偏移参数量(3)Text abscissa = left vertex coordinate + offset parameter (3)

例如:单元格的左顶点横坐标可以为0,左侧对齐的排布方式对应的偏移参数量可以为0.2,可以确定文字的起始横坐标为0.2。For example: the abscissa of the left vertex of the cell can be 0, the offset parameter corresponding to the left-aligned arrangement can be 0.2, and the starting abscissa of the text can be determined to be 0.2.

根据本公开的实施例,在确定排布方式信息为右侧对齐的情况下,可以按照公式(4)得到文字横坐标信息:According to an embodiment of the present disclosure, when it is determined that the arrangement information is right-aligned, the text abscissa information can be obtained according to formula (4):

文字横坐标=右顶点坐标-文字宽度-偏移参数量(4)Text abscissa=right vertex coordinate-text width-offset parameter (4)

例如:单元格的右顶点横坐标可以为5,文字宽度可以为3,右侧对齐的排布方式对应的偏移参数量可以为0.8,可以确定文字的起始横坐标为1.2。For example: the abscissa of the right vertex of the cell can be 5, the text width can be 3, the offset parameter corresponding to the right-aligned arrangement can be 0.8, and the starting abscissa of the text can be determined to be 1.2.

根据本公开的实施例,在确定单元格内文字的起始坐标的情况下,下一个文字的横坐标可以在起始坐标的基础上,沿着水平方向向右平移一个文字字号的宽度,即可得到下一个文字的横坐标信息。According to the embodiment of the present disclosure, in the case of determining the initial coordinates of the text in the cell, the abscissa of the next text can be translated to the right along the horizontal direction by the width of one text font size on the basis of the initial coordinates, that is The abscissa information of the next text can be obtained.

根据本公开的实施例,单元格坐标信息可以包括单元格的左上顶点坐标信息,基于目标策略,根据单元格坐标信息、文字高度信息和排布行数信息,得到文字纵坐标信息,可以包括如下操作:According to an embodiment of the present disclosure, the cell coordinate information may include the coordinate information of the upper left vertex of the cell. Based on the target strategy, the text vertical coordinate information may be obtained according to the cell coordinate information, text height information, and row number information, which may include the following operate:

根据单元格坐标信息,得到最小单元格高度信息。根据左上顶点坐标信息、最小单元格高度信息、文字高度信息和排布行数信息,得到文字纵坐标信息。According to the cell coordinate information, the minimum cell height information is obtained. According to the coordinate information of the upper left vertex, the minimum cell height information, the text height information and the arrangement row number information, the text vertical coordinate information is obtained.

例如:在每一个单元格的坐标信息均确定的情况下,可以得到目标页面上最小单元格的高度信息,例如:最小单元格高度可以为5。文字高度可以为1,排布行数可以包括文字在单元格内的排布行数信息和文字在同一行多个单元格内的最大排布行数信息。例如:文字在单元格内的排布行数可以为1,文字在同一行多个单元格内的最大排布行数可以为2。可以根据文字在单元格竖直方向上的不同排布方式,按照不同的计算策略,得到文字纵坐标信息。For example: when the coordinate information of each cell is determined, the height information of the smallest cell on the target page can be obtained, for example: the height of the smallest cell can be 5. The height of the text can be 1, and the number of rows can include the information of the number of rows of the text in the cell and the information of the maximum number of rows of the text in multiple cells in the same row. For example: the number of rows of text in a cell can be 1, and the maximum number of rows of text in multiple cells in the same row can be 2. The vertical coordinate information of the text can be obtained according to different arrangements of the text in the vertical direction of the cell and according to different calculation strategies.

根据本公开的实施例,在确定排布方式信息为顶部对齐的情况下,可以按照公式(5)得到文字纵坐标信息:According to an embodiment of the present disclosure, in the case where the arrangement information is determined to be top-aligned, the vertical coordinate information of the text can be obtained according to the formula (5):

文字纵坐标=左上顶点的纵坐标+最小单元格高度×最大排布行数/2-文字高度×最大排布行数/2 (6)Text vertical coordinate = vertical coordinate of upper left vertex + minimum cell height × maximum number of rows/2-text height×maximum number of rows/2 (6)

例如:左上顶点的纵坐标可以为0,最小单元格高度为5,最大排布行数为2,文字高度为1,可以确定文字纵坐标为4。For example: the ordinate of the upper left vertex can be 0, the minimum cell height is 5, the maximum number of rows is 2, the text height is 1, and the text ordinate can be determined to be 4.

根据本公开的实施例,在确定排布方式信息为居中对齐的情况下,可以按照公式(6)得到文字纵坐标信息:According to an embodiment of the present disclosure, in the case where it is determined that the arrangement information is centered, the vertical coordinate information of the text can be obtained according to the formula (6):

文字纵坐标=左上顶点的纵坐标+最小单元格高度×最大排布行数/2-文字高度×本单元格内的文字排布行数/2 (7)Text ordinate = vertical coordinate of the upper left vertex + minimum cell height × maximum number of rows/2-text height × number of rows of text in this cell/2 (7)

例如:左上顶点的纵坐标可以为0,最小单元格高度为5,最大排布行数为2,文字高度为1,本单元格内的文字排布行数为1,可以确定文字纵坐标为4.5。For example: the ordinate of the upper left vertex can be 0, the minimum cell height is 5, the maximum number of rows is 2, the height of the text is 1, the number of rows of text in this cell is 1, and the ordinate of the text can be determined as 4.5.

根据本公开的实施例,在确定排布方式信息为底部对齐的情况下,可以按照公式(7)得到文字纵坐标信息:According to an embodiment of the present disclosure, when it is determined that the arrangement information is bottom-aligned, the vertical coordinate information of the text can be obtained according to the formula (7):

文字纵坐标=左上顶点的纵坐标+最小单元格高度×最大排布行数/2-文字高度×最大排布行数/2+最小单元格高度×(最大排布行数-本单元格内的文字排布行数) (7)Text ordinate = vertical coordinate of upper left vertex + minimum cell height × maximum number of rows/2-text height×maximum number of rows/2+minimum cell height×(maximum number of rows-in this cell The number of lines of text layout) (7)

例如:左上顶点的纵坐标可以为0,最小单元格高度为5,最大排布行数为2,文字高度为1,本单元格内的文字排布行数为1,可以确定文字纵坐标为9。For example: the ordinate of the upper left vertex can be 0, the minimum cell height is 5, the maximum number of rows is 2, the height of the text is 1, the number of rows of text in this cell is 1, and the ordinate of the text can be determined as 9.

根据本公开的实施例,上述操作S240可以包括如下操作:According to an embodiment of the present disclosure, the above operation S240 may include the following operations:

根据文本内容信息,确定目标单元格。将文本内容信息按照文字坐标信息填充至目标单元格内。将目标单元格按照单元格坐标信息在目标页面上进行排布,生成目标表格。将单元格坐标信息、文字坐标信息和文本内容信息按照预定数据格式进行处理,得到标注数据。Determine the target cell according to the text content information. Fill the text content information into the target cell according to the text coordinate information. Arrange the target cells on the target page according to the cell coordinate information to generate the target table. The cell coordinate information, text coordinate information and text content information are processed according to a predetermined data format to obtain label data.

根据本公开的实施例,标注数据中可以包括表格内容信息和表格结构信息。例如:文本内容信息可以为“账号”,可以确定目标单元格为第二行第1个单元格。按照文字坐标信息,例如:“账”按照第一个文字的起始横坐标0.2,起始纵坐标1,填充至目标单元格中。“号”按照第二个文字的起始横坐标0.5,起始纵坐标1,填充至目标单元格中。并将目标单元格按照单元格坐标信息,在目标页面上进行排布,得到目标表格。According to an embodiment of the present disclosure, the annotation data may include table content information and table structure information. For example: the text content information can be "account number", and the target cell can be determined to be the first cell in the second row. According to the text coordinate information, for example: "Account" is filled in the target cell according to the starting abscissa of the first text of 0.2 and the starting ordinate of 1. "Number" is filled in the target cell according to the starting abscissa of the second text, which is 0.5, and the starting ordinate, 1. And the target cells are arranged on the target page according to the cell coordinate information to obtain the target table.

需要说明的是,在本公开实施例中,单元格的坐标信息、文字的坐标信息均可以为像素坐标信息。It should be noted that, in the embodiment of the present disclosure, the coordinate information of the cell and the coordinate information of the text may both be pixel coordinate information.

根据本公开的实施例,上述单元格坐标信息、文字坐标信息和文本内容信息,可以按照一一对应的映射关系进行存储,并按照预定数据格式进行处理,例如:可以是JSON格式,得到标注数据。According to an embodiment of the present disclosure, the above-mentioned cell coordinate information, text coordinate information, and text content information can be stored according to a one-to-one mapping relationship, and processed according to a predetermined data format, for example, it can be in JSON format to obtain label data .

图6示意性示出了根据本公开一些实施例的表格示意图。Fig. 6 schematically shows a table diagram according to some embodiments of the present disclosure.

如图6所示,在600中,在第1行的单元格中,文字在单元格中的排布方式为水平方向的居中对齐+竖直方向的居中对齐。在第2行之后的每一个单元格中,文字在单元格中的排布方式为水平方向的左侧对齐+竖直方向上的居中对齐。在第2行、第4行~第5行的单元格中,文字在单元格中的排布行数为2行。在第3行第1个单元格中,文字在单元格中的排布行数为3行。As shown in FIG. 6 , in 600 , in the cells in the first row, the arrangement of the text in the cells is center alignment in the horizontal direction + center alignment in the vertical direction. In each cell after row 2, the arrangement of the text in the cell is left alignment in the horizontal direction + center alignment in the vertical direction. In the cells of the 2nd row, the 4th row to the 5th row, the number of rows in which the text is arranged in the cell is 2 rows. In the first cell of the third row, the number of rows of text in the cell is 3 rows.

需要说明的是,由于本公开实施例中生成的表格是作为模型训练的样本表格使用,因此,表格内容中的“账号”、“卡号”、“交易金额”、“交易日期”等对应的文本值均为随机数。It should be noted that since the form generated in the embodiment of the present disclosure is used as a sample form for model training, the text corresponding to "account number", "card number", "transaction amount" and "transaction date" in the content of the form The values are random numbers.

为了使的目标表格与采集的表格图像更加接近,可以为目标表格添加不同的表格边框线。In order to make the target table closer to the collected table image, different table border lines can be added to the target table.

根据本公开的实施例,上述表格生成方法还可以包括如下操作:According to an embodiment of the present disclosure, the above table generation method may further include the following operations:

获取表格边框线型模板。按照表格边框线型模板,根据单元格坐标信息,在目标表格上构建边框线,得到第一表格图像。Get the table border line style template. According to the table border line template and according to the cell coordinate information, a border line is constructed on the target table to obtain the first table image.

根据本公开的实施例,目标页面可以是采用Pillow图像处理软件构建的空白页面。还可以在空白页面上随机添加灰度颜色,以得到不同灰度第一表格图像。According to an embodiment of the present disclosure, the target page may be a blank page constructed using Pillow image processing software. It is also possible to randomly add grayscale colors on a blank page to obtain first form images of different grayscales.

根据本公开的实施例,表格边框线型模板中可以包括多种线型,例如:全框线型、非全框线型、虚线型等。可以根据实际需要,灵活选择表格边框线型模板中的线性,为目标表格中的单元格构建边框线,得到第一表格图像。According to an embodiment of the present disclosure, the table border line template may include multiple line styles, for example: full-frame line style, non-full-frame line style, dashed line style, and the like. According to actual needs, the linear in the table border line template can be flexibly selected to construct border lines for the cells in the target table to obtain the first table image.

图7示意性示出了根据本公开一些实施例的带有边框线的表格示意图。Fig. 7 schematically shows a schematic diagram of a table with border lines according to some embodiments of the present disclosure.

如图7所示,在700中,在第1行~第6行中单元格中,单元格的边框线型为全框线性。第7行至最后一行的单元格中,包括多种边框线型。例如:第7行第1个单元格中,左侧边框和顶部边框的线型为实线边框线型,右侧边框和底部边框线型为无边框线。第7行第2个单元格中,左侧边框、底部边框中的线型为无边框线,顶部边框的线型为实线边框线型,右侧边框的线型为虚线边框线型。As shown in FIG. 7 , in 700 , among the cells in the first row to the sixth row, the border line type of the cell is full-frame linear. The cells from the seventh row to the last row include various border line styles. For example: in the first cell in row 7, the line type of the left border and top border is a solid border line type, and the line type of the right border and bottom border is no border line. In the second cell of row 7, the line type of the left border and bottom border is no border line, the line type of the top border is solid border line type, and the line type of the right border is dashed border line type.

根据本公开的实施例,上述表格生成方法还可以包括如下操作:According to an embodiment of the present disclosure, the above table generation method may further include the following operations:

获取印章素材图像集。随机从印章素材图像集中选择目标印章图像。对目标印章图像和第一表格图像进行处理,得到第二表格图像。Get stamp material image set. Randomly select the target stamp image from the stamp material image set. The target stamp image and the first form image are processed to obtain the second form image.

根据本公开的实施例,印章素材图像集中可以包括模拟真实表格图像中的不同场景下的印章模板图像。可以随机从印章模板图像中选择目标印章图像T,并可以对目标印章图像T和第一表格图像进行融合处理,得到第二表格图像。According to an embodiment of the present disclosure, the stamp material image set may include stamp template images simulating different scenes in real form images. The target stamp image T can be randomly selected from the stamp template images, and the target stamp image T can be fused with the first form image to obtain the second form image.

图8示意性示出了根据本公开一些实施例的带有印章的表格示意图。Fig. 8 schematically shows a schematic diagram of a form with stamps according to some embodiments of the present disclosure.

如图8所示,在1100中,目标印章图像T为XX公司的印章,目标印章图像T的位置可以是随机的,换言之,变更目标印章图像T与第一表格图像的相对位置,可以得到多个第二表格图像,作为模型训练的样本表格图像。As shown in Figure 8, in 1100, the target seal image T is the seal of XX company, the position of the target seal image T can be random, in other words, change the relative position of the target seal image T and the first form image, can get many A second table image is used as a sample table image for model training.

由于采集得到的真实表格图像中,印章可以是残缺不全的,例如:对于骑缝章,不同页面的表格图像上仅展示局部印章。因此,为了提高第二表格图像与真实表格图像的接近程度,可以先对目标印章图像进行处理,再与第一表格图像进行融合处理。In the collected real form image, the seal may be incomplete, for example: for the seam seal, only partial seals are displayed on the form images of different pages. Therefore, in order to increase the closeness between the second form image and the real form image, the target stamp image may be processed first, and then fused with the first form image.

根据本公开的实施例,对目标印章图像和第一表格图像进行处理,得到第二表格图像,可以包括如下操作:According to an embodiment of the present disclosure, processing the target stamp image and the first form image to obtain the second form image may include the following operations:

对目标印章图像进行裁剪处理,得到局部印章图像。删除局部印章图像中的背景颜色,得到目标局部印章图像。对目标局部印章图像和第一表格图像进行处理,得到第二表格图像。The target stamp image is cropped to obtain a partial stamp image. Delete the background color in the partial stamp image to obtain the target partial stamp image. The target partial seal image and the first form image are processed to obtain the second form image.

由于真实表格图像可以是在不同光线条件下利用图像采集设备采集得到的,不同的光线条件、不同的采集方式、不同的采集设备在采集同一张表格的图像信息时,得到的表格图像可以是不同的。为了模拟不同采集环境下采集得到的表格图像,对目标局部印章图像和第一表格图像进行处理,得到第二表格图像,可以包括如下操作:Since real form images can be collected by image acquisition equipment under different light conditions, when different light conditions, different acquisition methods, and different acquisition equipment collect the image information of the same form, the obtained form images can be different. of. In order to simulate the form images collected under different acquisition environments, the target partial seal image and the first form image are processed to obtain the second form image, which may include the following operations:

将目标局部印章图像和第一表格图像进行融合处理,得到带有目标局部印章的表格图像。对带有目标局部印章的表格图像进行滤波处理,得到第二表格图像。The target partial seal image is fused with the first form image to obtain a form image with the target partial seal. Filtering is performed on the form image with the target partial seal to obtain a second form image.

根据本公开的实施例,滤波处理可以包括以下至少一种:高斯滤波、轮廓滤波、细节滤波、边缘增强滤波、平滑滤波、深度平滑滤波、非锐化掩膜滤波等。可以通过一种或多种滤波方式对带有目标局部印章的表格图像进行一次或多次滤波处理,得到可以用于模拟不同采集环境下得到的第二表格图像。According to an embodiment of the present disclosure, the filtering process may include at least one of the following: Gaussian filtering, contour filtering, detail filtering, edge enhancement filtering, smoothing filtering, depth smoothing filtering, unsharp mask filtering, and the like. The form image with the target partial seal can be filtered one or more times by one or more filtering methods to obtain a second form image that can be used to simulate different acquisition environments.

图9示意性示出了根据本公开一些实施例的经过滤波处理的表格示意图。Fig. 9 schematically shows a schematic diagram of a filtered table according to some embodiments of the present disclosure.

如图9所示,在900中,可以是利用高斯滤波处理带有目标印章的表格图像得到的用于模拟真实采集环境下的表格图像。从900中可以看出,表格图像中的字体处于较为模糊的状态,利用经过滤波处理的表格图像训练表格识别模型,可以有效提高模型的训练精度。As shown in FIG. 9 , at 900 , it may be a form image for simulating a real acquisition environment obtained by processing a form image with a target seal by using Gaussian filtering. It can be seen from 900 that the fonts in the table image are in a relatively fuzzy state, and using the filtered table image to train the table recognition model can effectively improve the training accuracy of the model.

图10示意性示出了根据本公开实施例的表格生成装置的框图。Fig. 10 schematically shows a block diagram of a table generating device according to an embodiment of the present disclosure.

如图10所示,该实施例的表格生成装置1000可以包括第一获取模块1010、第一获得模块1020、第二获得模块1030和生成模块1040。As shown in FIG. 10 , the table generating apparatus 1000 of this embodiment may include a first obtaining module 1010 , a first obtaining module 1020 , a second obtaining module 1030 and a generating module 1040 .

第一获取模块1010,用于获取文本内容信息和目标页面的布局信息,目标页面的布局信息包括页面参数信息、单元格布局信息和文字布局信息。在一些实施例中,第一获取模块1010可以用于实施前文所述的操作S210,在此不做赘述。The first acquisition module 1010 is configured to acquire text content information and layout information of the target page, where the layout information of the target page includes page parameter information, cell layout information and text layout information. In some embodiments, the first obtaining module 1010 may be configured to implement the operation S210 described above, which will not be described in detail here.

第一获得模块1020,用于根据页面参数信息、单元格布局信息和文字布局信息,得到单元格坐标信息。在一些实施例中,第一获得模块1020可以用于实施前文所述的操作S220,在此不做赘述。The first obtaining module 1020 is configured to obtain cell coordinate information according to page parameter information, cell layout information and text layout information. In some embodiments, the first obtaining module 1020 may be configured to implement operation S220 described above, which will not be repeated here.

第二获得模块1030,用于根据文字布局信息和单元格坐标信息,得到文字坐标信息。在一些实施例中,第二获得模块1030可以用于实施前文所述的操作S230,在此不做赘述。The second obtaining module 1030 is configured to obtain text coordinate information according to text layout information and cell coordinate information. In some embodiments, the second obtaining module 1030 may be configured to implement operation S230 described above, which will not be repeated here.

生成模块1040,用于根据单元格坐标信息、文字坐标信息和文本内容信息,生成目标表格和与目标表格对应的标注数。在一些实施例中,生成模块1040可以用于实施前文所述的操作S240,在此不做赘述。The generating module 1040 is configured to generate the target table and the label numbers corresponding to the target table according to the cell coordinate information, text coordinate information and text content information. In some embodiments, the generating module 1040 may be used to implement the operation S240 described above, which will not be repeated here.

根据本公开的实施例,单元格布局信息包括单元格的尺寸比例信息和单元格之间的相对位置关系信息。第一获得模块可以包括:第一获得子模块、第二获得子模块和第三获得子模块。其中,第一获得子模块,用于根据页面参数信息和单元格的尺寸比例信息,得到最小单元格尺寸信息。第二获得子模块,用于根据最小单元格尺寸信息和相对位置关系信息,得到单元格尺寸信息。第三获得子模块,用于根据单元格尺寸信息、页面参数信息和文字布局信息,得到单元格坐标信息。According to an embodiment of the present disclosure, the cell layout information includes size ratio information of the cells and relative positional relationship information between the cells. The first obtaining module may include: a first obtaining submodule, a second obtaining submodule and a third obtaining submodule. Wherein, the first obtaining sub-module is used to obtain the minimum cell size information according to the page parameter information and the cell size ratio information. The second obtaining sub-module is used to obtain cell size information according to the minimum cell size information and relative position relationship information. The third obtaining sub-module is used to obtain cell coordinate information according to cell size information, page parameter information and text layout information.

根据本公开的实施例,文字布局信息包括文字在单元格内的换行标识信息,第三获得子模块可以包括:识别单元、第一获得单元、第二获得单元。其中,识别单元,用于识别换行标识信息,得到文字在单元格内的排布行数信息。第一获得单元,用于根据单元格尺寸信息和页面参数信息,得到单元格在目标页面上的排布位置信息。第二获得单元,用于根据排布位置信息和排布行数信息,得到单元格坐标信息。According to an embodiment of the present disclosure, the text layout information includes line break identification information of the text in the cell, and the third obtaining submodule may include: an identification unit, a first obtaining unit, and a second obtaining unit. Wherein, the recognition unit is used to recognize the newline identification information, and obtain the information on the number of rows of characters arranged in the cell. The first obtaining unit is configured to obtain the arrangement position information of the cells on the target page according to the cell size information and the page parameter information. The second obtaining unit is configured to obtain cell coordinate information according to the arrangement position information and the arrangement row number information.

根据本公开的实施例,第二获得单元可以包括:第一获得子单元、第二获得子单元和第三获得子单元。其中,第一获得子单元,用于根据排布位置信息,得到位于同一行的多个目标单元格。第二获得子单元,用于根据排布行数信息,得到多个目标单元格的高度信息。第三获得子单元,用于根据排布位置信息和高度信息,得到单元格坐标信息。According to an embodiment of the present disclosure, the second obtaining unit may include: a first obtaining subunit, a second obtaining subunit, and a third obtaining subunit. Wherein, the first obtaining subunit is configured to obtain multiple target cells located in the same row according to the arrangement position information. The second obtaining subunit is used to obtain the height information of multiple target cells according to the arrangement row number information. The third is to obtain subunits, which are used to obtain cell coordinate information according to the arrangement position information and height information.

根据本公开的实施例,第二获得子单元用于将多个目标单元格的排布行数信息进行排序,得到排序结果。根据排序结果,得到高度信息。According to an embodiment of the present disclosure, the second obtaining subunit is configured to sort the row number information of the plurality of target cells to obtain a sorting result. According to the sorting results, the height information is obtained.

根据本公开的实施例,文字布局信息包括文字在单元格内的排布方式信息、文字尺寸信息和文字在单元格内的换行标识信息,第二获得模块可以包括:第一确定子模块、第四获得子模块和第五获得子模块。其中,第一确定子模块,用于根据排布方式信息,确定目标策略。第四获得子模块,用于根据换行标识信息,得到文字在单元格内的排布行数信息。第五获得子模块,用于基于目标策略,根据单元格坐标信息、文字尺寸信息、排布方式信息和排布行数信息,得到文字坐标信息。According to an embodiment of the present disclosure, the text layout information includes text layout information in a cell, text size information, and text line break identification information in a cell, and the second obtaining module may include: a first determination sub-module, a second Four obtained sub-modules and fifth obtained sub-modules. Wherein, the first determination sub-module is configured to determine the target strategy according to the arrangement information. The fourth obtaining sub-module is used to obtain information on the number of rows of text arranged in the cell according to the newline identification information. The fifth obtaining sub-module is used to obtain the text coordinate information based on the target strategy according to the cell coordinate information, text size information, arrangement mode information and arrangement row number information.

根据本公开的实施例,文字尺寸信息包括文字高度信息和文字宽度信息,第五获得子模块可以包括:第三获得单元、第四获得单元和第五获得单元。其中,第三获得单元,用于根据单元格坐标信息、文字宽度信息和排布方式信息,得到文字横坐标信息。第四获得单元,用于基于目标策略,根据单元格坐标信息、文字高度信息和排布行数信息,得到文字纵坐标信息。第五获得单元,用于根据文字横坐标信息和文字纵坐标信息,得到文字坐标信息。According to an embodiment of the present disclosure, the character size information includes character height information and character width information, and the fifth obtaining submodule may include: a third obtaining unit, a fourth obtaining unit, and a fifth obtaining unit. Wherein, the third obtaining unit is configured to obtain text abscissa information according to cell coordinate information, text width information, and layout information. The fourth obtaining unit is used to obtain text ordinate information based on the target strategy, according to cell coordinate information, text height information, and arrangement row number information. The fifth obtaining unit is configured to obtain text coordinate information according to text abscissa information and text ordinate information.

根据本公开的实施例,第三获得单元可以包括确定子单元和第四获得子单元。其中,确定子单元,用于根据排布方式信息,确定文字在水平方向上的偏移参数信息。第四获得子单元,用于根据偏移参数信息、文字宽度信息和单元格坐标信息,得到文字横坐标信息。According to an embodiment of the present disclosure, the third obtaining unit may include a determining subunit and a fourth obtaining subunit. Wherein, the determination sub-unit is used to determine the offset parameter information of the characters in the horizontal direction according to the arrangement information. The fourth obtaining subunit is used to obtain text abscissa information according to the offset parameter information, text width information and cell coordinate information.

根据本公开的实施例,单元格坐标信息包括左顶点坐标信息和右顶点坐标信息,第四获得子单元用于:根据左顶点坐标信息和右顶点坐标信息,得到单元格宽度信息。在确定排布方式信息为居中对齐的情况下,根据左顶点坐标信息和单元格宽度信息和文字宽度信息,得到文字横坐标信息。在确定排布方式信息为左侧对齐的情况下,根据左顶点坐标信息和偏移参数信息,得到文字横坐标信息。在确定排布方式信息为右侧对齐的情况下,根据右顶点坐标信息、文字宽度信息和偏移参数信息,得到文字横坐标信息。According to an embodiment of the present disclosure, the cell coordinate information includes left vertex coordinate information and right vertex coordinate information, and the fourth obtaining subunit is configured to obtain cell width information according to the left vertex coordinate information and the right vertex coordinate information. In the case that the arrangement information is determined to be center-aligned, the abscissa information of the text is obtained according to the left vertex coordinate information, the cell width information, and the text width information. In the case where it is determined that the arrangement information is left-aligned, the text abscissa information is obtained according to the coordinate information of the left vertex and the offset parameter information. When it is determined that the arrangement information is right-aligned, the abscissa information of the text is obtained according to the coordinate information of the right vertex, the text width information, and the offset parameter information.

根据本公开的实施例,第四获得单元可以包括第五获得子单元、第六获得子单元。其中,第五获得子单元用于根据单元格坐标信息,得到最小单元格高度信息。第六获得子单元,用于根据左上顶点坐标信息、最小单元格高度信息、文字高度信息和排布行数信息,得到文字纵坐标信息。According to an embodiment of the present disclosure, the fourth obtaining unit may include a fifth obtaining subunit and a sixth obtaining subunit. Wherein, the fifth obtaining subunit is used to obtain the minimum cell height information according to the cell coordinate information. The sixth obtaining subunit is used to obtain text vertical coordinate information according to the upper left vertex coordinate information, minimum cell height information, text height information and arrangement row number information.

根据本公开的实施例,排布行数信息包括文字在单元格内的排布行数信息和文字在同一行多个单元格内的最大排布行数信息;第六获得子单元用于:在确定排布方式信息为顶部对齐的情况下,根据左上顶点坐标信息、最小单元格高度信息、文字高度信息和最大排布行数信息,得到文字纵坐标信息。在确定排布方式信息为居中对齐或底部对齐的情况下,根据左上顶点坐标信息、最小单元格高度信息、文字高度信息、文字在单元格内的排布行数信息和最大排布行数信息,得到文字纵坐标信息。According to an embodiment of the present disclosure, the information on the number of rows arranged in a cell includes the information on the number of rows arranged in a cell and the information on the number of rows arranged in a plurality of cells in the same row; the sixth obtaining subunit is used for: In the case that the arrangement mode information is determined to be top-aligned, the longitudinal coordinate information of the text is obtained according to the coordinate information of the upper left vertex, the minimum cell height information, the text height information and the maximum arrangement row number information. In the case of determining whether the arrangement information is center-aligned or bottom-aligned, according to the coordinate information of the upper left vertex, the minimum cell height information, the text height information, the number of rows of text in the cell, and the maximum number of rows , to get the text ordinate information.

根据本公开的实施例,生成模块可以包括第二确定子模块、填充子模块、生成子模块和第六获得子模块。其中,第二确定子模块,用于根据文本内容信息,确定目标单元格。填充子模块,用于将文本内容信息按照文字坐标信息填充至目标单元格内。生成子模块,用于将目标单元格按照单元格坐标信息在目标页面上进行排布,生成目标表格。第六获得子模块,用于将单元格坐标信息、文字坐标信息和文本内容信息按照预定数据格式进行处理,得到标注数据。According to an embodiment of the present disclosure, the generating module may include a second determining submodule, a filling submodule, a generating submodule and a sixth obtaining submodule. Wherein, the second determining submodule is used to determine the target cell according to the text content information. The filling sub-module is used to fill the text content information into the target cell according to the text coordinate information. The generation sub-module is used to arrange the target cells on the target page according to the cell coordinate information to generate the target table. The sixth obtaining sub-module is used to process cell coordinate information, text coordinate information and text content information according to a predetermined data format to obtain label data.

根据本公开的实施例,上述表格生成装置还可以包括第二获取模块和第三获得模块。其中,第二获取模块,用于获取表格边框线型模板。第三获得模块,用于按照表格边框线型模板,根据单元格坐标信息,在目标表格上构建边框线,得到第一表格图像。According to an embodiment of the present disclosure, the above table generation apparatus may further include a second obtaining module and a third obtaining module. Wherein, the second obtaining module is used to obtain the form border line template. The third obtaining module is configured to construct border lines on the target table according to the table border line template and cell coordinate information to obtain the first table image.

根据本公开的实施例,上述表格生成装置还可以包括第三获取模块、选择模块和第四获得模块。其中,第三获取模块,用于获取印章素材图像集。选择模块,用于随机从印章素材图像集中选择目标印章图像。第四获得模块,用于对目标印章图像和第一表格图像进行处理,得到第二表格图像。According to an embodiment of the present disclosure, the above table generating apparatus may further include a third obtaining module, a selecting module and a fourth obtaining module. Wherein, the third obtaining module is used to obtain the seal material image set. The selection module is used to randomly select the target stamp image from the stamp material image set. The fourth obtaining module is configured to process the target seal image and the first form image to obtain the second form image.

根据本公开的实施例,第四获得模块可以包括第七获得子模块、第八获得子模块、第九获得子模块。其中,第七获得子模块,用于对目标印章图像进行裁剪处理,得到局部印章图像。第八获得子模块,用于删除局部印章图像中的背景颜色,得到目标局部印章图像。第九获得子模块,用于对目标局部印章图像和第一表格图像进行处理,得到第二表格图像。According to an embodiment of the present disclosure, the fourth obtaining module may include a seventh obtaining submodule, an eighth obtaining submodule, and a ninth obtaining submodule. Wherein, the seventh obtaining sub-module is used to perform cropping processing on the target seal image to obtain a partial seal image. The eighth obtaining sub-module is used to delete the background color in the partial seal image to obtain the target partial seal image. The ninth obtaining sub-module is used to process the target partial seal image and the first form image to obtain the second form image.

根据本公开的实施例,第九获得子模块可以包括第六获得单元和第七获得单元。其中,第六获得单元,用于将目标局部印章图像和第一表格图像进行融合处理,得到带有目标局部印章的表格图像。第七获得单元,用于对带有目标局部印章的表格图像进行滤波处理,得到第二表格图像。According to an embodiment of the present disclosure, the ninth obtaining submodule may include a sixth obtaining unit and a seventh obtaining unit. Wherein, the sixth obtaining unit is configured to fuse the target partial seal image and the first form image to obtain the form image with the target partial seal. The seventh obtaining unit is configured to filter the form image with the target partial seal to obtain the second form image.

根据本公开的实施例,本公开还提供了一种电子设备、一种可读存储介质和一种计算机程序产品。According to the embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

根据本公开的实施例,一种电子设备,包括:至少一个处理器;以及与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行如上所述的方法。According to an embodiment of the present disclosure, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by at least one processor, and the instructions are processed by at least one The processor is executed, so that at least one processor can perform the method as described above.

根据本公开的实施例,一种存储有计算机指令的非瞬时计算机可读存储介质,其中,计算机指令用于使计算机执行如上所述的方法。According to an embodiment of the present disclosure, there is a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the method as described above.

根据本公开的实施例,一种计算机程序产品,包括计算机程序,计算机程序在被处理器执行时实现如上所述的方法。According to an embodiment of the present disclosure, a computer program product includes a computer program, and the computer program implements the method as described above when executed by a processor.

图11示出了可以用来实施本公开的实施例的示例电子设备1100的示意性框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本公开的实现。FIG. 11 shows a schematic block diagram of an example electronic device 1100 that may be used to implement embodiments of the present disclosure. Electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are by way of example only, and are not intended to limit implementations of the disclosure described and/or claimed herein.

如图11所示,设备1100包括计算单元1101,其可以根据存储在只读存储器(ROM)1102中的计算机程序或者从存储单元1108加载到随机访问存储器(RAM)1103中的计算机程序,来执行各种适当的动作和处理。在RAM 1103中,还可存储设备1100操作所需的各种程序和数据。计算单元1101、ROM 1102以及RAM 1103通过总线1104彼此相连。输入/输出(I/O)接口1105也连接至总线1104。As shown in FIG. 11 , the device 1100 includes a computing unit 1101 that can be executed according to a computer program stored in a read-only memory (ROM) 1102 or loaded from a storage unit 1108 into a random-access memory (RAM) 1103. Various appropriate actions and treatments. In the RAM 1103, various programs and data necessary for the operation of the device 1100 can also be stored. The computing unit 1101 , ROM 1102 , and RAM 1103 are connected to each other through a bus 1104 . An input/output (I/O) interface 1105 is also connected to the bus 1104 .

设备1100中的多个部件连接至I/O接口1105,包括:输入单元1106,例如键盘、鼠标等;输出单元1107,例如各种类型的显示器、扬声器等;存储单元1108,例如磁盘、光盘等;以及通信单元1109,例如网卡、调制解调器、无线通信收发机等。通信单元1109允许设备1100通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。Multiple components in the device 1100 are connected to the I/O interface 1105, including: an input unit 1106, such as a keyboard, a mouse, etc.; an output unit 1107, such as various types of displays, speakers, etc.; a storage unit 1108, such as a magnetic disk, an optical disk, etc. ; and a communication unit 1109, such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 1109 allows the device 1100 to exchange information/data with other devices through a computer network such as the Internet and/or various telecommunication networks.

计算单元1101可以是各种具有处理和计算能力的通用和/或专用处理组件。计算单元1101的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的计算单元、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。计算单元1101执行上文所描述的各个方法和处理,例如表格生成方法。例如,在一些实施例中,表格生成方法可被实现为计算机软件程序,其被有形地包含于机器可读介质,例如存储单元1108。在一些实施例中,计算机程序的部分或者全部可以经由ROM1102和/或通信单元1109而被载入和/或安装到设备1100上。当计算机程序加载到RAM 1103并由计算单元1101执行时,可以执行上文描述的表格生成方法的一个或多个步骤。备选地,在其他实施例中,计算单元1101可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行表格生成方法。The computing unit 1101 may be various general-purpose and/or special-purpose processing components having processing and computing capabilities. Some examples of computing units 1101 include, but are not limited to, central processing units (CPUs), graphics processing units (GPUs), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processing processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1101 executes various methods and processes described above, such as a table generation method. For example, in some embodiments, the table generation method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 1108 . In some embodiments, part or all of the computer program may be loaded and/or installed on the device 1100 via the ROM 1102 and/or the communication unit 1109 . When the computer program is loaded into the RAM 1103 and executed by the calculation unit 1101, one or more steps of the above-described table generation method may be performed. Alternatively, in other embodiments, the calculation unit 1101 may be configured to execute the table generation method in any other suitable manner (for example, by means of firmware).

本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、复杂可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips Implemented in a system of systems (SOC), complex programmable logic device (CPLD), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor Can be special-purpose or general-purpose programmable processor, can receive data and instruction from storage system, at least one input device, and at least one output device, and transmit data and instruction to this storage system, this at least one input device, and this at least one output device an output device.

用于实施本公开的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。Program codes for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special purpose computer, or other programmable data processing devices, so that the program codes, when executed by the processor or controller, make the functions/functions specified in the flow diagrams and/or block diagrams Action is implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.

在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.

为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide for interaction with the user, the systems and techniques described herein can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user. ); and a keyboard and pointing device (eg, a mouse or a trackball) through which a user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and can be in any form (including Acoustic input, speech input or, tactile input) to receive input from the user.

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., as a a user computer having a graphical user interface or web browser through which a user can interact with embodiments of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system. The components of the system can be interconnected by any form or medium of digital data communication, eg, a communication network. Examples of communication networks include: Local Area Network (LAN), Wide Area Network (WAN) and the Internet.

计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,也可以是分布式系统的服务器,或者是结合了区块链的服务器。A computer system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发公开中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本公开公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that steps may be reordered, added or deleted using the various forms of flow shown above. For example, each step described in the present disclosure may be executed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in the present disclosure can be achieved, no limitation is imposed herein.

上述具体实施方式,并不构成对本公开保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本公开的精神和原则之内所作的修改、等同替换和改进等,均应包含在本公开保护范围之内。The specific implementation manners described above do not limit the protection scope of the present disclosure. It should be apparent to those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present disclosure shall be included within the protection scope of the present disclosure.

Claims (20)

1. A form generation method, comprising:
acquiring text content information and layout information of a target page, wherein the layout information of the target page comprises page parameter information, cell layout information and text layout information;
obtaining cell coordinate information according to the page parameter information, the cell layout information and the text layout information;
obtaining text coordinate information according to the text layout information and the cell coordinate information; and
And generating a target table and labeling data corresponding to the target table according to the cell coordinate information, the text coordinate information and the text content information.
2. The method of claim 1, wherein the cell layout information includes size proportion information of cells and relative positional relationship information between cells; the page parameter information and the cell layout information obtain cell coordinate information, including:
obtaining minimum cell size information according to the page parameter information and the cell size proportion information;
obtaining cell size information according to the minimum cell size information and the relative position relation information; and
and obtaining the cell coordinate information according to the cell size information, the page parameter information and the text layout information.
3. The method of claim 2, wherein the text layout information includes line feed identification information of text within a cell, and the obtaining the cell coordinate information according to the cell size information, the page parameter information, and the text layout information includes:
Identifying the line feed identification information to obtain the line number information of the arrangement of the characters in the unit cells;
obtaining arrangement position information of the cells on the target page according to the cell size information and the page parameter information; and
and obtaining the cell coordinate information according to the arrangement position information and the arrangement line number information.
4. The method of claim 3, wherein the obtaining the cell coordinate information according to the arrangement position information and the arrangement line number information includes:
obtaining a plurality of target cells positioned in the same row according to the arrangement position information;
obtaining the height information of the plurality of target cells according to the arrangement line number information; and
and obtaining the cell coordinate information according to the arrangement position information and the height information.
5. The method of claim 4, wherein the obtaining the height information of the plurality of target cells according to the arrangement line number information includes:
ordering the arrangement line number information of the plurality of target cells to obtain an ordering result; and
and obtaining the height information according to the sequencing result.
6. The method of claim 1, wherein the text layout information includes layout information of text in a cell, text size information, and line feed identification information of text in a cell, and the obtaining text coordinate information according to the text layout information and the cell coordinate information includes:
determining a target strategy according to the arrangement mode information;
obtaining the arrangement line number information of the characters in the unit cells according to the line feed identification information; and
based on the target strategy, the text coordinate information is obtained according to the unit cell coordinate information, the text size information, the arrangement mode information and the arrangement line number information.
7. The method of claim 6, wherein the text size information includes text height information and text width information, the obtaining the text coordinate information based on the target policy from the cell coordinate information, the text size information, the arrangement information, and the arrangement number information includes:
obtaining character abscissa information according to the cell coordinate information, the character width information and the arrangement mode information;
Based on the target strategy, acquiring text ordinate information according to the cell coordinate information, the text height information and the arrangement line number information; and
and obtaining the text coordinate information according to the text abscissa information and the text ordinate information.
8. The method of claim 7, wherein the obtaining text abscissa information according to the cell coordinate information, the text width information, and the arrangement information includes:
according to the arrangement mode information, determining offset parameter information of the characters in the horizontal direction; and
and obtaining the text abscissa information according to the offset parameter information, the text width information and the cell coordinate information.
9. The method of claim 8, wherein the cell coordinate information includes left vertex coordinate information and right vertex coordinate information, the obtaining the text abscissa information based on the offset parameter information, the text width information, and the cell coordinate information includes:
obtaining cell width information according to the left vertex coordinate information and the right vertex coordinate information;
Under the condition that the arrangement mode information is determined to be aligned in the middle, acquiring the character abscissa information according to the left vertex coordinate information, the cell width information and the character width information;
under the condition that the arrangement mode information is determined to be left side alignment, acquiring the text abscissa information according to the left vertex coordinate information and the offset parameter information; and
and under the condition that the arrangement mode information is right side alignment, acquiring the character abscissa information according to the right vertex coordinate information, the character width information and the offset parameter information.
10. The method of claim 7, wherein the cell coordinate information includes upper left vertex coordinate information of a cell, the obtaining text ordinate information based on the target policy according to the cell coordinate information, the text height information, and the arrangement line number information includes:
obtaining minimum cell height information according to the cell coordinate information; and
and obtaining the ordinate information of the characters according to the coordinate information of the upper left vertex, the height information of the minimum cell, the height information of the characters and the information of the number of rows of arrangement.
11. The method of claim 10, wherein the arrangement line number information includes arrangement line number information of characters in a cell and maximum arrangement line number information of characters in a plurality of cells of the same line; the obtaining the text ordinate information according to the upper left vertex coordinate information, the minimum cell height information, the text height information and the arrangement line number information comprises the following steps:
under the condition that the arrangement mode information is determined to be top aligned, acquiring the text ordinate information according to the upper left vertex coordinate information, the minimum cell height information, the text height information and the maximum arrangement line number information; and
and under the condition that the arrangement mode information is determined to be aligned in the middle or aligned at the bottom, acquiring the ordinate information of the characters according to the coordinate information of the top left vertex, the height information of the minimum cell, the height information of the characters, the information of the number of rows of the characters in the cell and the information of the maximum number of rows of the characters.
12. The method of claim 1, wherein the generating a target form and annotation data corresponding to the target form from the cell coordinate information, the text coordinate information, and the text content information comprises:
Determining a target cell according to the text content information;
filling the text content information into a target cell according to the text coordinate information;
arranging the target cells on the target page according to the cell coordinate information to generate the target table; and
and processing the cell coordinate information, the text coordinate information and the text content information according to a preset data format to obtain the labeling data.
13. The method of claim 1, further comprising:
obtaining a linear template of a table frame; and
and constructing frame lines on the target table according to the table frame line type template and the cell coordinate information to obtain a first table image.
14. The method of claim 13, further comprising:
acquiring a seal material image set;
randomly selecting a target seal image from the seal material image set; and
and processing the target seal image and the first form image to obtain a second form image.
15. The method of claim 14, wherein the processing the target stamp image and the first form image to obtain a second form image comprises:
Cutting the target seal image to obtain a local seal image;
deleting the background color in the local seal image to obtain a target local seal image; and
and processing the target local seal image and the first form image to obtain a second form image.
16. The method of claim 15, wherein the processing the target partial stamp image and the first form image to obtain a second form image comprises:
the target local seal image and the first form image are fused, so that a form image with the target local seal is obtained; and
and carrying out filtering treatment on the form image with the target local seal to obtain the second form image.
17. A form generation apparatus comprising:
the first acquisition module is used for acquiring text content information and layout information of a target page, wherein the layout information of the target page comprises page parameter information, cell layout information and text layout information;
the first obtaining module is used for obtaining the cell coordinate information according to the page parameter information, the cell layout information and the text layout information;
The second obtaining module is used for obtaining the text coordinate information according to the text layout information and the cell coordinate information; and
and the generating module is used for generating a target table and marking data corresponding to the target table according to the cell coordinate information, the text coordinate information and the text content information.
18. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-16.
19. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-16.
20. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-16.
CN202310172183.4A 2023-02-16 2023-02-16 Table generating method, device, electronic device and storage medium Pending CN116311300A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310172183.4A CN116311300A (en) 2023-02-16 2023-02-16 Table generating method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310172183.4A CN116311300A (en) 2023-02-16 2023-02-16 Table generating method, device, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN116311300A true CN116311300A (en) 2023-06-23

Family

ID=86814312

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310172183.4A Pending CN116311300A (en) 2023-02-16 2023-02-16 Table generating method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN116311300A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116757886A (en) * 2023-08-16 2023-09-15 南京尘与土信息技术有限公司 Data analysis method and analysis device
CN119150799A (en) * 2024-11-12 2024-12-17 西安葡萄城软件有限公司 Method and device for performing text rotation on front-end assembly
CN119338950A (en) * 2024-12-18 2025-01-21 数族科技(南京)股份有限公司 Image generation method, device, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001109843A (en) * 1999-10-12 2001-04-20 Oki Electric Ind Co Ltd Method and device for character recognition
CN113343866A (en) * 2021-06-15 2021-09-03 杭州数梦工场科技有限公司 Identification method and device of form information and electronic equipment
KR20210140844A (en) * 2020-05-14 2021-11-23 지의소프트 주식회사 Table data storing system and method on the electronic document
CN114898387A (en) * 2022-05-23 2022-08-12 北京百度网讯科技有限公司 Table image processing method and device
CN115688721A (en) * 2023-01-03 2023-02-03 深圳鲲云信息科技有限公司 Table generation method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001109843A (en) * 1999-10-12 2001-04-20 Oki Electric Ind Co Ltd Method and device for character recognition
KR20210140844A (en) * 2020-05-14 2021-11-23 지의소프트 주식회사 Table data storing system and method on the electronic document
CN113343866A (en) * 2021-06-15 2021-09-03 杭州数梦工场科技有限公司 Identification method and device of form information and electronic equipment
CN114898387A (en) * 2022-05-23 2022-08-12 北京百度网讯科技有限公司 Table image processing method and device
CN115688721A (en) * 2023-01-03 2023-02-03 深圳鲲云信息科技有限公司 Table generation method and device, electronic equipment and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116757886A (en) * 2023-08-16 2023-09-15 南京尘与土信息技术有限公司 Data analysis method and analysis device
CN116757886B (en) * 2023-08-16 2023-11-28 南京尘与土信息技术有限公司 Data analysis method and analysis device
CN119150799A (en) * 2024-11-12 2024-12-17 西安葡萄城软件有限公司 Method and device for performing text rotation on front-end assembly
CN119150799B (en) * 2024-11-12 2026-02-03 西安葡萄城软件有限公司 Method and device for performing text rotation on front-end assembly
CN119338950A (en) * 2024-12-18 2025-01-21 数族科技(南京)股份有限公司 Image generation method, device, electronic device and storage medium

Similar Documents

Publication Publication Date Title
US10984295B2 (en) Font recognition using text localization
US10699166B2 (en) Font attributes for font recognition and similarity
CN116311300A (en) Table generating method, device, electronic device and storage medium
CN114155543A (en) Neural network training method, document image understanding method, apparatus and device
CN114092948B (en) A bill identification method, device, equipment and storage medium
CN115130989A (en) Method, device and equipment for auditing service document and storage medium
US11881044B2 (en) Method and apparatus for processing image, device and storage medium
US20240296691A1 (en) Image reading systems, methods and storage medium for performing geometric extraction
CN115546815A (en) Table identification method, device, equipment and storage medium
CN113762109B (en) Training method of character positioning model and character positioning method
US11341760B2 (en) Form processing and analysis system
CN115481599A (en) Document processing method and device, electronic equipment and storage medium
CN117520343A (en) Information extraction methods, servers and storage media
EP4495804A2 (en) Image based human-computer interaction method and apparatus, device, and storage medium
EP4647955A1 (en) Portable document format (pdf) document processing method, apparatus, electronic device, and storage medium
WO2025107898A1 (en) Document processing method and apparatus, content generation method and apparatus, and electronic device
JP7430219B2 (en) Document information structuring device, document information structuring method and program
EP4290482A1 (en) Method and apparatus of processing text, electronic device, storage medium and program product
CN112861504A (en) Text interaction method, device, equipment, storage medium and program product
CN118552969A (en) Image detection method, image recognition method, device, electronic device, storage medium and program product based on large language model
CN116777734A (en) Background penetration image generation method, device, equipment and storage medium
CN113762223B (en) Question splitting model training method, question splitting method and related device
CN114282517B (en) Document processing method, device, electronic device and storage medium
JP2023047180A (en) Information processing device and information processing program
US11600028B1 (en) Semantic resizing of line charts

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination