A structured processing method for layout files

Through the analysis and outline recognition of layout files, entity relationship groups are formed and converted into structured data, which solves the problem of incomplete relationship extraction in the existing technology and improves the processing accuracy and management efficiency of layout files.

CN118585573BActive Publication Date: 2024-10-15BEIJING MIRACLES TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411064598.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-10-15
Estimated Expiration
2044-08-05

AI Technical Summary

Technical Problem

In existing layout file structured processing methods, one statement may contain multiple entities and multiple entity-relationship pairs, resulting in incomplete relationship extraction and affecting the accuracy and consistency of processing.

Method used

By parsing the layout file to be processed, image data and semantic data are separated, contour recognition and text extraction are performed, entity relationship groups are formed, and unstructured data is converted into structured data through comparison of the number of real-time groups and the number of standard groups, dynamically Adjust the number of segmentations and boundary points to enhance image edge information.

Benefits of technology

It improves the accuracy and consistency of structured processing of layout files, facilitates data management and analysis, and enhances the accuracy and efficiency of image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118585573B_ABST
    Figure CN118585573B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and in particular to a method for structuring layout files. The method includes importing a layout file to be processed; forming an entity relationship group; forming a corresponding table structure for storage, converting semi-structured data into structured data; and detecting and correcting. The present invention parses imported layout files of various formats to identify semi-structured data in the layout file, converts the semi-structured data into structured data, extracts key information by performing text extraction on the semi-structured data, matches the identified entity with the split image slices, finds the image slices associated with the entity, stores the matched image slices with the text data segment and the corresponding entity relationship as a graph structure, and clearly represents the relationship between the text data segment, entity, entity relationship and the associated image slices through the graph structure, facilitates further analysis and query, and improves the management and analysis efficiency of data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a format file structured processing method. Background Art

[0002] The content information of layout files includes text, graphics, images, etc. The specific arrangement of the position, direction, size, color, shape, etc. of these content elements are stored in the file. The content presentation in the file does not change with different environments, so the layout effect and number of pages of the file content are fixed. OFD and PDF are both typical layout document formats. By performing text recognition, information extraction and data integration on layout files, scattered information can be integrated into structured data for easy management and analysis. How to improve the accuracy and consistency of data processing has become a hot topic for relevant researchers.

[0003] The patent document with publication number CN118095205A discloses a method, device, equipment and storage medium for extracting information from a layout file, the method comprising: receiving an extraction request sent by a terminal device, the extraction request including information about a target layout file to be processed and a layout type of the target layout file, the target layout file being a file with a fixed typesetting mode; determining a target field library corresponding to the target layout file according to the layout type information of the target layout file, the target field library including the target field to be extracted; extracting information from the target layout file according to the target field to be extracted in the target field library, obtaining structured field information corresponding to the target layout file, the structured field information including the target field to be extracted and text data corresponding to the target field extracted from the target layout file; sending the structured field information to the terminal device; it can be seen that, since a sentence in the existing text data processing may contain multiple entities corresponding to multiple entity relationship pairs, the problem of incomplete relationship extraction occurs, and it is difficult to ensure the effectiveness and accuracy of the layout file structured processing method. Summary of the invention

[0004] To this end, the present invention provides a layout file structured processing method to overcome the problem of incomplete relationship extraction in the prior art due to the fact that a sentence may contain multiple entities and correspond to multiple entity relationship pairs, resulting in low accuracy of the layout file structured processing method.

[0005] To achieve the above object, the present invention provides a method for structuring a layout file, comprising:

[0006] Importing a layout file to be processed, parsing the layout file to be processed to obtain semi-structured data in the layout file to be processed, and obtaining original data;

[0007] The original data is divided into image data and semantic data, contour recognition is performed on the image data to obtain a target image slice, and text extraction is performed on the semantic data to obtain original text data;

[0008] Preprocessing the original text data to obtain intermediate text data;

[0009] Using a period as an identifier, the intermediate text data is divided into a plurality of sentences to be processed, and keyword extraction and attribute extraction are performed on each of the sentences to be processed, so as to form a plurality of entity relationship groups according to the extraction results;

[0010] Matching the entity with each of the target image slices to obtain associated image slices, obtaining the number of entity relationship groups corresponding to each of the entities in any of the sentences to be processed as the corresponding real-time group number;

[0011] The number of standard groups is compared with the number of real-time groups, and a corresponding table structure is formed according to the comparison result for storage, so as to convert the unstructured data in the original layout file into structured data;

[0012] When the number of real-time groups is greater than the number of standard groups, and the number of real-time entities is greater than the number of standard entities, the entities, the association relationship groups corresponding to the entities, and the associated image slices are connected to form a corresponding table structure;

