Method for automatically redacting and correcting format of official document

By generating structured document trees and constructing document format knowledge graphs, the problem of unmanned and standardized output in the document processing of group enterprises has been solved. Automatic red-inking and format correction of documents have been achieved, improving the efficiency and standardization of document production.

CN123050346APending Publication Date: 2026-11-06SHANXIN SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611157655.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing technologies cannot achieve fully automated and standardized output of official documents in group enterprises and government office scenarios. In particular, there are difficulties in formulating layout specifications, creating red-line markings, and correcting formats, and they cannot effectively solve the comprehensive requirements of understanding structure and resolving layout conflicts.

Method used

By acquiring electronic document data, performing document layout and natural language processing, a structured document tree is generated, and a group-level document format knowledge graph is constructed. Combining visual and text modal features, red-line marking and format correction are performed, format conflicts are detected and resolved, and a format correction report is output.

Benefits of technology

It has automated and standardized the production of official documents, reduced the cost of manual verification, improved the standardization and consistency of document formats, provided traceable basis for modification, and improved the format compliance among multiple levels of units.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123050346A_ABST
    Figure CN123050346A_ABST
Patent Text Reader

Abstract

The application provides a method for automatically redacting and correcting the format of official documents, which comprises: obtaining electronic document data of a to-be-processed official document; performing document layout analysis on the electronic document data to obtain visual modality features, and performing natural language processing to obtain text modality features; fusing the visual modality features and the text modality features to generate a structured official document tree; constructing a group-level official document version knowledge graph, matching a standard redacting paradigm in the knowledge graph according to the structured official document tree, the official document type and the document issuance level, extracting standard positions and style information of related entities and generating a red head area to complete redacting; comparing actual format parameters with version constraint relationships in the knowledge graph, detecting deviations such as font, font size, paragraph spacing, version head position, version note position, element loss and redundancy and correcting the deviations, and generating a standardized document, so as to solve the problem that a truly full-process unmanned and standardized official document output cannot be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of official document data processing technology, and in particular to a method for automatic red-inking and format correction of official documents. Background Technology

[0002] In corporate and government office settings, document processing involves multiple stages, including format specification development, element arrangement, red-inking, and format review. Due to the extremely high requirements for standardization and seriousness in official documents, the font, font size, line spacing, page margins, and relative positions of elements such as the header, issuing authority logo, document number, title, addressee, body text, attachment descriptions, date of issuance, seal, and imprint must strictly adhere to established standards. Furthermore, multi-level organizational structures within corporations often result in different document specifications being implemented between headquarters, subsidiaries, and departments. Joint issuance, multi-level forwarding, and cross-unit issuance further complicate format unification and conflict resolution. Therefore, achieving red-inking, format standardization, format conflict correction, and automatic adaptation to multi-level issuance specifications has become a pressing need in this scenario.

[0003] To address the aforementioned issues, existing technologies primarily employ the following solutions: First, a fixed template-based replacement method for red headers, where content is directly filled into pre-made document templates to generate the red header area; second, a rule-based simple format check, which compares documents one by one based on preset font, font size, or spacing rules; and third, single text or single visual processing, which only utilizes optical character recognition technology to extract text content or only analyzes the page's visual layout, failing to effectively combine the two.

[0004] However, none of the above solutions can simultaneously meet the comprehensive requirements of structural understanding, layout reasoning, and conflict resolution in official document processing, resulting in the inability to truly achieve fully automated and standardized document output. Summary of the Invention

[0005] This application provides a method for automatically red-labeling and formatting correction of official documents to solve the problem of the inability to truly achieve fully automated and standardized document output.

[0006] This application provides a method for automatic red-inking and format correction of official documents, the method being executed by a processor, including: Obtain the electronic document data of the official documents to be processed; The electronic document data is subjected to document layout analysis to obtain visual modal features; Natural language processing is performed on the electronic document data to obtain text modality features; The visual modal features and the text modal features are fused to generate a structured document tree, wherein the nodes in the structured document tree correspond to the visual blocks, and the nodes are labeled with semantic roles and layout roles; Construct a group-level knowledge graph of official document formats; the group-level knowledge graph of official document formats includes the core elements of official documents and format constraint relationships; Based on the structured document tree, the document type and issuance level of the electronic document data, a match is made in the group-level document format knowledge graph to determine the standard red-inking paradigm; Based on the standard red-line paradigm, extract the standard position and style information of the header entity, red-line entity, document number entity, and issuing agency logo entity from the group-level document format knowledge graph; Based on the standard location information and style information, a red header area is generated in the electronic document data and the red header is applied. The actual format parameters of the electronic document data are compared with the format constraint relationships in the group-level official document format knowledge graph to detect differences in font, font size, paragraph spacing, header position, footer position, missing elements, and redundant elements. The electronic document data is then corrected according to the format constraint relationships to generate standardized documents. When the electronic document data involves joint issuance, multi-level forwarding, or cross-unit document issuance, format consistency reasoning is performed based on the format constraint relationship in the group-level document format knowledge graph to resolve format conflicts. Output a format correction report for the standardized document, which indicates the modifications and the basis for those modifications.

