A Semi-structured Document Recognition Method Based on Pattern Recognition

Through the method of pattern recognition, the tree data structure and anchor map are constructed, which solves the problem of semi-structured document recognition and conversion, and improves the accuracy of information extraction and the speed of document entry.

CN114038001BActive Publication Date: 2025-03-11SHANGHAI HUIHANG JIEXUN NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111324189.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-10
Publication Date
2025-03-11
Estimated Expiration
2041-11-10

AI Technical Summary

Technical Problem

The prior art is difficult to effectively identify and convert semi-structured documents with high differences, making it difficult to quickly enter into computer systems and slow entry speed.

Method used

Using a pattern recognition-based method, by converting semi-structured documents into pictures, extracting text and their spatial coordinate features, constructing anchor maps and tree data structures, creating document templates, and then extracting and matching document information.

Benefits of technology

It improves the accuracy and generalization ability of document information extraction, can customize templates, adapt to documents in different formats, and improves the speed of support for new types of documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114038001B_ABST
    Figure CN114038001B_ABST
Patent Text Reader

Abstract

The present invention provides a semi-structured document recognition method based on pattern recognition, including: converting a semi-structured document into a picture, obtaining text information and the coordinates of the text; using the position of the key information of the semi-structured document as an anchor point to construct an anchor point graph; establishing a tree data structure of an upper-lower tree and a left-right tree, and establishing a document template; performing pattern matching, matching a new semi-structured document with the anchor point information in the upper-lower tree and the left-right tree; performing information extraction, and converting the semi-structured information into structured information. The present invention combines the tree data structure with the pattern recognition method to extract document information, thereby improving the accuracy of document information extraction and the generalization ability of recognition; having semantic generalization ability, and being able to improve the semantic generalization ability of the anchor point itself; being able to customize templates, and improving the ability to cope with documents of different formats, and the speed of supporting documents has been greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of examination computer information processing, and in particular to a semi-structured document recognition method based on pattern recognition. Background Art

[0002] In daily production and life, semi-structured documents are frequently used, such as invoices, supermarket receipts, registration forms, etc. The formats of such documents vary greatly due to different designers, which makes it difficult to convert them into structured data.

[0003] With the development of information technology, data is a treasure that needs to be developed. However, if semi-structured documents cannot be converted into structured data and cannot be entered into computer systems, their value will not be fully developed, which is a waste of resources. Therefore, how to convert unstructured data into structured data has become a hot topic in document information extraction.

[0004] At present, the main ways to solve the above problems at home and abroad are to use rule logic and deep learning. However, the rule logic method has the problems of low recognition accuracy, inability to cope with format changes, and difficulty in maintenance and upgrades in the later stage; the deep learning method has the problems of low accuracy, weak interpretability, and non-deterministic results. In addition, both have the problems of long development cycle and slow support speed for new types of documents. Summary of the invention

[0005] In view of this, the purpose of the present invention is to solve the problem of information extraction from semi-structured documents with large differences, and to solve the problem that the semi-structured documents cannot be quickly entered into a computer system and the entry speed is slow.

[0006] The present invention provides a semi-structured document recognition method based on pattern recognition, comprising the following steps:

[0007] S1. Convert the semi-structured document into an image, extract the text in the semi-structured document from the image, and obtain the spatial coordinate features of the text in the image;

[0008] S2, constructing an anchor graph, taking the position of the key information of the semi-structured document as the anchor point, obtaining the coordinates of four points of a rectangular frame formed by four boundaries of the anchor point, selecting the position of the key information on the image, and forming an anchor graph;

[0009] S3, establishing a tree data structure for the anchor graph of each type of semi-structured document, reading and storing anchor points from top to bottom, establishing hierarchies in a top-to-bottom order, forming a top-to-bottom tree, reading and storing anchor points from left to right, establishing hierarchies in a left-to-right order, forming a left-to-right tree, describing the anchor information of the semi-structured document through the structures of the top-to-bottom tree and the left-to-right tree, and establishing a document template;

[0010] S4. Extract the target information, search and find the anchor points of the four boundaries that determine the target information on the anchor point map, use the positions of the anchor points of the four boundaries to describe the position of the target information, and convert the semi-structured information into structured information.

[0011] Furthermore, the step S4 further includes the following steps:

[0012] S5, searching for an anchor point for the new semi-structured document, and matching the anchor point of the new semi-structured document with the document template, and if the match is successful, it proves that the new semi-structured document corresponds to the structural mode of the document template;

[0013] S6. If the document template is matched successfully, the position of the target information is inferred by using the anchor point under the document template to describe the target information, thereby obtaining the target information;

[0014] If the matching of the document template fails, steps S1-S4 are performed on the new semi-structured document to create a new document template without affecting the existing template.

[0015] Furthermore, the step S2 also includes labeling the anchor points according to the semantic information of the anchor points.

[0016] Furthermore, the key information of step S2 includes semantic information.

[0017] Furthermore, the method of obtaining the coordinates of four points of the rectangular frame formed by the four boundaries of the anchor point in step S2 includes: using a standard tool.