[0013] Calculate the semantic similarity between the statement to be processed and the next adjacent statement to be processed. When the semantic similarity is greater than or equal to the standard similarity, merge the statement to be processed with the next adjacent statement to be processed, and stop when the semantic similarity is less than the standard similarity to form a combined statement to be processed. Obtain the target image slice that matches the combined statement to be processed as the detection image slice, calculate the real-time overlap rate between the detection image slice and the original associated image slice corresponding to the combined statement to be processed, compare the standard overlap rate with the real-time overlap rate, and determine whether to correct the standard number of segmentations to the corrected number of segmentations according to the comparison result.

[0014] Further, performing contour recognition on the image data includes:

[0015] Split any original image into several original image slices according to the standard number of segmentations;

[0016] Performing contour recognition on a graphic in any of the original image slices to adjust the original grayscale value of the graphic to a target grayscale value, thereby obtaining an intermediate image slice;

[0017] Identifying the correction boundary points in the intermediate image slice, and correcting the original graphic contour having the correction boundary points to obtain the corrected graphic contour;

[0018] The original image contour and the modified image contour are subjected to edge fusion processing to obtain the target image slice.

[0019] Further, adjusting the original grayscale value of the graphic to a target grayscale value includes:

[0020] Recording the grayscale value of each pixel in the original image slice within the original graphic outline as a first actual grayscale value, and recording the grayscale value of each pixel in the original image slice outside the original graphic outline as a second actual grayscale value;

[0021] Obtaining an average value of the first actual grayscale values ​​as a first average inner contour grayscale value, and obtaining an average value of the second actual grayscale values ​​as a first average outer contour grayscale value;

[0022] Obtaining the average grayscale value corresponding to the pixel point whose first actual grayscale value is less than the average grayscale value inside the contour as the second average grayscale value inside the contour, and obtaining the average grayscale value corresponding to the pixel point whose second actual grayscale value is less than the average grayscale value outside the contour as the second average grayscale value outside the contour;

[0023] Obtaining the average grayscale value corresponding to the pixel point whose first actual grayscale value is greater than the average grayscale value inside the contour as the third average grayscale value inside the contour, and obtaining the average grayscale value corresponding to the pixel point whose actual grayscale value is greater than the average grayscale value outside the contour as the third average grayscale value outside the contour;

[0024] Calculate the square of each average contour inner grayscale value and the corresponding average contour outer grayscale value respectively to obtain the corresponding real-time grayscale difference;

[0025] The grayscale value in each average contour is sequentially added to the corresponding real-time grayscale difference to obtain the target grayscale value;

[0026] Adjusting each original grayscale value of the original image slice to a corresponding target grayscale value;

[0027] Among them, the original grayscale values ​​include the first average contour inner grayscale value, the second average contour inner grayscale value and the third average contour inner grayscale value, the average contour outer grayscale value includes the first average contour outer grayscale value, the second average contour outer grayscale value and the third average contour outer grayscale value, the first average contour inner grayscale value corresponds to the first average contour outer grayscale value, the second average contour inner grayscale value corresponds to the second average contour outer grayscale value, and the third average contour inner grayscale value corresponds to the third average contour outer grayscale value.

[0028] Further, identifying the corrected boundary points in the intermediate image slice includes:

[0029] Acquire the outline pixel points of the original graphic outline in the intermediate image slice as initial boundary points;

[0030] Subtract each of the initial boundary points from the corresponding adjacent pixel points outside the original graphic contour to obtain a number of real-time gradient values;

[0031] The real-time gradient values ​​are judged in turn according to the standard gradient values, and the current initial boundary point is corrected according to the judgment result.

[0032] Further, determining to correct the current initial boundary point according to the determination result includes:

[0033] If any real-time gradient value is less than or equal to the standard gradient value, the current initial boundary point is corrected;

[0034] The correction processing of the current initial boundary point includes obtaining a pixel point adjacent to the current initial boundary point as the initial boundary point, repeating the above operation of obtaining the real-time gradient value, and judging the real-time gradient value in turn according to the standard gradient value until it is determined that the real-time gradient value is greater than the standard gradient value, and obtaining the initial boundary point as the correction boundary point.

[0035] Further, several entity relationship groups are formed according to the extraction results, including:

[0036] Extract keywords from any of the sentences to be processed to obtain a number of entities and identifiers corresponding to the entities;

[0037] Extracting attribute data corresponding to the entity in the statement to be processed to obtain the entity and attribute data corresponding to each of the entities;

[0038] The entity and each attribute data corresponding to the entity are respectively used as an entity relationship group corresponding to the entity.

[0039] Further, the number of standard groups is compared with the number of real-time groups, and a corresponding table structure is formed according to the comparison result, including:

[0040] The number of entity relationship groups corresponding to any of the entities in any of the statements to be processed is obtained as the number of real-time groups, and the number of standard groups is compared with the number of real-time groups.

[0041] If the number of real-time groups is greater than the number of standard groups, the number of entities in the statement to be processed is obtained and recorded as the number of real-time entities;

[0042] If the number of real-time groups is less than or equal to the number of standard groups, the entity, the entity relationship group corresponding to the entity and the associated image slice are connected to form a corresponding table structure.

[0043] Furthermore, when the number of real-time groups is greater than the number of standard groups, the number of standard entities is compared with the number of real-time entities.