[0007] This application generates a structured document tree by integrating visual and textual modal features, and combines a group-level document format knowledge graph for standard red-heading paradigm matching and entity style extraction. This enables automatic generation of red-heading areas and red-heading operations, improving document production efficiency. Simultaneously, by comparing actual format parameters with format constraints in the knowledge graph, various format deviations can be detected and automatically corrected based on the constraints, helping to reduce manual verification costs and improve document format standardization. For joint issuance or multi-level forwarding scenarios, format consistency reasoning based on the graph resolves conflicts, improving the consistency and compliance of document formats across multiple levels of units. Furthermore, the output of a correction report annotating modification items and the basis for modification provides traceable evidence for format adjustments, contributing to improved reliability and standardization of the fully automated document processing process.

[0008] Optionally, the step of performing document layout analysis on the electronic document data to obtain visual modal features includes: Optical character recognition and document layout analysis are performed on the electronic document data to extract the position coordinates, block size, font name, font size, line spacing, and header / footer positions of visual blocks. The position coordinates, block size, font name, font size, line spacing, and header / footer positions are then used as the visual modal features.

[0009] By extracting the location coordinates, block size, font name, font size, line spacing, and header / footer positions of visual blocks as visual modal features, we can provide detailed visual parameters for the generation of structured document trees and the comparison of layout deviations. This will help improve the accuracy of subsequent format detection and correction, and enhance the effect of automatic document layout recognition.

[0010] Optionally, the step of performing natural language processing on the electronic document data to obtain text modal features includes: Natural language processing is performed on the electronic document data to identify the document type, issuing authority name, structural hierarchy title, and main text content, and the document type, issuing authority name, structural hierarchy title, and main text content are used as the text modal features.

[0011] By using natural language processing to identify document type, issuing authority name, structural hierarchy title, and body content as text modal features, we can provide text-level structured information for semantic role labeling and layout role assignment in structured official document trees. This is beneficial for improving the accuracy of subsequent standard red-line paradigm matching and the efficiency of layout constraint relationship comparison.

[0012] Optionally, fusing the visual modal features and the text modal features to generate a structured document tree includes: The visual blocks in the visual modality features are aligned with the text fragments in the text modality features, and semantic role labels and layout role labels are assigned to each aligned visual block to form a structured document tree containing several nodes; wherein, the semantic role labels are used to indicate the document element category, and the layout role labels are used to indicate the visual style category.

[0013] By aligning visual blocks with text fragments and assigning semantic role labels indicating document element categories and layout role labels indicating visual style categories to each visual block, a structured document tree containing node annotation information can be formed. This provides a structured data foundation for subsequent standard red-color paradigm matching, format deviation detection and correction, and layout conflict resolution, thereby improving the fusion and utilization of multimodal information in document processing.

[0014] Optionally, the construction of the group-level document format knowledge graph includes: Extract the core elements of the official document, which include the header, issuing authority logo, document number, red line, title, addressee, main text, attachments, date of issuance, seal, imprint, and page number; Define layout constraints, which include position constraints, hierarchical constraints, format constraints, and compliance constraints. The position constraints are the vertical and horizontal spacing values. The hierarchical constraints are the joint document writing rules and multi-level document issuance rules. The format constraints are the font name, font size value, line spacing value, and page margin value. The compliance constraints are the security classification identifier, urgency level identifier, and signatory identifier. By treating the core elements of the official documents as entities and the format constraints as attributes or relationships, a group-level knowledge graph of official document formats is constructed.

[0015] By extracting core elements of official documents, including header, issuing authority logo, document number, red line, title, addressee, body, attachments, date of issuance, seal, imprint, and page number, as entities, and defining position constraints, hierarchical constraints, format constraints, and compliance constraints as attributes or relationships, a group-level document format knowledge graph is constructed. This provides structured knowledge references for red-line operation, format deviation detection and correction, and multi-level document conflict resolution, which helps improve the accuracy and efficiency of format rule calling during the automatic document processing.

[0016] Optionally, the step of matching the structured document tree, the document type, and the issuance level of the electronic document data in the group-level document format knowledge graph to determine the standard red-inking paradigm includes: Extract the issuing authority node and document type node from the structured document tree; The document level is determined based on the issuing authority node, and the document type is determined based on the document type node; Using the document issuance level and document type as query conditions, a matching red-ink template is retrieved from the group-level document format knowledge graph to obtain the standard red-ink paradigm.

[0017] By extracting the issuing authority node and document type node from the structured document tree to determine the issuing level and document type, and retrieving the matching red-ink template in the group-level document format knowledge graph, the standard red-ink paradigm can be dynamically determined for different issuing levels and document types. This helps improve the targeting and accuracy of red-ink template matching and reduces the need for manual template selection.

[0018] Optionally, generating a red-headed area and completing the red-overlay based on the standard location information and style information in the electronic document data includes: Based on the standard position and style information of the header entity, insert the issuing authority logo image or text in the header area of ​​the electronic document data, and set the font name, font size and color value; Based on the standard position information of the document number entity, insert the document number string below the issuing authority mark; Based on the standard position and style information of the red line entity, a red dividing line is drawn below the document number to complete the red overlay.