[0018] Furthermore, in the up-down tree of step S3, if there are multiple anchor points at the top, multiple up-down trees are established; if there is only one anchor point at the top, only one up-down tree is established.

[0019] Furthermore, for the left and right trees in step S3, for the leftmost anchor point, if there are multiple anchor points, multiple left and right trees are established, and if there is only one anchor point, one left and right tree is established.

[0020] Furthermore, the new method for searching for anchor points in a semi-structured document includes searching using a dictionary.

[0021] Compared with the prior art, the present invention has the following beneficial effects:

[0022] The present invention combines a tree data structure with a pattern recognition method to extract document information. For matched documents, recognition is accurate, which improves the accuracy of document information extraction and the generalization ability of recognition. The pattern established by the left-right tree and the top-bottom tree can accept the up-down offset and the left-right offset of the anchor point. As long as the up-down relative position and the left-right relative position do not change, the match can be successful. Therefore, there are no excessive requirements for the absolute position of the document anchor point, and only the relative position is required. The present invention has the ability of semantic generalization and is compatible with synonyms, typos, etc. of the anchor point position. Categories can be added to the anchor point, and synonyms and typos belonging to the same category can be replaced with each other, which can improve the semantic generalization ability of the anchor point itself. Templates can be customized to improve the ability to cope with documents of different formats. For documents that cannot be matched, only the anchor point map needs to be marked to establish a template, and the existing templates are not affected, and the speed of supporting documents is greatly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the following detailed description of the preferred embodiment.The drawings are only for the purpose of illustrating the preferred embodiments and are not to be construed as limiting the invention.

[0024] In the attached picture:

[0025] Figure 1 A flow chart of a semi-structured document recognition method based on pattern recognition according to the present invention;

[0026] Figure 2 is an anchor point graph according to an embodiment of the present invention;

[0027] Figure 3 Schematic diagram of a tree data structure according to an embodiment of the present invention.

[0028] Figure 4 This is a flow chart of the present invention for pattern matching a new semi-structured file. DETAILED DESCRIPTION

[0029] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0030] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0031] It should be understood that although the terms first, second, and third may be used in the present disclosure to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0032] The specific implementation steps of the embodiment of the present invention are described below in conjunction with the accompanying drawings:

[0033] The embodiment of the present invention provides a semi-structured document recognition method based on pattern recognition, see Figure 1 As shown, the following steps are included:

[0034] S1. Convert the semi-structured document into an image, extract the text in the semi-structured document from the image, and obtain the spatial coordinate features of the text in the image;

[0035] Specifically, for word, pdf, excel and other file types, there are many ways to convert them into images and obtain text; for images and other files, the text can be directly obtained through the OCR method; the obtained text has coordinates, which correspond to the coordinates on the image;

[0036] S2, constructing an anchor graph, taking the position of the key information of the semi-structured document as the anchor point, obtaining the coordinates of four points of a rectangular frame formed by four boundaries of the anchor point, selecting the position of the key information on the image, and forming an anchor graph;

[0037] Specifically, considering the design of semi-structured documents, which have a certain layout structure, the anchor point is not only the key information itself, but also some blank areas around the key information. These blank areas are together with the key information from the perspective of document spatial layout. Therefore, when marking anchor points, we need to consider the key information string itself and the blank areas together with the key information from the perspective of spatial layout. We need to use both the key information string and the blank areas together with it as anchor points. Figure 2 As shown, after anchoring a document, a Figure 2 Each box in

[0038] Specifically, the anchor points are labeled according to their semantic information;

[0039] The key information includes semantic information;

[0040] The method of obtaining the coordinates of four points of a rectangular frame formed by four boundaries of an anchor point includes: using a standard tool;

[0041] S3. Establish a tree data structure for the anchor graph of each type of semi-structured document, see Figure 3 As shown, the anchor points are read and stored from top to bottom, and the hierarchy is established in the up-down order to form an up-down tree. The anchor points are read and stored from left to right, and the hierarchy is established in the left-right order to form a left-right tree. The anchor information of the semi-structured document is described by the structures of the up-down tree and the left-right tree to establish a document template.

[0042] Specifically, after the anchor graph is formed, in order to better describe the relationship between anchors, a tree structure is used to read and store these anchors. Among them, the tree from top to bottom: find the top anchor point, if there are multiple anchor points at the top, then establish multiple trees, if there is only one anchor point at the top, then only establish one tree; for the first anchor point at the top, find the anchor point below it, and establish the hierarchy in the order of up and down. If there are horizontal anchor points on the left and right, the horizontal anchor points are in the same layer; according to the above method, establish several up and down trees in sequence; the tree from left to right also uses a similar method. For the leftmost anchor point, if there are multiple, then establish multiple trees, if there is only one, then establish one tree; for the top leftmost anchor point, look to its right, and put it into different layers in sequence according to the left and right relationship of the anchor points; for the vertical anchor points on its right, put them in the same layer; according to the above method, establish several left and right trees in sequence;