[0044] If the number of real-time entities is less than or equal to the number of standard entities, connecting the entities, the entity relationship groups corresponding to the entities and the associated image slices to form a corresponding table structure;

[0045] If the number of real-time entities is greater than the number of standard entities, the associated image slices are matched with the entity relationship group corresponding to the entity, and the associated relationship group is obtained according to the matching result. The entity, the associated relationship group corresponding to the entity and the associated image slices are connected to form a corresponding table structure.

[0046] Further, calculating the real-time coincidence rate between the detected image slice and the original associated image slice corresponding to the combined sentence to be processed includes:

[0047] Obtaining the percentage of the number of detected image slices to the number of original associated image slices to obtain a real-time coincidence rate;

[0048] The original associated image slices are associated image slices corresponding to two adjacent to-be-processed sentences constituting the to-be-processed combined sentence.

[0049] Further, determining whether to correct the standard number of divisions to the corrected number of divisions according to the comparison result includes:

[0050] When the real-time overlap rate is less than the standard overlap rate, the standard segmentation number is corrected to the corrected segmentation number;

[0051] When the real-time overlap rate is greater than or equal to the standard overlap rate, the standard segmentation number is not corrected;

[0052] Among them, Nb'=Nb×[1+(Qb-Qs) / Qb], Nb' is the corrected number of divisions, Nb is the standard number of divisions, Qb is the standard overlap rate, and Qs is the real-time overlap rate.

[0053] Compared with the prior art, the beneficial effects of the present invention lie in that, by parsing imported layout files of various formats to identify semi-structured data in the layout files, the semi-structured data is converted into structured data, and key information is extracted by performing text extraction on the semi-structured data, and the image slices associated with the entities are found by matching the identified entities with the split image slices, and the matched image slices and text data segments and corresponding entity relationships are stored as a graph structure. The graph structure clearly represents the relationship between text data segments, entities, entity relationships and associated image slices, which facilitates further analysis and query, improves data management and analysis efficiency, and effectively processes the complex semi-structured data in the original layout files and converts them into structured data that are easy to manage and analyze.

[0054] Furthermore, by splitting the original image into several image slices, the local features of the image can be analyzed more carefully and the requirements of different scales and resolutions can be better adapted. At the same time, it is convenient for parallel processing and improved processing speed to more accurately achieve the fusion and association of image data and text data. By enhancing the information on the edge of the image, the boundary is made clearer and sharper, thereby improving the accuracy of subsequent image processing and analysis.

[0055] Furthermore, by increasing the grayscale value of each pixel in the area within the original graphic outline in the original image, increasing the grayscale difference between the area within and outside the original graphic outline, and dividing the pixel points in the area within the outline according to the pixel size, the grayscale value of the pixel points in the corresponding area in the image is accurately adjusted, thereby improving the image contrast and enhancing the overall visual effect of the image while maintaining the overall consistency and balance.

[0056] Furthermore, by dynamically judging whether the boundary points need to be corrected based on the comparison results between the real-time gradient value and the standard gradient value, adaptive adjustment and fine adjustment of the boundary point position are achieved, and the corrected boundary points in the intermediate image slices are effectively processed to improve the accuracy and precision of the boundary points.

[0057] Furthermore, by adjusting the grayscale value according to the gradient value, it helps to enhance the information of the image edge, making the boundary clearer and sharper, which is beneficial to the accuracy of subsequent image processing and analysis.

[0058] Furthermore, by analyzing the matching between the text data segments and the image segments, the preset segmentation strategy of the image segments and the text data segments can be optimized, thereby improving the accuracy and efficiency of data processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 A schematic diagram of a flow chart of a format file structured processing method according to an embodiment of the present invention;

[0060] Figure 2 A logical decision diagram for contour recognition according to an embodiment of the present invention;

[0061] Figure 3 A logic decision diagram for correcting the current initial boundary point according to an embodiment of the present invention;

[0062] Figure 4 The present invention provides a logic decision diagram for obtaining a corrected number of segmentations according to an embodiment of the present invention. DETAILED DESCRIPTION

[0063] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0064] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0065] It should be noted that, in the description of the present invention, terms such as "up", "down", "left", "right", "inside" and "outside" indicating directions or positional relationships are based on the directions or positional relationships shown in the drawings. This is merely for the convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation on the present invention.

[0066] In addition, it should be noted that in the description of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0067] See also Figure 1 As shown, it is a flow chart of a method for structuring a layout file according to an embodiment of the present invention. The present invention provides a method for structuring a layout file, comprising:

[0068] Step S1, importing a layout file to be processed, parsing the layout file to be processed, obtaining semi-structured data in the layout file to be processed, obtaining original data, dividing the original data into image data and semantic data, performing contour recognition on the image data to obtain a target image slice, and performing text extraction on the semantic data to obtain original text data;

[0069] Step S2, preprocessing the original text data to obtain intermediate text data;