[0019] By using the standard position and style information of the header entity, document number entity, and red line entity, the system inserts the issuing authority's logo in the header area of ​​the electronic document data and sets its font, size, and color. It then inserts the document number string below the issuing authority's logo and draws a red dividing line below the document number. This system can automatically complete the precise positioning and style setting of each component element in the red header area, which helps improve the standardization and efficiency of the red-line application process.

[0020] Optionally, the step of comparing the actual format parameters of the electronic document data with the format constraint relationships in the group-level official document format knowledge graph, detecting differences in font, font size, paragraph spacing, header position, footer position, missing elements, and redundant elements, and correcting the electronic document data according to the format constraint relationships to generate a standardized document, includes: Traverse each node in the structured document tree to obtain the actual font name, actual font size value, actual paragraph spacing value, actual position coordinates, and actual element existence status of the node; The actual font name, actual font size value, actual paragraph spacing value, actual position coordinates, and actual element existence status are compared with the corresponding standard font name, standard font size value, standard paragraph spacing value, standard position coordinates, and standard element existence requirements in the group-level official document format knowledge graph to generate a difference list. The difference list includes font differences, font size differences, paragraph spacing differences, header position differences, imprint position differences, element missing, and element redundancy. Based on the list of differences, the electronic document data is modified by calling the standard parameters in the group-level document format knowledge graph to generate a standardized document.

[0021] By traversing the structured document tree nodes to obtain actual format parameters, and comparing them with the standard parameters in the group-level document format knowledge graph, a list containing differences in font, font size, paragraph spacing, header position, footer position, missing elements, and redundancy is generated. Then, modifications are made according to the standard parameters. This system can systematically complete the detection and correction of multiple types of format deviations, which is conducive to improving the automation level of document format standardization and the comprehensiveness of correction operations.

[0022] Optionally, when the electronic document data involves joint issuance, multi-level forwarding, or cross-unit communication, format consistency reasoning is performed based on the format constraint relationships in the group-level document format knowledge graph to resolve format conflicts, including: When the electronic document data contains multiple issuing authority logo entities or multiple document number entities, it is determined to be a joint document issuance, multi-level forwarding, or cross-unit document issuance. Extract the arrangement order and hierarchical relationship of the multiple issuing authority identifier entities; Based on the hierarchical constraints in the group-level document format knowledge graph, verify whether the arrangement order and the hierarchical relationship conform to the preset joint document issuance rules or multi-level document issuance rules; If not, the position, font name, and font size of the multiple issuing authority logo entities shall be adjusted in accordance with the joint document issuance rules or multi-level document issuance rules to resolve the layout conflict.

[0023] By detecting the arrangement order and hierarchical relationship of multiple issuing agency logo entities in scenarios of joint issuance, multi-level forwarding, or cross-unit document issuance, and verifying and adjusting them based on the hierarchical constraints in the group-level document format knowledge graph, the ability to automatically identify and correct format conflicts in multi-unit document issuance scenarios can be improved, which is conducive to improving the consistency of document formats in joint issuance and multi-level forwarding.

[0024] Optionally, the output of the format correction report for the standardized document includes: Record the parameters before modification, parameters after modification, and the modification basis clauses for each modification during the correction process. The modification basis clauses are the specific entries of the format constraint relationships in the group-level official document format knowledge graph. The parameters before modification, the parameters after modification, and the terms on which the modification was based are summarized to generate a format correction report; Output the standardized document and the format correction report.

[0025] By recording the parameters before and after each modification during the correction process, as well as the clauses on which the modification was based, and summarizing the above information to generate a format correction report, a traceable record of modifications and explanations of the basis for adjusting the format of standardized documents can be provided, which helps to improve the transparency of the document correction process and the auditability of the results.

[0026] As can be seen from the above technical solutions, this application provides a method for automatic red-line marking and format correction of official documents, including: acquiring electronic document data of the document to be processed; performing document layout analysis on the electronic document data to obtain visual modal features; performing natural language processing on the electronic document data to obtain text modal features; fusing the visual modal features and the text modal features to generate a structured document tree; constructing a group-level document format knowledge graph; matching the structured document tree, the document type and issuance level of the electronic document data in the group-level document format knowledge graph to determine a standard red-line marking paradigm; extracting standard position information and style information of header entities, red-line entities, document number entities, and issuing agency logo entities from the group-level document format knowledge graph based on the standard red-line marking paradigm; and performing standard red-line marking based on the standard red-line marking paradigm. The system generates a red-headed area in the electronic document data and applies red lettering based on location and style information. It compares the actual format parameters of the electronic document data with the format constraints in the group-level document format knowledge graph, detecting differences in font, font size, paragraph spacing, header position, footer position, missing elements, and redundant elements. Based on the format constraints, it corrects the electronic document data to generate a standardized document. When the electronic document data involves joint issuance, multi-level forwarding, or cross-unit communication, it performs format consistency reasoning based on the format constraints in the group-level document format knowledge graph to resolve format conflicts. Finally, it outputs a format correction report for the standardized document, annotating the modification items and their basis, to address the problem of not being able to achieve truly unmanned and standardized document output throughout the entire process. Attached Figure Description

[0027] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 This is a flowchart illustrating the method for automatic red-marking and format correction of official documents provided in this application embodiment. Detailed Implementation