[0043] S4, extracting target information, searching and finding anchor points that determine four boundaries of the target information on the anchor point graph, using the positions of the anchor points of the four boundaries to describe the position of the target information, and converting the semi-structured information into structured information;

[0044] Specifically, the four boundaries of the target information can be described according to the anchor points. Figure 2 The blue box in the figure is the target information, and the position of each blue box can be described according to the position of the red box;

[0045] After the S4 step, see Figure 4 As shown, the following steps are also included:

[0046] S5, searching for an anchor point for the new semi-structured document, and matching the anchor point of the new semi-structured document with the document template, and if the match is successful, it proves that the new semi-structured document corresponds to the structural mode of the document template;

[0047] Specifically, for a new semi-structured document, it is also necessary to first obtain its images, texts, and spatial coordinates of the texts, and then obtain the anchor points in the semi-structured document; thereby obtaining the anchor point map of the new document; and then use these anchor points to match the up-down tree and left-right tree of the document template. When matching, the up-down tree requires that different layers have up-down relationships, and the left-right tree requires that different layers have left-right relationships;

[0048] The new method for finding anchor points in semi-structured documents includes searching using a dictionary;

[0049] S6. If the document template is matched successfully, the position of the target information is inferred by using the anchor point under the document template to describe the target information, thereby obtaining the target information;

[0050] If the matching of the document template fails, steps S1-S4 are performed on the new semi-structured document to create a new document template without affecting the existing template.

[0051] The present invention combines a tree data structure with a pattern recognition method to extract document information. For matched documents, recognition is accurate, which improves the accuracy of document information extraction and the generalization ability of recognition. The pattern established by the left-right tree and the top-bottom tree can accept the up-down offset and the left-right offset of the anchor point. As long as the up-down relative position and the left-right relative position do not change, the match can be successful. Therefore, there are no excessive requirements for the absolute position of the document anchor point, and only the relative position is required. The present invention has the ability of semantic generalization and is compatible with synonyms, typos, etc. of the anchor point position. Categories can be added to the anchor point, and synonyms and typos belonging to the same category can be replaced with each other, which can improve the semantic generalization ability of the anchor point itself. Templates can be customized to improve the ability to cope with documents of different formats. For documents that cannot be matched, only the anchor point map needs to be marked to establish a template, and the existing templates are not affected, and the speed of supporting documents is greatly improved.

[0052] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make the same changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

[0053] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, replacement, and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A semi-structured document recognition method based on pattern recognition, characterized in that: The following steps are involved: S1. Convert the semi-structured document into an image, extract the text in the semi-structured document from the image, and obtain the spatial coordinate features of the text in the image; S2, constructing an anchor graph, taking the position of the key information of the semi-structured document as the anchor point, obtaining the coordinates of four points of a rectangular frame formed by four boundaries of the anchor point, selecting the position of the key information on the image, and forming an anchor graph; The key information includes semantic information; S3, establishing a tree data structure for the anchor graph of each type of semi-structured document, reading and storing anchor points from top to bottom, establishing hierarchies in a top-to-bottom order, forming a top-to-bottom tree, reading and storing anchor points from left to right, establishing hierarchies in a left-to-right order, forming a left-to-right tree, describing the anchor information of the semi-structured document through the structures of the top-to-bottom tree and the left-to-right tree, and establishing a document template; S4, extracting target information, searching and finding anchor points that determine four boundaries of the target information on the anchor point graph, using the positions of the anchor points of the four boundaries to describe the position of the target information, and converting the semi-structured information into structured information; S5, searching for an anchor point for the new semi-structured document, and matching the anchor point of the new semi-structured document with the document template; S6. If the document template is matched successfully, the position of the target information is inferred by using the anchor point under the document template to describe the target information, thereby obtaining the target information; If the matching of the document template fails, steps S1-S4 are performed on the new semi-structured document to create a new document template.

2. The semi-structured document recognition method according to claim 1, characterized in that: The step S2 further includes labeling the anchor points according to the semantic information of the anchor points.

3. The semi-structured document recognition method according to claim 1, characterized in that: The method for obtaining the coordinates of the four points of the rectangular frame formed by the four boundaries of the anchor point in step S2 includes: using a standard tool.

4. The semi-structured document recognition method according to claim 1, characterized in that: The up-down tree in step S3, if there are multiple anchor points at the top, multiple up-down trees are established; if there is only one anchor point at the top, only one up-down tree is established.

5. The semi-structured document recognition method according to claim 1, characterized in that: For the left and right trees in step S3, for the leftmost anchor point, if there are multiple anchor points, multiple left and right trees are established; if there is only one anchor point, one left and right tree is established.

6. The semi-structured document recognition method according to claim 1, characterized in that: The new method for searching anchor points in semi-structured documents includes searching in a dictionary manner.

Citation Information

Patent Citations

  • Text information extraction method and device combining RPA with AI, equipment and medium

    CN111898381A

  • Laboratory test report identification method and identification device

    CN111931750A