[0070] Step S3, dividing the intermediate text data into a plurality of sentences to be processed using a period as an identifier, performing keyword extraction and attribute extraction on each of the sentences to be processed, so as to form a plurality of entity relationship groups according to the extraction results;

[0071] Step S4, matching the entity with each of the target image slices to obtain associated image slices, obtaining the number of entity relationship groups corresponding to each of the entities in any of the to-be-processed sentences and recording it as the corresponding real-time group number, comparing the standard group number with the real-time group number, forming a corresponding table structure according to the comparison result for storage, so as to convert the unstructured data in the original layout file into structured data;

[0072] When the number of real-time groups is greater than the number of standard groups, and the number of real-time entities is greater than the number of standard entities, the entities, the association relationship groups corresponding to the entities, and the associated image slices are connected to form a corresponding table structure;

[0073] Step S5, calculate the semantic similarity between the statement to be processed and the next adjacent statement to be processed, and when the semantic similarity is greater than or equal to the standard similarity, merge the statement to be processed with the next adjacent statement to be processed, and stop when the semantic similarity is less than the standard similarity, to form a combined statement to be processed, obtain the target image slice matching the combined statement to be processed as the detection image slice, calculate the real-time overlap rate between the detection image slice and the original associated image slice corresponding to the combined statement to be processed, compare the standard overlap rate with the real-time overlap rate, and determine whether to correct the standard number of segmentations to the corrected number of segmentations according to the comparison result.

[0074] In this embodiment, since layout files generally include semi-structured data and structured data, structured data is data organized according to a predefined model or architecture, usually stored in a database in a tabular form, and has clearly defined data patterns and relationships, while semi-structured data has a certain structure, but is not in a strict tabular form, and usually contains structured information in the form of tags, markers, or key-value pairs. Therefore, the imported layout files of various formats are parsed to identify the semi-structured data in the layout files to convert the semi-structured data into structured data, and text extraction is performed on the semi-structured data to extract key information. The identified entities are matched with the split image slices to find the image slices associated with the entities, and the matched image slices are stored with the text data segments and the corresponding entity relationships as a graph structure. The graph structure clearly represents the relationship between the text data segments, entities, entity relationships, and associated image slices, which facilitates further analysis and query, improves data management and analysis efficiency, and effectively processes the complex semi-structured data in the original layout files and converts them into structured data that is easy to manage and analyze.

[0075] In this embodiment, the semantic similarity between the sentence to be processed and the next adjacent sentence to be processed is calculated using the Jaccard similarity calculation method, by respectively obtaining the keyword sets of the two sentences to be processed, obtaining the intersection and union of the two sets, and calculating the percentage of the number of keywords in the intersection to the number of keywords in the union, to obtain the semantic similarity. The standard similarity is set to 0.7, and is adjusted according to the actual application requirements.

[0076] In this embodiment, the entity is matched with each of the target image slices to obtain the associated image slices. The cosine similarity calculation method is used to extract the text features of the entity and the image features of any target image slice, and the image features and the text features are respectively represented as vectors A and vectors B of the same dimension. The dot product A˙B of vector A and vector B is calculated, the modulus length |A| of vector A and the modulus length |B| of vector B are calculated, and the cosine similarity is calculated. When the cosine similarity is greater than the standard similarity, it is determined that the entity matches the corresponding target image piece and is recorded as an associated image piece.

[0077] Through contextual semantic understanding, text data segments with high semantic similarity are merged in sequence to form a combined sentence to be processed. The merged sentence is re-matched with each image slice to obtain several image slices. The percentage of the number of identical image slices matched before and after the merger is counted as the percentage of the total number of image slices matched after the merger, which is used as the real-time overlap rate to characterize the degree of difference between the image slices matched before and after the merger, so as to measure the matching accuracy of the text data segment and the image slice, thereby verifying the accuracy of the formed graph structure. When the matching accuracy is low, it means that the text data segment formed by the segmentation has less content and the image data has more content. In this case, the standard segmentation number is increased to correct it, so as to more accurately capture the details of the image data and optimize the matching process of the text data segment and the image slice. The segmentation strategy is dynamically adjusted through contextual semantic understanding and image matching accuracy evaluation, and finally a more accurate matching of image and text is achieved.

[0078] See also Figure 2 As shown, it is a logical decision diagram for contour recognition according to an embodiment of the present invention;

[0079] Specifically, in step S1, performing contour recognition on the image data includes:

[0080] Split any original image into several original image slices according to the standard number of segmentations;

[0081] Performing contour recognition on a graphic in any of the original image slices to adjust the original grayscale value of the graphic to a target grayscale value, thereby obtaining an intermediate image slice;

[0082] Identifying the correction boundary points in the intermediate image slice, and correcting the original graphic contour having the correction boundary points to obtain the corrected graphic contour;

[0083] The original image contour and the modified image contour are subjected to edge fusion processing to obtain the target image slice.