[0029] The embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described below do not represent all embodiments consistent with this application. They are merely examples of systems and methods consistent with some aspects of this application as detailed in the claims.

[0030] To address the issue of the inability to truly achieve fully automated and standardized document output, see [link / reference]. Figure 1 This application provides a method for automatic red-marking and format correction of official documents. The method is executed by a processor connected to a memory, a display screen, an input interface, and an output interface. The memory stores a computer program, which, when executed by the processor, performs the following steps: S100: Obtain the electronic document data of the official document to be processed.

[0031] It should be understood that processors include, but are not limited to, any one or more combinations of central processing units, graphics processing units, digital signal processors, application-specific integrated circuits (ASICs), and field-programmable gate arrays (FPGAs). Electronic document data can be in Portable Document Format (PDF) or Word documents. For example, a user-uploaded PDF document can be received via an input interface and temporarily stored in memory.

[0032] S110: Perform document layout analysis on electronic document data to obtain visual modal features.

[0033] In some embodiments, document layout analysis is performed on electronic document data to obtain visual modal features, including: performing optical character recognition and document layout analysis on electronic document data to extract the position coordinates, block size, font name, font size value, line spacing value, and header / footer position of visual blocks, and using the position coordinates, block size, font name, font size value, line spacing value, and header / footer position as visual modal features.

[0034] For example, an optical character recognition engine identifies text lines, while a document layout analysis algorithm divides the page into multiple visual blocks. Each visual block records its top-left corner coordinates, width, and height. A font detection model obtains the font name, font size, line spacing, and the relative positions of headers and footers. The document layout analysis algorithm can employ a deep learning-based YOLO (You Only Look Once) object detection model or a traditional projection contour analysis method. The font detection model can use a CRNN (Convolutional Recurrent Neural Network) model or a method based on ligature feature matching. These visual modal features provide accurate visual parameters for subsequent multimodal fusion.

[0035] It should be understood that the position coordinates refer to the horizontal and vertical coordinates of the top left and bottom right corners of each visual block in the entire document page coordinate system, used to identify the specific layout position of each visual block on the page; the block size refers to the width and height values ​​of the corresponding visual block, used to limit the overall size range of each visual block; the font name refers to the official identification name of the font used for all the text in the corresponding visual block, such as SimSun, Heiti, etc.; the font size value refers to the quantitative value of the font size of the text in the corresponding visual block, usually the national standard official document size such as No. 2, No. 3, No. 4, or the corresponding point value (such as 22 points, 16 points, 12 points); the line spacing value refers to the quantitative value of the spacing between two adjacent lines of text in the corresponding visual block, which is set to a fixed value of 28 points or 1.5 line spacing according to the GB / T 9704-2012 standard for official document formats; the header and footer positions refer to the distance of the document header area from the top of the page and the distance of the footer area from the bottom of the page. The above numerical range is set according to the GB / T 9704-2012 standard for official document formats, for example, the distance from the top edge of the header is set to 37mm±1mm.

[0036] S120: Perform natural language processing on electronic document data to obtain text modal features.

[0037] In some embodiments, natural language processing is performed on electronic document data to obtain text modal features, including: performing natural language processing on electronic document data to identify document type, issuing authority name, structural hierarchy title and body content, and using document type, issuing authority name, structural hierarchy title and body content as text modal features.

[0038] For example, named entity recognition models in natural language processing can be used to extract the issuing authority's name from text, text classification models can be used to identify document types, and rule matching or deep learning models can be used to identify hierarchical headings and body text. Named entity recognition models can employ BiLSTM-CRF (Bidirectional Long Short-Term Memory with Conditional Random Field) models, while text classification models can be fine-tuned using BERT (Bidirectional Encoder Representations from Transformers) pre-trained models. These text modal features provide semantic-level structured information for subsequent multimodal fusion.

[0039] It should be understood that document type refers to the legally recognized category of document used in official documents, such as resolutions, decisions, orders, bulletins, announcements, notices, opinions, notifications, circulars, reports, requests for instructions, replies, proposals, letters, and minutes, used to determine the legal genre of the document; the issuing authority name refers to the full name or standardized abbreviation of the agency or unit that issued the document, used to identify the issuing entity; structural hierarchy headings refer to the heading content corresponding to each level after the main body of the document is logically divided into levels. Generally, the structural hierarchy of official documents can be divided into first-level headings, second-level headings, third-level headings, and fourth-level headings, with different levels of headings used to distinguish the logical framework and subordinate relationships of the main body content; the main body content refers to all the textual content of the main body of the document that carries the specific issuing intent and explains the matters, and is the carrier of the core information of the document. By identifying and extracting the above elements, complete text modal features can be obtained for subsequent multimodal fusion.

[0040] S200: Combines visual modal features and text modal features to generate a structured document tree.

[0041] In a structured document tree, nodes correspond to visual blocks, and each node is labeled with a semantic role and a layout role.

[0042] In some embodiments, visual modal features and text modal features are fused to generate a structured document tree, including: aligning visual blocks in the visual modal features with text fragments in the text modal features, and assigning semantic role labels and layout role labels to each aligned visual block to form a structured document tree containing several nodes; wherein, semantic role labels are used to indicate document element categories, and layout role labels are used to indicate visual style categories.

