Structured information extraction method, system and medium based on adaptive spatial metric
Through the adaptive spatial measurement method combined with the text box position information of the text recognition results, the transferability and accuracy of the information extraction method in the prior art is solved, and more efficient structured information extraction is achieved, which is suitable for diversified text recognition Scene.
Patent Information
- Application Number
- CN202410203859.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-23
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-02-23
AI Technical Summary
The existing structured information extraction method is coupled with specific text recognition methods, which reduces the transferability of the algorithm and does not fully utilize the spatial location information of the text, resulting in inaccurate extraction results in unclear keywords and diverse information scenarios. Traditional template matching methods lead to matching errors due to excessive labeling information.
Using a structured information extraction method based on adaptive spatial measurement, the position information of annotated keywords is constructed through offline templates, and the moving distance of the text box is calculated based on the text recognition results. The adaptive spatial measurement method is used to match keywords and corresponding values, reducing the The impact of complex information on templates.
It improves the accuracy and transferability of information extraction, and is suitable for any text recognition algorithm with certain recognition accuracy. It has higher recognition accuracy and faster speed, reducing the impact of template annotation on the final matching result.
Smart Images

Figure CN118036597B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular to a structured information extraction method, system and medium based on adaptive spatial metric. Background Art
[0002] With the increasing application of text recognition in recent years, the research on relation extraction methods for structured document recognition has gradually attracted the attention and exploration of more and more scholars, but there are still many problems to be solved. First of all, from the perspective of the commonly used structured information extraction methods, most of the information extraction methods are coupled with specific text recognition methods, which to a certain extent reduces the transferability of the algorithm; secondly, most information extraction algorithms only consider the content information of the text recognition results, and do not fully utilize the spatial location information of the text, which may lead to inaccurate extraction results in some scenarios where keywords are unclear, characters are not accurately recognized, and information types are diverse; finally, the traditional template matching method often tries to annotate more prior information as much as possible. Although this can add more prior references, it may also affect each other due to the excessive annotation information in the template, resulting in the final key information matching error.
[0003] Therefore, it is necessary to develop a new structured information extraction method, system and medium based on adaptive spatial metric. Summary of the invention
[0004] The purpose of the present invention is to provide a structured information extraction method, system and medium based on adaptive spatial metrics, which can not only extract key information of user concern from messy text lines, but also can be widely applied to any text recognition algorithm with a certain recognition accuracy, has high transferability, and can greatly improve the accuracy of information extraction.
[0005] In a first aspect, a method for extracting structured information based on adaptive spatial metrics according to the present invention comprises the following steps:
[0006] Offline template construction: the location information of the keyword is marked in the template. The marked template is a set K containing element k, where element k includes the keyword and text box coordinate group information;
[0007] Text recognition: Perform text recognition on the document image to be processed to obtain a set S containing elements s, where the element s includes a string and text box position information;
[0008] Keyword extraction: For each element s in the set S, calculate the minimum number of units required to move the text box corresponding to the element s to overlap with the text box corresponding to the keyword i in the template, denoted as D 1i, where i is 1, 2, ..., m, and m is the number of tagged keywords in the template. Find D 1i The keyword x with the smallest value; determine whether the string of element s contains the keyword x to be identified. If so, store [x, sx, s's position information] as element r in the result set R, where sx represents the remaining string after removing the keyword x from the string of element s. Otherwise, store [s, s's position information] as element c in the candidate set C.
[0009] Corresponding value reconstruction: For all elements c in the candidate set C, the text box corresponding to the calculated element c is moved to the element r in the result set R. j The minimum number of units that need to be moved when the corresponding text boxes are adjacent is recorded as D 2j , where j is 1, 2, ..., n, and n is the number of elements r in the result set R. Find D 2j Take the element r with the smallest value and add the string of element c to the position of the "value" of element r.
[0010] Optionally, when constructing an offline template, element k is defined as [keyword, text box coordinate group, type of value corresponding to the keyword];
[0011] After completing the corresponding value reconstruction, type checking and correction are also performed, specifically:
[0012] According to the type of the value corresponding to the keyword, filter out the elements r in the result set R whose keywords do not match the types of the values corresponding to the keywords.
[0013] Optionally, the D 1i The calculation formula is as follows:
[0014] D 1i (A,B)=α(A,B)·min(|A x1 -B x1 |,|A x2 -B x2 |)+min(|A y1 -B y1 |,|A y2 -B y2 |)
[0015] Where: A represents the text box corresponding to the keyword i in the template; B represents the text box corresponding to the element s; (A x1 ,A y1 ) represents the coordinates of the upper left corner of text box A; (A x2 ,A y2 ) represents the coordinates of the lower right corner of text box A; (B x1 ,B y1) represents the coordinates of the upper left corner of text box B, (B x2 ,B y2 ) represents the coordinate of the lower right corner of text box B; α(A,B) represents the relative position of text box A and text box B.
[0016] Optionally, the D 2j The calculation formula is as follows:
[0017] D 2j (E, F) = α(E, F) min(|E x1 -F x1 |,|E x1 -F x2 |,|E x2 -F x2 |,|E x2 -F x1 |)+min(|E y1 -F y1 |,|E y1 -F y2 |,|E y2 -F y1 |,|E y2 -F y2 |)
[0018] Where: E represents element r j The corresponding text box; F represents the text box corresponding to element c; (E x1 ,E y1 ) represents the coordinates of the upper left corner of the text box E; (E x2 ,E y2 ) represents the coordinates of the lower right corner of the text box E; (F x1 ,F y1 ) represents the coordinates of the upper left corner of the text box F, (F x2 ,F y2 ) represents the coordinate of the lower right corner of text box F; α(E,F) represents the relative position of text box E and text box F.
[0019] Optionally, the calculation method of α(A, B) is as follows:
[0020]
[0021] Among them, k1 is the scale parameter. If A x1 >B x1 , it means that text box A is on the right side of text box B. If A x1 x1 , it means that text box A is on the left side of text box B.
[0022] Optionally, the calculation method of α(E, F) is as follows:
[0023]
[0024] Among them, k1 is the scale parameter. If E x1 >F x1 , it means that text box E is on the right side of text box F. If E x1 <F x1 , it means that text box E is on the left side of text box F.
[0025] Optionally, before performing keyword extraction, each element s in the set S is sorted according to the “text box position” in a left-to-right and top-to-bottom order.
[0026] Optionally, add the string of element c to the "value" position of element r, as follows:
[0027] Extend the string of element c to the end of the "value" of element r, and at the same time overwrite the "position information" of element c with the "position information" of element r.
[0028] Optionally, it is determined whether the character string of the element s contains the keyword x to be identified, specifically:
[0029] The edit distance between keyword x and element s is calculated. If the edit distance is less than a preset threshold, it is considered that the character string of element s contains the keyword x to be identified. Otherwise, it is considered that the character string of element s does not contain the keyword x to be identified.
[0030] In the second aspect, a structured information extraction system based on adaptive spatial metric described in the present invention adopts a memory and a controller, wherein the memory stores a computer-readable program, and when the computer-readable program is called by the controller, it can execute the steps of the structured information extraction method based on adaptive spatial metric described in the present invention.
[0031] In a third aspect, a medium according to the present invention stores a computer-readable program, and when the computer-readable program is called by a controller, it can execute the steps of the structured information extraction method based on adaptive spatial metric according to the present invention.
[0032] The beneficial effects of the present invention are as follows: First, the present method can be widely applied to any text recognition algorithm with a certain accuracy, and the structured relationship extraction of the recognition results containing relative position and content is performed; second, the present method proposes an adaptive spatial measurement method based on template matching, which can combine the position information of the text box and adaptively give similarity measurement according to the distance and direction between the text boxes, so as to further improve the accuracy of structured information extraction; finally, in the process of template annotation, the present application only annotates keywords in the template, and designs a special measurement method for matching the content of its corresponding value, which effectively improves the influence of too much annotation information in the template on the accuracy of the final matching result. The present method is mainly used for the recognition of key information of cards and documents. Compared with the traditional structured method, the recognition accuracy is more accurate and the recognition speed is faster. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a flowchart of the structured information extraction method based on adaptive spatial metric described in an embodiment of the present application;
[0034] Figure 2 A schematic diagram of a template in an embodiment of the present application;
[0035] Figure 3 This is a principle block diagram of a structured information extraction system based on adaptive spatial metric in an embodiment of the present application. DETAILED DESCRIPTION
[0036] The following will refer to the accompanying drawings and preferred embodiments to illustrate the implementation of the technical solution of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific implementations, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.
[0037] like Figure 1 As shown, in an embodiment of the present application, a method for extracting structured information based on adaptive spatial metrics includes the following steps:
[0038] Step 1: Offline template construction;
[0039] Offline template construction is mainly aimed at the text type to be extracted, and the location information of each keyword is marked. The marked template is a set K containing element k, where element k includes keyword and text box coordinate group information.
[0040] In the embodiment of the present application, element k is a triplet of the form [keywords: text box coordinate group, other information]. The function of the text box coordinate group is to determine the position of a text box, so at least two points of coordinates are required. For example: the position of the text box uses [x1, y1, x2, y2] to represent the coordinates of the upper left corner and lower right corner of the text box respectively.
[0041] like Figure 2 As shown below, the ID card is used as an example for explanation. The pixel coordinates of keywords such as "name", "gender" and "nationality" need to be marked in the ID card. If the size of the template image is height (h): 400 pixels; width (w): 600 pixels, the pixel coordinates of a point in the text box where the keyword "name" is located are (50, 70), then the normalized coordinates are calculated as (w, h) = (50 / 600, 70 / 400) = (0.083, 0.175), and the coordinates of other keywords can be calculated in the same way.
[0042] In an embodiment of the present application, after calculating the positions of each marked keyword, the type of the corresponding "value" can also be marked in the template according to the type of each key-value pair. For example, "name" can only be text, and "citizen identification number" can only be numbers except for the last digit.
[0043] Since the template position matching is mainly performed based on distance measurement in the embodiment of the present application, templates with too dense annotations may introduce deviations in subsequent information extraction. Therefore, only the positions of the keywords are marked in the template, and the positions of the corresponding values of the keywords are no longer marked.
[0044] Step 2: Text recognition;
[0045] Text recognition is performed on the document image to be processed, and the result of the text recognition is a set S containing an element s, where the element s is a tuple of [string, text box position].
[0046] Before keyword extraction, the elements s in the set S are sorted from left to right and from top to bottom according to the “text box position”.
[0047] In an embodiment of the present application, after completing the text recognition and sorting described in step 2, the next step will be divided into two steps, namely the keyword extraction described in step 3 and the corresponding value reconstruction described in step 4. The purpose of these two steps is mainly to refer to the pre-built template to determine the position and content of the keyword and the corresponding value. The most critical issue is what measurement method to use for template matching between the two.
[0048] In the embodiment of the present application, an adaptive spatial measurement method based on template matching is proposed. The measurement method is improved based on the classic Manhattan distance. It mainly optimizes the traditional distance measurement method by focusing on the distribution characteristics of keywords and corresponding values and combining the corresponding relationship between the two. The advantage of this measurement method is that it can refer to the direction relationship and distance relationship of any two text boxes, adaptively give a relative distance score, and automatically and efficiently filter out some results with similar distances but wrong directions between text boxes in the process of template matching based on the distance score. This measurement method is based on the constructed offline template annotation information and the distribution characteristics of keywords and corresponding values, and respectively designs definition D suitable for the keyword extraction and corresponding value reconstruction steps. 1i and D 2j Among them, D 1i It is used to represent the minimum number of units required to move two text boxes to overlap. It is mainly used for keyword position matching in the subsequent keyword extraction step. The design principle is that the text boxes marked in the template built in step 1 only contain "keyword" information, so the "keyword" position information in the template can be directly referenced. The one-to-one corresponding keyword position in the recognition result can be confirmed by the simple relative distance between the text boxes. 2j It is used to represent the minimum number of units required to move two text boxes to adjacent locations. It is mainly used for position matching of corresponding values in the subsequent corresponding value reconstruction step. The reason for using this measurement method is that the area corresponding to the keyword value is generally near the keyword area, so the corresponding value can be located by finding the text box closest to the keyword. This measurement method uses D 1i and D 2j The advantage of using PHP to match keywords and values is that it can simplify the content of the template and reduce the impact of complex information in the template.
[0049] Step 3: Keyword extraction;
[0050] In keyword extraction, for each element s in the sorted set S, calculate the minimum number of units required to move the text box corresponding to element s to overlap with the text box corresponding to keyword i in the template, that is, D 1i , where i is 1, 2, ..., m, and m is the number of tagged keywords in the template. Find D 1i Take the keyword x with the smallest value; calculate the edit distance between keyword x and element s. If the edit distance is less than the preset threshold, it is considered that the character string of element s contains the keyword x to be identified, and [x, sx, s's position information] is stored as element r in the result set R, where: sx represents the remaining character string after removing keyword x from the character string of element s; otherwise, [s, s's position information] is stored as element c in the candidate set C.
[0051] In this embodiment, the edit distance is an indicator used to measure the degree of difference between two strings. It defines the minimum number of edit operations required to convert a string into a target string. These edit operations include insertion, deletion, and substitution, where:
[0052] Insert: Insert a character into the source string.
[0053] Delete: Delete a character from the source string.
[0054] Replace: Replace a character in the source string with a character in the target string.
[0055] After this step, two sets will be obtained, namely the result set R and the candidate set C.
[0056] The result set R stores the recognized keywords and the location information of the keywords, and may also contain recognized values. For example, if a string is "Name Zhang San", after the above process, the result set R will store an element of [name, Zhang San, location information]. If the recognition result is that "name" and "Zhang San" are divided into two strings, the result set R will store [name, location information], and the candidate set C will store an element of [Zhang San, location information].
[0057] In the present application embodiment, the D 1i The calculation formula is as follows:
[0058] D 1i (A,B)=α(A,B)·min(|A x1 -B x1 |,|A x2 -B x2 |)+min(|A y1 -B y1 |,|A y2 -B y2 |)
[0059] Where: A represents the text box corresponding to the keyword i in the template; B represents the text box corresponding to the element s; (A x1 ,A y1 ) represents the coordinates of the upper left corner of text box A; (A x2 ,A y2 ) represents the coordinates of the lower right corner of text box A; (B x1 ,B y1 ) represents the coordinates of the upper left corner of text box B, (B x2 ,B y2 ) represents the coordinate of the lower right corner of text box B; α(A,B) represents the relative position of text box A and text box B.
[0060] In most structured information, keywords are often on the right side of the value. Therefore, different metric scores need to be given to targets of the same distance in different directions in the distance metric. In the embodiment of the present application, an adjusted exponential function is used to restrict text boxes from different directions. The calculation method of α(A, B) is as follows:
[0061]
[0062] Among them, if A x1 >B x1 , it means that text box A is on the right side of text box B. This situation does not conform to the structure of general structured text. Since the exponential function has a larger growth rate on the positive semi-axis, the final calculated value will be very large, which will amplify the effect of the corresponding term. x1 x1 , it means that text box A is on the left side of text box B. This is consistent with the structure of general structured text. At this time, the value of α(A,B) is close to 1, making the overall calculated distance relatively small. k1 is a scale parameter used to scale the range of α in actual operation. Experimental verification shows that when k1=4, better results are achieved.
[0063] Step 4: Reconstruct the corresponding values;
[0064] The corresponding value reconstruction is mainly based on the result set R and the candidate set C. The actual meaning of the element r in the result set R is: r = [keyword, value, location information]; the meaning expressed by the element c in the candidate set C is: c = [string, location information].
[0065] For all elements c in the candidate set C, calculate the text box corresponding to element c and move it to the element r in the result set R. j The minimum number of units that need to be moved when the corresponding text boxes are adjacent, that is, D 2j , where j is 1, 2, ..., n, and n is the number of elements r in the result set R. Find D 2j Take the element r with the smallest value and add the string of element c to the position of the "value" of element r.
[0066] In the present application embodiment, the D 2j The calculation formula is as follows:
[0067] D 2j (E, F) = α(E, F) min(|E x1 -F x1 |,|E x1 -F x2 |,|E x2 -Fx2 |,|E x2 -F x1 |)
[0068] +min(|E y1 -F y1 |,|E y1 -F y2 |,|E y2 -F y1 |,|E y2 -F y2 |)
[0069] Where: E represents element r j The corresponding text box; F represents the text box corresponding to element c; (E x1 ,E y1 ) represents the coordinates of the upper left corner of the text box E; (E x2 ,E y2 ) represents the coordinates of the lower right corner of the text box E; (F x1 ,F y1 ) represents the coordinates of the upper left corner of the text box F, (F x2 ,F y2 ) represents the coordinate of the lower right corner of text box F; α(E,F) represents the relative position of text box E and text box F.
[0070] In most structured information, keywords are often on the right side of the value. Therefore, different metric scores need to be given to targets of the same distance in different directions in the distance metric. In the embodiment of the present application, an adjusted exponential function is used to restrict text boxes from different directions. Specifically, the calculation method of α(E, F) is as follows:
[0071]
[0072] Among them, k1 is the scale parameter. If E x1 >F x1 , it means that text box E is on the right side of text box F. This situation does not conform to the structure of general structured text. Since the exponential function has a larger growth rate on the positive semi-axis, the final calculated value will be very large, which will amplify the effect of the corresponding term. x1 <F x1 , it means that text box E is on the left side of text box F. This is consistent with the structure of general structured text. At this time, the value of α(E,F) is close to 1, making the overall calculated distance relatively small. k1 is a scale parameter used to scale the range of α in actual operation. Experimental verification shows that when k1=4, better results are achieved.
[0073] In the embodiment of the present application, the string of the element c is added to the position of the "value" of the element r, specifically:
[0074] If the "value" of element r' is not empty, the string of element c is directly extended to the back of the "value" of element r', and the "position information" of element c is overwritten on the "position information" of element r'. If the "value" of element r' is empty, the string of element c is directly placed at the "value" of element r', and the "position information" of element c is overwritten on the "position information" of element r'.
[0075] For example, if the result set R already has an element r, r = [name, Zhang, location information 1], and there is an element c = [three, location information 2] from the candidate set C, calculate D 2j After the distance, element c is closest to element r, then element r will be modified to [name, Zhang San, location information 2].
[0076] Step 5: Type checking and correction;
[0077] Generally speaking, after completing keyword extraction and value extraction, most of the structured information can be accurately extracted in the form of key-value pairs. However, there are still some relatively difficult information that cannot be extracted due to problems with the detection and recognition algorithm. At this time, the type checking method can be combined for correction to improve the accuracy. For example: in the initial definition of the template, the element k in the template is defined as [keyword, text box coordinate group, other information]. By pre-defining the type of the corresponding value of a certain keyword, some illegal inputs can be filtered out. For example, "name" can only be Chinese characters, and the number of digits of "citizen identification number" is fixed, and only numbers except the last digit. This information can be used to further process each element in the result set R to improve the final accuracy. The result after type checking and correction is the final structured extraction result.
[0078] In addition, for some particularly difficult fields, you can also try to use the template to treat the location of the adjacent fields as the boundary, and accurately search the text box outside the boundary to complete the information extraction. Figure 2 For example, assume that "address" is a difficult information to match. Then you can skip D in step 4. 2j The most recent result of the calculation is the string of "address". In this step, the candidate set C is searched again, and the text box content below "birth" and above "citizen ID number" is added to the "address" column in order to complete the key information extraction.
[0079] like Figure 3As shown, in an embodiment of the present application, a structured information extraction system based on adaptive spatial metrics uses a memory and a controller, wherein the memory stores a computer-readable program, and when the computer-readable program is called by the controller, it can execute the steps of the structured information extraction method based on adaptive spatial metrics as described in the embodiment of the present application.
[0080] In an embodiment of the present application, a medium stores a computer-readable program, and when the computer-readable program is called by a controller, it can execute the steps of the structured information extraction method based on adaptive spatial metric as described in the embodiment of the present application.
[0081] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0082] In the context of the present application embodiment, medium can be a tangible medium, which can contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Medium can be a machine-readable signal medium or a machine-readable storage medium. Medium can include but is not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the above. A more specific example of medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0083] The above-mentioned embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above-mentioned embodiments. Any other changes, modifications, substitutions, combinations and simplifications made without departing from the spirit and principle of the present invention shall be equivalent replacement modes and shall be included in the protection scope of the present invention.
Claims
1. A structured information extraction method based on adaptive spatial metric, characterized in that: The following steps are involved: Offline template construction: the location information of the keyword is marked in the template. The marked template is a set K containing element k, where element k includes the keyword and text box coordinate group information; Text recognition: Perform text recognition on the document image to be processed to obtain a set S containing elements s, where the element s includes a string and text box position information; Keyword extraction: For each element s in the set S, calculate the minimum number of units required to move the text box corresponding to the element s to overlap with the text box corresponding to the keyword i in the template, denoted as D 1i , where i is 1, 2, ..., m, and m is the number of tagged keywords in the template. Find D 1i The keyword x with the smallest value; determine whether the string of element s contains the keyword x to be identified. If so, store [x, sx, s's position information] as element r in the result set R, where sx represents the remaining string after removing the keyword x from the string of element s. Otherwise, store [s, s's position information] as element c in the candidate set C. Corresponding value reconstruction: For all elements c in the candidate set C, the text box corresponding to the calculated element c is moved to the element r in the result set R. j The minimum number of units that need to be moved when the corresponding text boxes are adjacent is recorded as D 2j , where j is 1, 2, ..., n, and n is the number of elements r in the result set R. Find D 2j Take the element r with the smallest value and add the string of the element c to the position of the "value" of the element r; The D 2j The calculation formula is as follows: D 2j (E,F)=α(E,F)·min(|E x1 -F x1 |,|E x1 -F x2 |,|E x2 -F x2 |,|E x2 -F x1 |)+min(|E y1 -F y1 |,|E y1 -F y2 |,|E y2 -F y1 |,|E y2 -F y2 |) Where: E represents element r j The corresponding text box; F represents the text box corresponding to element c; (E x1 ,E y1 ) represents the coordinates of the upper left corner of the text box E; (E x2 ,E y2 ) represents the coordinates of the lower right corner of the text box E; (F x1 ,F y1 ) represents the coordinates of the upper left corner of the text box F, (F x2 ,F y2 ) represents the coordinates of the lower right corner of the text box F; α(E, F) represents the relative position of the text box E and the text box F; the calculation method of α(E, F) is as follows: Among them, k1 is the scale parameter. If E x1 >F x1 , it means that text box E is on the right side of text box F. If E x1 <F x1 , it means that text box E is on the left side of text box F.
2. The method for extracting structured information based on adaptive spatial metrics according to claim 1, characterized in that: When building an offline template, define element k as [keyword, text box coordinate group, type of value corresponding to the keyword]; After completing the corresponding value reconstruction, type checking and correction are also performed, specifically: According to the type of the value corresponding to the keyword, filter out the elements r in the result set R whose keywords do not match the types of the values corresponding to the keywords.
3. The method for extracting structured information based on adaptive spatial metrics according to claim 1, characterized in that: The D 1i The calculation formula is as follows: D 1i (A,B)=α(A,B)·min(|A x1 -B x1 |,|A x2 -B x2 |)+min(|A y1 -B y1 |,|A y2 -B y2 |) Where: A represents the text box corresponding to the keyword i in the template; B represents the text box corresponding to the element s; (A x1 ,A y1 ) represents the coordinates of the upper left corner of text box A; (A x2 ,A y2 ) represents the coordinates of the lower right corner of text box A; (B x1 ,B y1 ) represents the coordinates of the upper left corner of text box B, (B x2 ,B y2 ) represents the coordinate of the lower right corner of text box B; α(A,B) represents the relative position of text box A and text box B.
4. The method for extracting structured information based on adaptive spatial metrics according to claim 3, characterized in that: The calculation method of α(A, B) is as follows: Among them, k1 is the scale parameter. If A x1 >B x1 , it means that text box A is on the right side of text box B. If A x1 x1 , it means that text box A is on the left side of text box B. 5. The method for extracting structured information based on adaptive spatial metrics according to claim 2, characterized in that: Before performing keyword extraction, sort each element s in the set S according to the "text box position" in a left-to-right and top-to-bottom order.
6. The method for extracting structured information based on adaptive spatial metrics according to claim 1, characterized in that: Add the string of element c to the "value" position of element r, specifically: Extend the string of element c to the end of the "value" of element r, and at the same time overwrite the "position information" of element c with the "position information" of element r.
7. The method for extracting structured information based on adaptive spatial metrics according to claim 1, characterized in that: Determine whether the string of element s contains the keyword x to be identified, specifically: The edit distance between keyword x and element s is calculated. If the edit distance is less than a preset threshold, it is considered that the character string of element s contains the keyword x to be identified. Otherwise, it is considered that the character string of element s does not contain the keyword x to be identified.
8. A structured information extraction system based on adaptive spatial metrics, characterized in that: A memory and a controller are used, wherein the memory stores a computer-readable program, and when the computer-readable program is called by the controller, the steps of the structured information extraction method based on adaptive spatial metric as described in any one of claims 1 to 7 can be executed.
9. A medium, characterized in that: A computer-readable program is stored in the memory, and when the computer-readable program is called by the controller, the steps of the structured information extraction method based on adaptive spatial metric as described in any one of claims 1 to 7 can be executed.