[0084] By splitting the original image into several image slices, the local features of the image can be analyzed more carefully and better adapted to the requirements of different scales and resolutions. At the same time, it is convenient for parallel processing and improves the processing speed to more accurately achieve the fusion and association of image data and text data. By enhancing the information on the edge of the image, the boundary is made clearer and sharper, thereby improving the accuracy of subsequent image processing and analysis.

[0085] Specifically, adjusting the original grayscale value of the graphic to the target grayscale value includes:

[0086] Recording the grayscale value of each pixel in the original image slice within the original graphic outline as a first actual grayscale value, and recording the grayscale value of each pixel in the original image slice outside the original graphic outline as a second actual grayscale value;

[0087] Obtaining an average value of the first actual grayscale values ​​as a first average inner contour grayscale value, and obtaining an average value of the second actual grayscale values ​​as a first average outer contour grayscale value;

[0088] Obtaining the average grayscale value corresponding to the pixel point whose first actual grayscale value is less than the average grayscale value inside the contour as the second average grayscale value inside the contour, and obtaining the average grayscale value corresponding to the pixel point whose second actual grayscale value is less than the average grayscale value outside the contour as the second average grayscale value outside the contour;

[0089] Obtaining the average grayscale value corresponding to the pixel point whose first actual grayscale value is greater than the average grayscale value inside the contour as the third average grayscale value inside the contour, and obtaining the average grayscale value corresponding to the pixel point whose actual grayscale value is greater than the average grayscale value outside the contour as the third average grayscale value outside the contour;

[0090] Calculate the square of each average contour inner grayscale value and the corresponding average contour outer grayscale value respectively to obtain the corresponding real-time grayscale difference;

[0091] The grayscale value in each average contour is sequentially added to the corresponding real-time grayscale difference to obtain the target grayscale value;

[0092] Adjusting each original grayscale value of the original image slice to a corresponding target grayscale value;

[0093] Among them, the original grayscale values ​​include the first average contour inner grayscale value, the second average contour inner grayscale value and the third average contour inner grayscale value, the average contour outer grayscale value includes the first average contour outer grayscale value, the second average contour outer grayscale value and the third average contour outer grayscale value, the first average contour inner grayscale value corresponds to the first average contour outer grayscale value, the second average contour inner grayscale value corresponds to the second average contour outer grayscale value, and the third average contour inner grayscale value corresponds to the third average contour outer grayscale value.

[0094] By increasing the grayscale value of each pixel in the area within the original graphic outline in the original image, increasing the grayscale difference between the area within and outside the original graphic outline, and dividing the pixel points in the outline area according to the pixel size, the grayscale value of the pixel points in the corresponding area in the image can be accurately adjusted to improve the image contrast and enhance the overall visual effect of the image while maintaining the overall consistency and balance.

[0095] Specifically, identifying the modified boundary points in the intermediate image slice includes:

[0096] Acquire the outline pixel points of the original graphic outline in the intermediate image slice as initial boundary points;

[0097] Subtract each of the initial boundary points from the corresponding adjacent pixel points outside the original graphic contour to obtain a number of real-time gradient values;

[0098] The real-time gradient values ​​are judged in turn according to the standard gradient values, and the current initial boundary point is corrected according to the judgment result.

[0099] See also Figure 3 As shown, it is a logical decision diagram for correcting the current initial boundary point according to an embodiment of the present invention;

[0100] Specifically, determining to correct the current initial boundary point according to the determination result includes:

[0101] If any real-time gradient value is less than or equal to the standard gradient value, the current initial boundary point is corrected;

[0102] If there is no real-time gradient value that is less than or equal to the standard gradient value, no correction is performed on the current initial boundary point;

[0103] Among them, the correction processing of the current initial boundary point includes obtaining the pixel point adjacent to the current initial boundary point as the initial boundary point, repeating the above operation of obtaining the real-time gradient value, and judging the real-time gradient value in turn according to the standard gradient value until it is determined that the real-time gradient value is greater than the standard gradient value, and obtaining the initial boundary point as the correction boundary point.

[0104] By comparing the real-time gradient value with the standard gradient value, it is dynamically determined whether the boundary point needs to be corrected, so as to achieve adaptive adjustment and fine adjustment of the boundary point position, effectively process the corrected boundary points in the intermediate image slice, and improve the accuracy and precision of the boundary points.

[0105] Specifically, edge fusion processing of the original graphic outline and the modified graphic outline includes:

[0106] Obtaining the maximum gradient value among the real-time gradient values ​​constituting the original graphic contour and the corrected graphic contour, multiplying the maximum gradient value by the grayscale value of each boundary point constituting the graphic contour to obtain the corrected contour grayscale value, and adjusting the grayscale value of each boundary point constituting the graphic contour to the corrected contour grayscale value;

[0107] The graphic outline includes an original graphic outline and a modified graphic outline; the modified graphic outline is composed of modified boundary points and initial boundary points that have not been processed with boundary point correction.