[0043] It should be understood that semantic role tags are used to label the document element category corresponding to a node, specifically including document type tags, issuing authority name tags, structural hierarchy title tags, and body content tags. Each tag corresponds to the specific document element type carried by the node, thus clearly labeling the semantic attributes of the node. Layout role tags are used to label the visual style category corresponding to a node, specifically including the font category, font size, alignment, line spacing, margins, and other visual presentation parameters corresponding to the node, thus clarifying the layout style attributes of the node. After completing the tag assignment for all aligned visual blocks, each visual block forms a hierarchical node structure according to the document's layout logic and content hierarchy, ultimately generating a complete structured document tree. The alignment method can adopt a matching algorithm based on Intersection over Union (IoU), calculating the overlap between the bounding boxes of text fragments and the bounding boxes of visual blocks. When the IoU is greater than a preset threshold (which can be 0.7), they are considered the same element.

[0044] S300: Construct a group-level document format knowledge graph; the group-level document format knowledge graph includes the core elements of documents and format constraint relationships.

[0045] In some embodiments, a group-level document format knowledge graph is constructed, including: S310: Extract the core elements of official documents. The core elements of official documents include the header, issuing authority logo, document number, red line, title, addressee, body, attachments, date of issuance, seal, imprint, and page number.

[0046] Specifically, from the standardized official documents already archived by the group, the documents are broken down and extracted according to their general structure. The header, issuing authority logo, document number, red line, title, addressee, body, attachments, date of issuance, seal, imprint, and page number are each broken down into independent entities, and the role of each entity in the overall structure of the document is clarified.

[0047] S320: Define layout constraints, which include position constraints, hierarchical constraints, format constraints, and compliance constraints. Position constraints are the vertical and horizontal spacing values. Hierarchical constraints are the joint document rules and multi-level document issuance rules. Format constraints are the font name, font size, line spacing, and page margin values. Compliance constraints are the security classification, urgency level, and signatory identifiers.

[0048] Specifically, the document's layout is constrained by several factors: Position constraints specify the vertical and horizontal spacing of core elements relative to page boundaries and other adjacent elements, ensuring compliance with regulations; Hierarchical constraints clarify the order of multiple issuing agencies in joint documents, document numbering rules, and the hierarchical arrangement of primary and secondary recipients in multi-level documents; Format constraints specify the font names, font sizes, line spacing, and margins for different levels of documents and core elements, unifying document format standards across the entire group; and Compliance constraints specify the location and font format requirements for security classification indicators, the layout rules for urgency indicators, and the format requirements for the signatory's name in upward-bound documents, ensuring all indicators comply with document compliance requirements. For example, in position constraints, the upper edge of the issuing agency's logo can be 35mm from the top of the page, centered horizontally; in format constraints, the body text can use size 3 Fangsong font with a line spacing of 28 points. The “page area” refers to the rectangular area on a document page after removing the margins, used for arranging the main text of the document. Its size and position are clearly defined in GB / T9704-2012.

[0049] S330: Construct a group-level document format knowledge graph by treating the core elements of official documents as entities and the format constraints as attributes or relationships.

[0050] Specifically, all the core elements of the decomposed official documents can be stored in the graph as entity nodes. Various format constraints can be mapped to entity attributes or relationships between entities, ultimately forming a searchable, dynamically updated group-level document format knowledge graph. For example, Resource Description Framework (RDF) triples can be used to store entities and relationships, thus forming a knowledge graph capable of inference. Knowledge graph construction tools can employ the Neo4j graph database or the Apache Jena framework, and queries can be performed using SPARQL (SPARQL Protocol and RDF Query Language) statements.

[0051] S400: Based on the structured document tree, document type and issuance level of electronic document data, match it in the group-level document format knowledge graph to determine the standard red-labeling paradigm.

[0052] In some embodiments, matching is performed in the group-level document format knowledge graph based on the structured document tree, document type, and issuance level of the electronic document data to determine the standard red-inking paradigm, including: Extract the issuing authority node and document type node from the structured document tree; The document level is determined by the issuing authority node, and the document type is determined by the document type node; By using the document level and document type as search criteria, matching red-ink templates are retrieved from the group-level document format knowledge graph to obtain the standard red-ink paradigm.

[0053] The mapping relationship between the issuing authority's name and the issuing level is pre-stored in the memory or stored as an attribute in the group-level document format knowledge graph.

[0054] For example, the issuing authority node might be labeled "XX Company." By querying the corresponding attributes of that authority in the knowledge graph, the document level is determined. If the document type node is labeled "Notice," then the document type is "Notice." Using the document level and document type as input, the knowledge graph searches for the corresponding standard red-line pattern node, returning the standard pattern including header style, red line position, and other standard elements. This process dynamically matches red-line patterns for different issuing authorities and document types, reducing manual intervention. For instance, document levels can be categorized as group headquarters, first-tier subsidiaries, and second-tier subsidiaries, each corresponding to a different red-line pattern; for example, group headquarters might use large, bold red text, while subsidiaries might use smaller, black text.

[0055] S500: Based on the standard red-line paradigm, extract the standard position and style information of the header entity, red-line entity, document number entity, and issuing agency logo entity from the group-level document format knowledge graph.

[0056] It should be understood that the header entity refers to the overall basic block entity that carries the issuing authority's logo, document number, red line, and other header elements of the official document. Its standard position information specifies the top and left / right margins of the header entity within the entire page of the document, and its standard style information specifies the overall width, height, background color, and border style requirements of the header entity. The red line entity refers to the horizontal dividing line entity that separates the header from the main body of the document. Its standard position information specifies the vertical coordinates and left and right endpoint positions of the red line within the header block, and its standard style information specifies the line width, color, and line style of the red line. The document number entity refers to the entity containing the issuing authority's logo, document number, red line, and other header elements. The document element entities, including the issuing authority's code, year, and document serial number, have standard position information specifying the exact coordinates of the document number relative to the issuing authority's logo and red line within the header area. Standard style information specifies the font, size, character spacing, and alignment of the document number. The issuing authority's logo entity, consisting of the full name or standardized abbreviation of the issuing authority plus the word "document," has standard position information specifying its vertical position and horizontal alignment within the header area. Standard style information specifies the font, size, color, and character spacing of the issuing authority's logo. Extracting the standard position and style information for all these entities provides a clear formatting basis for subsequent red-line formatting of electronic document data.

[0057] S600: Based on standard location and style information, generate red header areas and complete the red overlay in electronic document data.

[0058] In some embodiments, based on standard location information and style information, generating a red-headed area in the electronic document data and completing the red overlay includes: Based on the standard position and style information of the header entity, insert the issuing authority logo image or text in the header area of ​​the electronic document data, and set the font name, font size and color value; Based on the standard position information of the document number entity, insert the document number string below the issuing authority's logo; Based on the standard position and style information of the red-line entity, draw a red dividing line below the document number to complete the red overlay.

[0059] For example, in a Word document, the header area can be accessed through the object model. A text box can be inserted, its position set to a certain distance from the top margin, and the issuing authority's logo text can be entered. The font, size, and color can be set. Then, the document number string can be inserted below it. Finally, a red dividing line can be drawn, thus automatically generating the official header area. For PDF documents, the iText or PDFBox libraries can be used to add text and lines at specified coordinates. This step significantly reduces the time cost of manually creating official headers and improves the efficiency of red-line application.

[0060] S700: Compares the actual format parameters of electronic document data with the format constraints in the group-level document format knowledge graph, detects differences in font, font size, paragraph spacing, header position, footer position, missing elements, and redundant elements, and corrects the electronic document data according to the format constraints to generate standardized documents.

[0061] In some embodiments, the actual format parameters of the electronic document data are compared with the layout constraints in the group-level official document layout knowledge graph to detect differences in font, font size, paragraph spacing, header position, footer position, missing elements, and redundant elements. The electronic document data is then corrected according to the layout constraints to generate standardized documents, including: Traverse each node in the structured document tree to obtain the actual font name, actual font size value, actual paragraph spacing value, actual position coordinates, and actual element existence status of the node; The actual font name, actual font size value, actual paragraph spacing value, actual position coordinates, and actual element existence status are compared with the corresponding standard font name, standard font size value, standard paragraph spacing value, standard position coordinates, and standard element existence requirements in the group-level official document format knowledge graph to generate a difference list. The difference list includes font differences, font size differences, paragraph spacing differences, header position differences, imprint position differences, element missing, and element redundancy. Based on the list of differences, standard parameters from the group-level document format knowledge graph are used to modify the electronic document data in order to generate standardized documents.

[0062] It should be understood that each node of the structured document tree serves as an independent data storage unit, which records the actual font name, actual font size, actual paragraph spacing, and actual position coordinates inherited from the visual modality features, as well as the actual element existence status inherited from the text modality features.

[0063] For example, if traversing the tree nodes reveals that the actual font of a certain text paragraph does not match the requirements of the knowledge graph, the font difference is recorded; if a node lacks the "date of writing" element, the missing element is recorded; then, based on the difference list, the font is automatically modified to the standard value, missing elements are inserted, or redundant elements are deleted, thus completing the correction. This process can automatically detect and correct various format deviations, effectively reducing the workload of manual proofreading and improving the standardization and consistency of official document formats.

[0064] S800: When electronic document data involves joint issuance, multi-level forwarding, or cross-unit communication, format consistency reasoning is performed based on the format constraint relationship in the group-level document format knowledge graph to resolve format conflicts.

[0065] In some embodiments, when electronic document data involves joint issuance, multi-level forwarding, or cross-unit communication, format consistency reasoning is performed based on format constraint relationships in the group-level document format knowledge graph to resolve format conflicts, including: When multiple issuing authority identifiers or multiple document number entities are detected in electronic document data, it is determined to be a joint document issuance, multi-level forwarding, or cross-unit document issuance. Extract the arrangement order and hierarchical relationship of multiple issuing authority entities; Based on the hierarchical constraints in the group-level document format knowledge graph, verify whether the arrangement order and hierarchical relationship conform to the preset joint document issuance rules or multi-level document issuance rules; If not in compliance, the position, font name, and font size of the multiple issuing authorities' logos shall be adjusted in accordance with the joint document issuance rules or multi-level document issuance rules to resolve the layout conflict.