[0108] By adjusting the grayscale value of the boundary point according to the maximum gradient value, the corrected contour is made more consistent with the actual image features, and the blurred or discontinuous boundaries caused by grayscale inconsistency are reduced, thereby improving the quality and clarity of the image. The grayscale value of the boundary point is adjusted to the grayscale value of the corrected contour to maintain the consistency and coherence of each part of the image, so that the corrected contour is more matched with the original graphic contour and the incoherent or uncoordinated visual effects are reduced. By adjusting the grayscale value, the grayscale difference between the corrected graphic contour and the surrounding environment is reduced, the probability of artifacts is reduced, and the image is made more realistic and natural. By adjusting the grayscale value according to the gradient value, it helps to enhance the information of the image edge, make the boundary clearer and sharper, and facilitate the accuracy of subsequent image processing and analysis.

[0109] In this embodiment, the original text data is preprocessed by dividing the original text data into preset character lengths to obtain text data segments, sorting the text data segments, and comparing two adjacent text data segments in turn. If the two text data segments are the same, either of them is deleted to remove duplicate data. The preset character length is 1.

[0110] Preprocessing the original text data also includes removing unnecessary characters and data with incorrect formats to ensure the accuracy and completeness of the data.

[0111] Specifically, several entity relationship groups are formed according to the extraction results, including:

[0112] Extract keywords from any of the sentences to be processed to obtain a number of entities and identifiers corresponding to the entities;

[0113] Extracting attribute data corresponding to the entity in the statement to be processed to obtain the entity and attribute data corresponding to each of the entities;

[0114] The entity and each attribute data corresponding to the entity are respectively used as an entity relationship group corresponding to the entity.

[0115] By analyzing the sentences to be processed, keywords in the text are identified and extracted. These keywords represent important entities. Entities can be names of people, places, events, specific objects and other information. Based on this step, the core elements in the text can be determined. After identifying the entities, a unique identifier is assigned to each entity so that these entities can be accurately referenced and identified in subsequent processing. Each entity is further analyzed and the attribute data related to it is extracted from the text. The attribute data contains detailed information about the entity, such as description, characteristics, related dates, etc. By constructing entity relationship groups, key data in semi-structured text data is extracted to ensure the effectiveness and accuracy of converting semi-structured text into structured data.

[0116] Specifically, the number of standard groups is compared with the number of real-time groups, and a corresponding table structure is formed according to the comparison result, including:

[0117] The number of entity relationship groups corresponding to any of the entities in any of the statements to be processed is obtained as the number of real-time groups, and the number of standard groups is compared with the number of real-time groups.

[0118] If the number of real-time groups is greater than the number of standard groups, the number of entities in the statement to be processed is obtained and recorded as the number of real-time entities;

[0119] If the number of real-time groups is less than or equal to the number of standard groups, connecting the entity, the entity relationship group corresponding to the entity and the associated image slice to form a corresponding table structure;

[0120] In this embodiment, the number of standard groups represents entities and corresponding multiple attribute data, reflecting the expected data richness and complexity. Generally, it is set between 5 and 10, and is selected and adjusted according to specific needs and application scenarios. If a sentence contains multiple entities, each entity corresponds to multiple entity-relationship pairs, so that there may be more relationships between multiple entities, resulting in increased complexity of relationship extraction. Therefore, by associating images, the split images are matched with texts to screen entities and relationships, reduce corresponding entity-relationship pairs, and improve the precise matching results of relationship extraction.

[0121] Specifically, when the number of real-time groups is greater than the number of standard groups, the number of standard entities is compared with the number of real-time entities.

[0122] If the number of real-time entities is less than or equal to the number of standard entities, connecting the entities, the entity relationship groups corresponding to the entities and the associated image slices to form a corresponding table structure;

[0123] If the number of real-time entities is greater than the number of standard entities, the associated image slices are matched with the entity relationship group corresponding to the entity, and the associated relationship group is obtained according to the matching result. The entity, the associated relationship group corresponding to the entity and the associated image slices are connected to form a corresponding table structure.

[0124] In this embodiment, the number of standard groups represents the threshold value of the number of entities contained in a sentence. The real-time number of entities refers to the number of entities actually extracted from each sentence to be processed. The set value is related to the specific application requirements and context. Generally, it is set between 3 and 6, and is adjusted according to the requirements for the degree of structuring of the text data.

[0125] If it is determined that the number of real-time entities is less than or equal to the number of standard entities, it means that the number of extracted entities meets the preset standards. These entities, entity relationship groups and associated image slices can be directly connected to form the final table structure. If it is determined that the number of real-time entities is greater than the number of standard entities, it means that the actual number of extracted entities exceeds the preset standards. The entity relationship groups need to be further screened and matched according to the associated image slices to ensure that the final table structure can reflect the integrity and accuracy of the text data.

[0126] See also Figure 4 As shown, it is a logical decision diagram for obtaining the corrected number of segmentations according to an embodiment of the present invention;

[0127] Specifically, calculating the real-time coincidence rate between the detected image slice and the original associated image slice corresponding to the combined sentence to be processed includes:

[0128] Obtaining the percentage of the number of detected image slices to the number of original associated image slices to obtain a real-time coincidence rate;