[0066] For example, if multiple issuing authority logos are detected, the knowledge graph stipulates that in joint documents, the lead authority should come first. If the current order does not match, their vertical positions will be automatically adjusted, and the font and size will be standardized to resolve conflicts. In joint document scenarios, hierarchical constraint reasoning through the knowledge graph can ensure that the arrangement order, font, and size of multiple issuing authority logos conform to the format requirements of official documents, avoiding layout chaos.

[0067] S900: Output a format correction report for standardized documents, which indicates the modifications and the basis for those modifications.

[0068] In some embodiments, a format correction report for the standardized document is output, including: Record the parameters before and after each modification during the correction process, as well as the clauses on which the modification is based. The clauses on which the modification is based are the specific entries of the format constraint relationships in the group-level document format knowledge graph. Summarize the parameters before modification, the parameters after modification, and the clauses on which the modification was based to generate a format correction report; Output standardized documents and format correction reports.

[0069] For example, during the correction process, a log entry is recorded for each format change, including the parameters before and after the change and the standard clauses on which it was based. Finally, all logs are compiled into a report, output in tabular or footnote form, for easy user review and traceability. This report provides a traceable basis for document format adjustments, enhancing the reliability of the entire automated processing workflow.

[0070] This application generates a structured document tree by integrating visual and textual modal features, and combines a group-level document format knowledge graph for standard red-heading paradigm matching and entity style extraction. This enables automatic generation of red-heading areas and red-heading operations, improving document production efficiency. Simultaneously, by comparing actual format parameters with format constraints in the knowledge graph, various format deviations can be detected and automatically corrected based on the constraints, helping to reduce manual verification costs and improve document format standardization. For joint issuance or multi-level forwarding scenarios, format consistency reasoning based on the graph resolves conflicts, improving the consistency and compliance of document formats across multiple levels of units. Furthermore, the output of a correction report with annotations of modifications and their basis provides traceable evidence for format adjustments, enhancing the reliability and standardization of the fully automated document processing process.

[0071] As can be seen from the above technical solutions, the embodiments of this application provide a method for automatic red-line marking and format correction of official documents, including: acquiring electronic document data of the document to be processed; performing document layout analysis on the electronic document data to obtain visual modal features; performing natural language processing on the electronic document data to obtain text modal features; fusing the visual modal features and text modal features to generate a structured document tree; constructing a group-level document format knowledge graph; matching the structured document tree, the document type and issuance level of the electronic document data in the group-level document format knowledge graph to determine the standard red-line marking paradigm; extracting the standard position information and style information of the header entity, red line entity, document number entity, and issuing agency logo entity from the group-level document format knowledge graph based on the standard red-line marking paradigm; and further refining the standard red-line marking paradigm based on the standard red-line marking paradigm. The system generates a red-headed area in the electronic document data and applies red lettering based on location and style information. It compares the actual format parameters of the electronic document data with the format constraints in the group-level document format knowledge graph, detecting differences in font, font size, paragraph spacing, header position, footer position, missing elements, and redundant elements. Based on the format constraints, it corrects the electronic document data to generate a standardized document. When the electronic document data involves joint issuance, multi-level forwarding, or cross-unit communication, it performs format consistency reasoning based on the format constraints in the group-level document format knowledge graph to resolve format conflicts. Finally, it outputs a standardized document format correction report, annotating the modifications and their basis, to address the issue of not being able to achieve truly unmanned and standardized document output throughout the entire process.

Claims

1. A method for automatic red-inking and format correction of official documents, characterized in that, The method is executed by a processor and includes: Obtain the electronic document data of the official documents to be processed; The electronic document data is subjected to document layout analysis to obtain visual modal features; Natural language processing is performed on the electronic document data to obtain text modality features; The visual modal features and the text modal features are fused to generate a structured document tree, wherein the nodes in the structured document tree correspond to the visual blocks, and the nodes are labeled with semantic roles and layout roles; Construct a group-level knowledge graph of official document formats; the group-level knowledge graph of official document formats includes the core elements of official documents and format constraint relationships; Based on the structured document tree, the document type and issuance level of the electronic document data, a match is made in the group-level document format knowledge graph to determine the standard red-inking paradigm; Based on the standard red-line paradigm, extract the standard position and style information of the header entity, red-line entity, document number entity, and issuing agency logo entity from the group-level document format knowledge graph; Based on the standard location information and style information, a red header area is generated in the electronic document data and the red header is applied. The actual format parameters of the electronic document data are compared with the format constraint relationships in the group-level official document format knowledge graph to detect differences in font, font size, paragraph spacing, header position, footer position, missing elements, and redundant elements. The electronic document data is then corrected according to the format constraint relationships to generate standardized documents. When the electronic document data involves joint issuance, multi-level forwarding, or cross-unit document issuance, format consistency reasoning is performed based on the format constraint relationship in the group-level document format knowledge graph to resolve format conflicts. Output a format correction report for the standardized document, which indicates the modifications and the basis for those modifications.

2. The method for automatic red-inking and format correction of official documents according to claim 1, characterized in that, The step of performing document layout analysis on the electronic document data to obtain visual modal features includes: Optical character recognition and document layout analysis are performed on the electronic document data to extract the position coordinates, block size, font name, font size, line spacing, and header / footer positions of visual blocks. The position coordinates, block size, font name, font size, line spacing, and header / footer positions are then used as the visual modal features.

3. The method for automatic red-inking and format correction of official documents according to claim 1, characterized in that, The natural language processing of the electronic document data to obtain text modal features includes: Natural language processing is performed on the electronic document data to identify the document type, issuing authority name, structural hierarchy title, and main text content, and the document type, issuing authority name, structural hierarchy title, and main text content are used as the text modal features.

4. The method for automatic red-inking and format correction of official documents according to claim 1, characterized in that, The step of fusing the visual modal features and the text modal features to generate a structured document tree includes: The visual blocks in the visual modality features are aligned with the text fragments in the text modality features, and semantic role labels and layout role labels are assigned to each aligned visual block to form a structured document tree containing several nodes; wherein, the semantic role labels are used to indicate the document element category, and the layout role labels are used to indicate the visual style category.

5. The method for automatic red-inking and format correction of official documents according to claim 1, characterized in that, The construction of the group-level document format knowledge graph includes: Extract the core elements of the official document, which include the header, issuing authority logo, document number, red line, title, addressee, main text, attachments, date of issuance, seal, imprint, and page number; Define layout constraints, which include position constraints, hierarchical constraints, format constraints, and compliance constraints. The position constraints are the vertical and horizontal spacing values. The hierarchical constraints are the joint document writing rules and multi-level document issuance rules. The format constraints are the font name, font size value, line spacing value, and page margin value. The compliance constraints are the security classification identifier, urgency level identifier, and signatory identifier. By treating the core elements of the official documents as entities and the format constraints as attributes or relationships, a group-level knowledge graph of official document formats is constructed.

6. The method for automatic red-inking and format correction of official documents according to claim 1, characterized in that, The step of matching the structured document tree, the document type, and the issuance level of the electronic document data in the group-level document format knowledge graph to determine the standard red-inking paradigm includes: Extract the issuing authority node and document type node from the structured document tree; The document level is determined based on the issuing authority node, and the document type is determined based on the document type node; Using the document issuance level and document type as query conditions, a matching red-ink template is retrieved from the group-level document format knowledge graph to obtain the standard red-ink paradigm.

7. The method for automatic red-inking and format correction of official documents according to claim 1, characterized in that, The step of generating a red-headed area and completing the red overlay in the electronic document data based on the standard location information and style information includes: Based on the standard position and style information of the header entity, insert the issuing authority logo image or text in the header area of ​​the electronic document data, and set the font name, font size and color value; Based on the standard position information of the document number entity, insert the document number string below the issuing authority mark; Based on the standard position and style information of the red line entity, a red dividing line is drawn below the document number to complete the red overlay.

8. The method for automatic red-inking and format correction of official documents according to claim 1, characterized in that, The process involves comparing the actual format parameters of the electronic document data with the format constraints in the group-level official document format knowledge graph, detecting differences in font, font size, paragraph spacing, header position, footer position, missing elements, and redundant elements, and correcting the electronic document data according to the format constraints to generate a standardized document, including: Traverse each node in the structured document tree to obtain the actual font name, actual font size value, actual paragraph spacing value, actual position coordinates, and actual element existence status of the node; The actual font name, actual font size value, actual paragraph spacing value, actual position coordinates, and actual element existence status are compared with the corresponding standard font name, standard font size value, standard paragraph spacing value, standard position coordinates, and standard element existence requirements in the group-level official document format knowledge graph to generate a difference list. The difference list includes font differences, font size differences, paragraph spacing differences, header position differences, imprint position differences, element missing, and element redundancy. Based on the list of differences, the electronic document data is modified by calling the standard parameters in the group-level document format knowledge graph to generate a standardized document.

9. The method for automatic red-inking and format correction of official documents according to claim 1, characterized in that, When the electronic document data involves joint issuance, multi-level forwarding, or cross-unit communication, format consistency reasoning is performed based on the format constraint relationships in the group-level document format knowledge graph to resolve format conflicts, including: When the electronic document data contains multiple issuing authority logo entities or multiple document number entities, it is determined to be a joint document issuance, multi-level forwarding, or cross-unit document issuance. Extract the arrangement order and hierarchical relationship of the multiple issuing authority identifier entities; Based on the hierarchical constraints in the group-level document format knowledge graph, verify whether the arrangement order and the hierarchical relationship conform to the preset joint document issuance rules or multi-level document issuance rules; If not, the position, font name, and font size of the multiple issuing authority logo entities shall be adjusted in accordance with the joint document issuance rules or multi-level document issuance rules to resolve the layout conflict.

10. The method for automatic red-inking and format correction of official documents according to claim 1, characterized in that, The output of the format correction report for the standardized document includes: Record the parameters before modification, parameters after modification, and the modification basis clauses for each modification during the correction process. The modification basis clauses are the specific entries of the format constraint relationships in the group-level official document format knowledge graph. The parameters before modification, the parameters after modification, and the terms on which the modification was based are summarized to generate a format correction report; Output the standardized document and the format correction report.