[0129] The original associated image slices are associated image slices corresponding to two adjacent to-be-processed sentences constituting the to-be-processed combined sentence.

[0130] By analyzing the matching between text data segments and image segments, the preset segmentation strategy of image segments and text data segments can be optimized to improve the accuracy and efficiency of data processing.

[0131] Specifically, determining whether to correct the standard number of divisions to the corrected number of divisions according to the comparison result includes:

[0132] When the real-time overlap rate is less than the standard overlap rate, the standard segmentation number is corrected to the corrected segmentation number;

[0133] When the real-time overlap rate is greater than or equal to the standard overlap rate, the standard segmentation number is not corrected;

[0134] Among them, Nb'=Nb×[1+(Qb-Qs) / Qb], Nb' is the corrected number of divisions, Nb' is rounded up, Nb is the standard number of divisions, Qb is the standard overlap rate, and Qs is the real-time overlap rate.

[0135] In this embodiment, the standard overlap rate is set between 60% and 80%, which indicates the degree of difference between the matched image slices before and after the merger, and represents the matching accuracy between the text data segment and the image slice. The higher the set value, the higher the requirement for the degree of structuring of the text data.

[0136] By matching the combined image fragments with the text data segments again, analyzing the overlap between the matched text data segments and the text data segments corresponding to the combined image fragments, if the overlap is good, the preset number of splits can be maintained; if the overlap is not good, the preset number of splits is increased to more accurately capture the details of the image data, optimize the preset image fragment and text data segmentation strategy, and improve the accuracy and efficiency of data processing.

[0137] 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 equivalent 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.

[0138] 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, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for structuring layout files, It is characterized in that include, Importing a layout file to be processed, parsing the layout file to be processed to obtain semi-structured data in the layout file to be processed, and obtaining original data; The original data is divided into image data and semantic data, contour recognition is performed on the image data to obtain a target image slice, and text extraction is performed on the semantic data to obtain original text data; Preprocessing the original text data to obtain intermediate text data; Using a period as an identifier, the intermediate text data is divided into a plurality of sentences to be processed, and keyword extraction and attribute extraction are performed on each of the sentences to be processed, so as to form a plurality of entity relationship groups according to the extraction results; Matching the entity with each of the target image slices to obtain associated image slices, obtaining the number of entity relationship groups corresponding to each of the entities in any of the sentences to be processed and recording it as the corresponding real-time group number; The number of standard groups is compared with the number of real-time groups, and a corresponding table structure is formed according to the comparison result for storage, so as to convert the unstructured data in the original layout file into structured data; When the number of real-time groups is greater than the number of standard groups, and the number of real-time entities is greater than the number of standard entities, the entities, the association relationship groups corresponding to the entities, and the associated image slices are connected to form a corresponding table structure; Calculate the semantic similarity between the statement to be processed and the next adjacent statement to be processed. When the semantic similarity is greater than or equal to the standard similarity, merge the statement to be processed with the next adjacent statement to be processed, and stop when the semantic similarity is less than the standard similarity to form a combined statement to be processed. Obtain the target image slice that matches the combined statement to be processed as the detection image slice, calculate the real-time overlap rate between the detection image slice and the original associated image slice corresponding to the combined statement to be processed, compare the standard overlap rate with the real-time overlap rate, and determine whether to correct the standard number of segmentations to the corrected number of segmentations according to the comparison result.

2. The method for structuring a layout file according to claim 1, It is characterized in that Performing contour recognition on the image data includes: Split any original image into several original image slices according to the standard number of segmentations; Performing contour recognition on a graphic in any of the original image slices to adjust the original grayscale value of the graphic to a target grayscale value, thereby obtaining an intermediate image slice; Identifying the correction boundary points in the intermediate image slice, and correcting the original graphic contour having the correction boundary points to obtain the corrected graphic contour; The original image contour and the modified image contour are subjected to edge fusion processing to obtain the target image slice.

3. The method for structuring layout files according to claim 2, It is characterized in that Adjusting the original grayscale value of the graphic to a target grayscale value includes: Recording the grayscale value of each pixel in the original image slice within the original graphic outline as a first actual grayscale value, and recording the grayscale value of each pixel in the original image slice outside the original graphic outline as a second actual grayscale value; Obtaining an average value of the first actual grayscale values ​​as a first average inner contour grayscale value, and obtaining an average value of the second actual grayscale values ​​as a first average outer contour grayscale value; Obtaining the average grayscale value corresponding to the pixel point whose first actual grayscale value is less than the average grayscale value inside the contour as the second average grayscale value inside the contour, and obtaining the average grayscale value corresponding to the pixel point whose second actual grayscale value is less than the average grayscale value outside the contour as the second average grayscale value outside the contour; Obtaining the average grayscale value corresponding to the pixel point whose first actual grayscale value is greater than the average grayscale value inside the contour as the third average grayscale value inside the contour, and obtaining the average grayscale value corresponding to the pixel point whose actual grayscale value is greater than the average grayscale value outside the contour as the third average grayscale value outside the contour; Calculate the square of each average contour inner grayscale value and the corresponding average contour outer grayscale value respectively to obtain the corresponding real-time grayscale difference; The grayscale value in each average contour is sequentially added to the corresponding real-time grayscale difference to obtain the target grayscale value; Adjusting each original grayscale value of the original image slice to a corresponding target grayscale value; Among them, the original grayscale values ​​include the first average contour inner grayscale value, the second average contour inner grayscale value and the third average contour inner grayscale value, the average contour outer grayscale value includes the first average contour outer grayscale value, the second average contour outer grayscale value and the third average contour outer grayscale value, the first average contour inner grayscale value corresponds to the first average contour outer grayscale value, the second average contour inner grayscale value corresponds to the second average contour outer grayscale value, and the third average contour inner grayscale value corresponds to the third average contour outer grayscale value.

4. The method for structuring layout files according to claim 2, It is characterized in that Identifying the modified boundary points in the intermediate image slice comprises, Acquire the outline pixel points of the original graphic outline in the intermediate image slice as initial boundary points; Subtract each of the initial boundary points from the corresponding adjacent pixel points outside the original graphic contour to obtain a number of real-time gradient values; The real-time gradient values ​​are judged in turn according to the standard gradient values, and the current initial boundary point is corrected according to the judgment result.

5. The method for structuring layout files according to claim 4, It is characterized in that According to the determination result, the correction process of the current initial boundary point includes: If any real-time gradient value is less than or equal to the standard gradient value, the current initial boundary point is corrected; The correction processing of the current initial boundary point includes obtaining a pixel point adjacent to the current initial boundary point as the initial boundary point, repeating the above operation of obtaining the real-time gradient value, and judging the real-time gradient value in turn according to the standard gradient value until it is determined that the real-time gradient value is greater than the standard gradient value, and obtaining the initial boundary point as the correction boundary point.

6. The method for structuring a layout file according to claim 1, It is characterized in that According to the extraction results, several entity relationship groups are formed, including: Extract keywords from any of the sentences to be processed to obtain a number of entities and identifiers corresponding to the entities; Extracting attribute data corresponding to the entity in the statement to be processed to obtain the entity and attribute data corresponding to each of the entities; The entity and each attribute data corresponding to the entity are respectively used as an entity relationship group corresponding to the entity.

7. The method for structuring a layout file according to claim 1, It is characterized in that Compare the number of standard groups with the number of real-time groups, and form a corresponding table structure based on the comparison result, including: The number of entity relationship groups corresponding to any of the entities in any of the statements to be processed is obtained as the number of real-time groups, and the number of standard groups is compared with the number of real-time groups. If the number of real-time groups is greater than the number of standard groups, the number of entities in the statement to be processed is obtained and recorded as the number of real-time entities; If the number of real-time groups is less than or equal to the number of standard groups, the entity, the entity relationship group corresponding to the entity and the associated image slice are connected to form a corresponding table structure.

8. The method for structuring a layout file according to claim 7, It is characterized in that When the number of real-time groups is greater than the number of standard groups, the number of standard entities is compared with the number of real-time entities. If the number of real-time entities is less than or equal to the number of standard entities, connecting the entities, the entity relationship groups corresponding to the entities and the associated image slices to form a corresponding table structure; If the number of real-time entities is greater than the number of standard entities, the associated image slices are matched with the entity relationship group corresponding to the entity, and the associated relationship group is obtained according to the matching result. The entity, the associated relationship group corresponding to the entity and the associated image slices are connected to form a corresponding table structure.

9. The method for structuring a layout file according to claim 1, It is characterized in that Calculating the real-time coincidence rate between the detected image slice and the original associated image slice corresponding to the combined sentence to be processed includes: Obtaining the percentage of the number of detected image slices to the number of original associated image slices to obtain a real-time coincidence rate; The original associated image slices are associated image slices corresponding to two adjacent to-be-processed sentences constituting the to-be-processed combined sentence.

10. The method for structuring a layout file according to claim 1, It is characterized in that Determining whether to correct the standard number of divisions to the corrected number of divisions according to the comparison result includes: When the real-time overlap rate is less than the standard overlap rate, the standard segmentation number is corrected to the corrected segmentation number; When the real-time overlap rate is greater than or equal to the standard overlap rate, the standard segmentation number is not corrected; Among them, Nb'=Nb×[1+(Qb-Qs) / Qb], Nb' is the corrected number of divisions, Nb is the standard number of divisions, Qb is the standard overlap rate, and Qs is the real-time overlap rate.

Citation Information

Patent Citations

  • Method, device and equipment for extracting information of layout file and storage medium

    CN118095205A

  • Network information extraction method and device

    CN115098706A

  • Intelligent storage method for layout file identification data

    CN116916047A

  • Automated document processing for detecting, extracting, and analyzing tables and tabular data

    US20220318224A1

  • Machine learning methods and systems for extracting entities from semi-structured enterprise documents

    US20230267273A1