Document typesetting method and system, electronic equipment and storage medium
By employing multimodal parsing and dynamic template matching technologies, the problem of identifying non-text elements in official document formatting has been solved, enabling efficient automated formatting and improving the compliance and processing efficiency of official documents.
Patent Information
- Application Number
- CN202511351914.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2025-12-16
AI Technical Summary
Existing document formatting technologies are insufficient in processing non-text elements, resulting in low accuracy in identification and positioning, poor mixed document formatting effects, a lack of dynamic adaptation capabilities in template libraries, the need for manual intervention and modification, low processing efficiency, high formatting error rate, and difficulty in achieving automatic checking.
Multimodal parsing technology is used to extract multi-dimensional features of documents, identify structured and unstructured content, dynamically match the typesetting rule base, automatically adjust template parameters, perform compliance checks, and generate and correct the final typesetting result.
It enables rapid identification and format generation of official document elements, improves typesetting efficiency and accuracy, reduces manual operation, supports automatic switching of formats for different document types, and reduces system maintenance costs.
Smart Images

Figure CN121145831A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of document processing, and in particular to a document typesetting method, system, electronic device, and storage medium. Background Technology
[0002] Existing document formatting technologies typically rely on predefined rule templates and simple format recognition methods. Typical solutions employ text parsing based on keyword matching or regular expressions, combined with statically configured formatting parameters (such as fixed font size and margin dimensions) for document formatting. These systems generally include a rule recognition module, a static template library, and a basic formatting engine, capable of performing simple identification and layout adjustments for certain document elements according to national standards.
[0003] However, the aforementioned existing technologies have significant drawbacks. Because they primarily rely on text rule matching, their ability to handle non-text elements in official documents (such as official headers, seals, complex tables, and images) is insufficient, resulting in low accuracy in recognizing and locating official headers and seals, and poor mixed document layout. The template library used is statically configured and lacks dynamic adaptation capabilities, failing to automatically adjust layout parameters according to the actual document content structure. When encountering inconsistencies between the issuance form and the main text, or when cross-document type switching is required, manual intervention to modify the template is necessary, leading to low processing efficiency. Existing solutions generally lack a closed-loop intelligent verification mechanism, making it difficult to automatically check the completeness of elements and format compliance, resulting in a high format error rate. Errors easily accumulate in subsequent processing stages, severely impacting the efficiency and quality of official document issuance.
[0004] Therefore, this application provides a document typesetting method to solve the above-mentioned technical problems. Summary of the Invention
[0005] The purpose of this invention is to provide a document typesetting method, system, electronic device, and storage medium to solve the technical problems of low typesetting efficiency and high formatting error rate in the prior art.
[0006] To address the aforementioned technical problems, this invention provides a document formatting method, comprising:
[0007] In response to the received document data, multimodal parsing is performed to extract multidimensional features of the document data, and various structured elements and unstructured content contained in the document data are identified based on the multidimensional features. The multidimensional features include text semantic features, visual layout features, and layout structure features.
[0008] Based on the identified structured elements and unstructured content, a preset layout rule library is matched, and a suitable layout template is dynamically determined according to the parameterized template set in the layout rule library. The layout template parameters are then adjusted and configured according to the various structured elements.
[0009] Based on the determined typesetting template and typesetting template parameters, typesetting processing is performed on the text, image, and table content of the document data to generate preliminary typesetting results;
[0010] Perform compliance checks on the preliminary layout results to verify the completeness, format standardization, and consistency of various structured elements, and correct any deviations found during the checks.
[0011] Output the final layout result that passes the validation and meets the specifications, and record the relevant processing information.
[0012] In some specific embodiments, in response to received document data, multimodal parsing is performed to extract multidimensional features of the document data, and various structured elements and unstructured content contained in the document data are identified based on the multidimensional features, further including:
[0013] Based on natural language processing, the text content in document data is parsed to identify and extract various structured elements such as titles, agency names, and document numbers;
[0014] Detect images, seals, and table areas in document data to obtain corresponding location and visual attribute information;
[0015] The text semantic features and visual layout features are fused together to reconstruct the overall semantic structure and layout relationships of the document.
[0016] The output contains parsed results including various structured elements and unstructured content metadata.
[0017] In some specific embodiments, based on the identified structured elements and unstructured content, a preset layout rule library is matched; an appropriate layout template is dynamically determined according to the parameterized template set in the layout rule library; and the layout template parameters are adjusted and configured according to the structured elements, further including:
[0018] Based on the identified document type and the structure of various structured elements, the corresponding parameterized template in the typesetting rule library is called;
[0019] Based on the layout requirements defined by the specifications, the page area size, margin range, font type, and font size parameters are dynamically calculated and adjusted.
[0020] It adapts to the layout rules required by different document types to achieve automatic switching of the layout of various official document types;
[0021] Generate template description information that includes layout parameters and visual style rules.
[0022] In some specific embodiments, based on the determined typesetting template and typesetting template parameters, typesetting processing is performed on the document content of the document data to generate a preliminary typesetting result, further including:
[0023] Perform alignment and pagination processing on the text paragraphs based on the template description information;
[0024] Scaling and repositioning of images and table elements;
[0025] Implement line breaks and line continuation controls to ensure visual continuity of the text content;
[0026] Generate preliminary layout results that meet visual presentation requirements and semantic structure specifications.
[0027] In some specific embodiments, compliance checks are performed on the preliminary typesetting results to verify the completeness, format standardization, and consistency of various structured elements, and to correct any deviations detected during the checks, further including:
[0028] Compare key structured elements from different document sources to identify any inconsistencies in content;
[0029] Verify that the position and parameters of key visual elements meet the specifications.
[0030] Detect formatting deviations in the layout results and perform automatic corrections.
[0031] In some specific embodiments, the final typesetting result that passes verification and meets the specification requirements is output, and relevant processing information is recorded, further including:
[0032] Convert the final typesetting result to the specified output format;
[0033] Generate a visual preview of the layout results and provide methods for obtaining the results;
[0034] Record the application of rules and parameter adjustment information during the typesetting process;
[0035] Provides a mechanism for updating and expanding layout rules and templates.
[0036] In some specific embodiments, the method further includes:
[0037] During the typesetting process, monitor the output quality and status of each stage and automatically revert to the previous processing stage when an anomaly is identified.
[0038] Receive manual adjustment instructions from users regarding layout rules and template parameters, and update the layout rule library configuration;
[0039] Manage layout template versions, supporting multiple version calls and rollback functions;
[0040] Based on the processed record data, statistical analysis is performed on typesetting efficiency and quality.
[0041] Based on the same concept, the present invention also provides a document typesetting system, comprising:
[0042] The document data parsing module is configured to perform multimodal parsing in response to received document data, extract multi-dimensional features of the document data, and identify various structured elements and unstructured content contained in the document data based on the multi-dimensional features. The multi-dimensional features include text semantic features, visual layout features, and layout structure features.
[0043] The layout template adaptation module is configured to match a preset layout rule library based on the identified various structured elements and unstructured content, dynamically determine the adapted layout template according to the parameterized template set in the layout rule library, and adjust and configure the layout template parameters according to the various structured elements.
[0044] The preliminary typesetting result generation module is configured to perform typesetting processing on the text, image, and table content of the document data based on the determined typesetting template and typesetting template parameters, and generate a preliminary typesetting result.
[0045] The compliance verification module is configured to perform compliance verification on the preliminary layout results, verify the integrity, format standardization and consistency of various structured elements, and correct any deviations found during verification.
[0046] The typesetting result output module is configured to output the final typesetting result that has passed the verification and meets the specification requirements, and record relevant processing information.
[0047] Based on the same concept, the present invention also provides an electronic device, including: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of a document typesetting method.
[0048] Based on the same concept, the present invention also provides a computer-readable storage medium storing a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform steps of a document typesetting method.
[0049] Compared with existing technologies, its advantages are as follows:
[0050] This invention discloses a document typesetting method, system, electronic device, and storage medium. Through multimodal fusion parsing and dynamic template automatic matching, it achieves rapid identification of document elements and layout generation, improving typesetting efficiency. Utilizing a multimodal large-scale model to deeply understand document semantics and visual features, combined with a dynamic rule engine, it enhances typesetting accuracy and compliance. It possesses dynamic adaptability, automatically handling layout switching between different document types and adaptively adjusting the layout of non-text elements such as images and tables, reducing reliance on manual operation. Employing parametric template design and an open rule base interface shortens the development cycle for adapting to new formats and reduces the long-term maintenance costs of the system. Attached Figure Description
[0051] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0052] Figure 1 This is a flowchart illustrating some specific embodiments of the document formatting method of the present invention;
[0053] Figure 2 This is one of the flowcharts illustrating another embodiment of the document formatting method of the present invention;
[0054] Figure 3 This is a second flowchart illustrating another embodiment of the document formatting method of the present invention;
[0055] Figure 4 This is a schematic diagram of the structure of a document typesetting system according to some specific embodiments of the present invention;
[0056] Figure 5 This is a schematic diagram of the structure of an electronic device according to some specific embodiments of the present invention;
[0057] In the diagram, 710 is the processor; 720 is the memory; 730 is the input device; and 740 is the output device. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of this application clearer, the application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0059] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. The singular forms “a,” “said,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms, and “multiple” generally includes at least two unless the context clearly indicates otherwise.
[0060] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0061] It should be understood that although the terms first, second, third, etc., may be used in the embodiments of this application, these descriptions should not be limited to these terms. These terms are only used to distinguish the descriptions. For example, first may also be referred to as second without departing from the scope of the embodiments of this application, and similarly, second may also be referred to as first.
[0062] Depending on the context, the words “if” or “suppose” as used here can be interpreted as “when”, “when”, “in response to determination”, or “in response to detection”. Similarly, depending on the context, the phrases “if determination” or “if detection (of the stated condition or event)” can be interpreted as “when determination”, “in response to determination”, “when detection (of the stated condition or event)”, or “in response to detection (of the stated condition or event)”.
[0063] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that an article or device comprising a series of various structured elements includes not only those structured elements but also other structured elements not expressly listed, or structured elements inherent to such an article or device. Without further limitations, the inclusion of a structured element by the phrase "comprising one..." does not exclude the presence of other identical structured elements in the article or device comprising said structured element.
[0064] It should be noted that any symbols and / or numbers present in the specification that are not marked in the accompanying drawings are not reference numerals.
[0065] Reference Figure 1 A document formatting method, including:
[0066] S101, in response to the received document data, perform multimodal parsing, extract multidimensional features of the document data, and identify various structured elements and unstructured content contained in the document data based on the multidimensional features, wherein the multidimensional features include text semantic features, visual layout features, and layout structure features.
[0067] S102, based on the identified structured elements and unstructured content, match a preset layout rule library, dynamically determine the appropriate layout template according to the parameterized template set in the layout rule library, and adjust and configure the layout template parameters according to the structured elements.
[0068] S103, based on the determined typesetting template and typesetting template parameters, typesetting processing is performed on the text, image, and table content of the document data to generate a preliminary typesetting result;
[0069] S104, Perform compliance verification on the preliminary typesetting results to verify the integrity, format standardization and consistency of various structured elements, and correct any deviations found during verification;
[0070] S105 outputs the final layout result that passes the verification and meets the specification requirements, and records the relevant processing information.
[0071] Specifically, in this embodiment of the invention, in response to received document data, multimodal parsing is performed to extract multi-dimensional features of the document data. These multi-dimensional features include textual semantic features, visual layout features, and page layout features. Based on the extracted multi-dimensional features, various structured elements contained in the document data are identified, such as titles, issuing authorities, and document numbers, as well as unstructured content, such as images, seals, and table areas and their positional attributes. Based on the identified structured elements and unstructured content, a preset typesetting rule library is matched. According to the pre-stored set of parameterized templates in the rule library, a suitable typesetting template is dynamically determined, and the template parameters are adjusted based on the element attributes. The system performs automated adjustments and configurations; based on the determined typesetting template and parameters, it performs automated typesetting processing on the text, images, and tables in the document, including paragraph alignment and pagination, element scaling and positioning, word-by-word alignment and line break control, generating a preliminary typesetting result that conforms to the format specifications; it performs compliance verification on the preliminary typesetting result, verifying the integrity of elements, the standardization of format, and cross-document consistency, identifying whether there are element deviations, excessive seal or official header parameters, or inconsistent page size or margins, and automatically corrects the identified deviations; it outputs the final typesetting result that has been verified and meets the specifications, and records the template calls, parameter adjustments, and rule matching information during the typesetting process for querying and analysis.
[0072] For example, upon receiving a document containing an official header, title, issuing authority, body text, table, and seal, multimodal parsing is performed: Natural language processing is used to extract the title text features "Notice from a Certain Unit Regarding a Certain Matter" and the document number "XX Issued
[2024] No. X". A computer vision model detects that the official header area is located at the top of the page, with dimensions of 156mm width and 25mm height; the seal is located in the lower right corner, 30mm from the right edge and 35mm from the bottom edge; and the table is 3 rows and 3 columns, centered. Based on the identified elements, a "Notice" type official header document template is matched against the rule base, dynamically adjusting template parameters such as setting the page layout size to 156mm width and 22mm height. The font size is 5mm, top margin is 45mm, title font is 2-point Songti, first-level headings in body text are 3-point Heiti, second-level headings are 3-point Kaiti, and other body text is 3-point Fangsongti; the content is formatted according to the template parameters: titles are centered, body text is justified, tables are scaled to the width of the text area and centered, and the seal is positioned at the specified coordinates in the lower right corner; the formatting results are verified: the document number is checked to be consistent with the issuance form, the seal position meets the standard requirements, tables have no page breaks, and if the line spacing of the body text is found to be slightly greater than the standard value, it is automatically adjusted to the standard line spacing; finally, a WORD version of the official document that conforms to the format specifications is output, and the template version used for this formatting, parameter adjustment log, and verification results are recorded.
[0073] In some applications, multimodal parsing is performed in response to received document data to extract multidimensional features of the document data, and various structured elements and unstructured content contained in the document data are identified based on the multidimensional features. This includes parsing the text content in the document data based on natural language processing, identifying and extracting various structured elements such as titles, agency names, and document numbers; detecting images, seals, and table areas in the document data, and obtaining corresponding location information and visual attribute information; fusing the text semantic features with visual layout features to reconstruct the overall semantic structure and layout relationship of the document; and outputting the parsing results containing metadata of various structured elements and unstructured content.
[0074] Understandably, the process involves using natural language processing (NLP) to parse the text content in document data, identify and extract key structured elements such as titles, issuing authority names, and document numbers; detect images, seals, and table areas in the document data, and obtain their location coordinates and visual attribute information; fuse the obtained text semantic features with visual layout features to reconstruct the overall semantic logical structure and layout relationships of the document; and output a complete parsing result containing all identified structured elements and unstructured content metadata.
[0075] For example, upon receiving an official document, multimodal parsing is initiated: the text is parsed using a natural language processing model to identify structured elements such as the title "Notice on Carrying Out Annual Assessment Work," the issuing authority "XX Municipal Human Resources and Social Security Bureau," and the document number "XX Human Resources and Social Security Document
[2024] No. 15"; the document is inspected using a computer vision model to identify a red header image area centered at the top of the page with a width of 156mm and a height of 22mm, a circular seal area located at the bottom right corner of the text, 28mm from the right edge and 20mm from the bottom edge, and a 3-row, 4-column table area; the extracted text elements are fused with visual element information to reconstruct the document's semantic structure (such as the logical relationship between title, issuing authority, text, and seal) and layout (such as the red header centered, the table on the left, and the seal on the right); the parsing results are output, containing metadata about the type, content, coordinates, and size of all elements, providing structured input for subsequent typesetting.
[0076] In some applications, based on the identified structured elements and unstructured content, a preset typesetting rule library is matched. The appropriate typesetting template is dynamically determined according to the set of parameterized templates in the typesetting rule library. The typesetting template parameters are adjusted and configured according to the identified structured elements, including calling the corresponding parameterized templates in the typesetting rule library based on the identified document type and the structure of various structured elements; dynamically calculating and adjusting parameters such as text area size, margin range, font type, and font size based on the format requirements defined by the specifications; adapting the typesetting rules required for different document types to achieve automatic format switching for various document types; and generating template description information containing typesetting parameters and visual style rules.
[0077] Understandably, based on the identified document type and the composition of each structured element, the corresponding parameterized template pre-stored in the typesetting rule library is invoked; based on the layout standards explicitly defined in the specifications, the page size, margin range, font type, and font size parameters are dynamically calculated and adjusted; the specific typesetting rules required for different document types are automatically adapted to achieve automatic switching and matching of layouts for multiple document types; and a complete template description information containing all typesetting parameters and visual style rules is generated.
[0078] For example, the system identifies the document type as "Notice" and includes title and document number elements such as "XX Unit" and "XX Document
[2024] No. X," as well as a red header area at the top of the page measuring 156mm × 25mm. Based on this, it calls the parameterized template for "Notice" in the rule base and dynamically calculates parameters according to the specifications: setting the page area size to 156mm × 225mm, top margin 37mm, bottom margin 35mm, left margin 28mm, right margin 26mm, title font to 2-point Songti, body text font to 3-point Fangsongti, and font size to 16pt; automatically adapting to the specific rules of the "Notice" document type to differentiate its format from other document types such as "Letter" and "Minutes"; and generating template description information containing all the above parameters and style rules to drive subsequent typesetting operations.
[0079] In some applications, based on the determined typesetting template and typesetting template parameters, typesetting processing is performed on the document content of the document data to generate preliminary typesetting results, including aligning and paginating text paragraphs according to template description information; scaling and adjusting the position of image and table elements; performing text line-by-line and line-breaking control to make the text content visually coherent; and generating preliminary typesetting results that meet visual presentation requirements and semantic structure specifications.
[0080] Understandably, based on the rule parameters contained in the obtained template description information, automatic alignment and pagination are performed on the text paragraphs in the document; image elements and table elements contained in the document are scaled and precisely positioned according to the template parameters; text parallel processing and line break control logic are executed to ensure that the text content has visual coherence and standardization; and preliminary typesetting results that meet the established visual presentation requirements and deep semantic structure specifications are generated.
[0081] For example, based on the template description information, the document is formatted as follows: all paragraphs in the main text are justified and automatically paginated according to the page height to ensure that the number of lines per page does not exceed the specified value; images with a width of 120mm and a height of 80mm in the document are scaled to 100% of the page width and centered; tables with 3 columns and 5 rows are scaled to the page width and left-aligned; whole words are processed in the same line to avoid single words being split on different lines, while punctuation marks are controlled to avoid the beginning and end of paragraphs to ensure that the end of paragraphs is aligned; a preliminary formatted result in DOCX format containing the processed text, images, and tables is generated, which conforms to the visual specifications of official documents and maintains the integrity of the original semantic structure.
[0082] In some applications, compliance checks are performed on the preliminary layout results to verify the integrity, format standardization, and consistency of various structured elements, and to correct any deviations found. This includes comparing key structured elements from different document sources to identify any inconsistencies in content; verifying whether the position and parameters of key visual elements meet the specifications; detecting format deviations in the layout results; and performing automatic corrections.
[0083] Understandably, this involves comparing key structured elements from different document sources to identify inconsistencies or logical conflicts; verifying whether the position coordinates and size parameters of key visual elements meet preset specifications; detecting format deviations in the layout results; and performing automatic correction operations based on correction rules in the rule base.
[0084] For example, compliance checks are performed on the formatted notification documents: the document number in the issuance form is compared with that in the main text. It is found that the issuance form record is "XXfa
[2024] No. 10" while the main text is "XXfa
[2024] No. 01". The inconsistency is identified and the document number in the main text is automatically corrected to be consistent with the issuance form. The check finds that the distance from the top margin of the red header is 40mm (the standard should be 37mm) and the distance from the right margin of the seal is 20mm (the standard should be no less than 25mm). The red header position is automatically adjusted to 37mm and the right margin of the seal is adjusted to 25mm. It is detected that the main text is in 4-point Song typeface (the standard for the main text should be that the first-level headings are in bold, the second-level headings are in regular script, and the rest of the content is in imitation Song typeface). The first-level headings in the main text are automatically adjusted to 3-point bold, the second-level headings are in 3-point regular script, and the rest of the main text content is adjusted to 3-point imitation Song typeface, generating a corrected formatted result that meets all the requirements of the specifications.
[0085] In some applications, the output is a final layout result that passes verification and meets the specifications, and relevant processing information is recorded, including converting the final layout result into a specified output format; generating a visual preview of the layout result and providing a way to obtain the result; recording the application of rules and parameter adjustment information during the layout process; and providing a mechanism to update and expand the layout rules and templates.
[0086] Understandably, the system should convert the final typesetting result into the standard output format specified by the system; generate a visual preview interface of the typesetting result and provide users with a way to obtain the result; record detailed information on the rule entries and parameter adjustments applied during the typesetting process; and provide a maintenance mechanism for updating and expanding the typesetting rule set and parameterized templates.
[0087] For example, the system outputs the validated layout results as a Word document and saves them; it generates a visual preview page containing the complete layout effect, allowing users to preview or download the final document via a web interface; it records detailed logs of the national standard rule IDs for "Official Document Formats of Party and Government Organs" used during the processing; and it provides a rule management interface where users can add custom document templates or modify existing template parameters based on their actual needs, such as changing the document title from Fangzheng Xiaobiao Song_GBK to Fangzheng Xiaobiao Song_GB2312, and changing the Fangsong font in the body text to Fangsong_GB2312.
[0088] Some of these applications also include monitoring the output quality and status of each stage during the typesetting process, automatically reverting to the previous processing stage when anomalies are identified; receiving manual adjustment instructions from users for typesetting rules and template parameters, and updating the typesetting rule library configuration; managing typesetting template versions, supporting multi-version calling and backtracking functions; and performing statistical analysis on typesetting efficiency and quality based on processing record data.
[0089] Understandably, the system continuously monitors the output quality and processing status of each stage throughout the entire typesetting process, automatically reverting to the previous processing stage when an anomaly is detected; it receives manual adjustment instructions from users regarding typesetting rules or template parameters and updates the configuration information of the typesetting rule library according to the instructions; it manages the versions of the typesetting templates used, supporting the calling and backtracking of multiple historical versions; and it performs multi-dimensional statistical analysis on typesetting efficiency and output quality based on recorded processing data.
[0090] For example, the system monitors the status of each stage in real time during the typesetting process. When the accuracy of element recognition output from the multimodal parsing stage is lower than the set threshold, it automatically reverts to the parsing stage for reprocessing. It receives modification instructions submitted by users through the management interface, adjusts the standard font size of official documents, and updates the corresponding parameters in the rule base synchronously. Based on processing record data from the past 30 days, statistical analysis shows that the average typesetting processing time is 2.5 minutes, the format compliance rate reaches 99.2%, and statistical reports containing the number of documents processed and the success rate of each document type are generated.
[0091] The following is combined with Figure 2 and Figure 3 Another embodiment of the document typesetting method of the present invention is described below:
[0092] like Figure 2 and Figure 3As shown, this embodiment constructs a multimodal, large-model-driven intelligent processing framework, comprising three core modules: a document parsing engine (integrating NLP / CV technology), a dynamic rule base (GB / T 9704-2012 parameterized storage), and an intelligent verification platform. This achieves deep compatibility between the WPS platform and domestic office software. NLP / CV technology is used to parse uploaded documents, employing methods such as a feature extraction network for official documents, a table structure reconstruction algorithm, and a seal coordinate positioning system to digitize elements of unstructured documents. Semantic understanding-based template dynamic adaptation technology includes: an 18-element automatic alignment engine (font / size / line spacing, etc.), a cross-document format switching mechanism (announcements / minutes, etc.), consistency recognition of attachment descriptions and titles, and ensuring format compliance during document processing. A dual verification system integrating NLP and computer vision is implemented: correlation analysis of issuance forms and main text elements, and adaptive adjustment of page margin size.
[0093] This embodiment's architecture includes: an input layer supporting Word document uploads; a parsing layer consisting of a multimodal semantic analysis module; a processing layer comprising a dynamic template engine and a compliance verification module; and an output layer for automatically formatting standardized official documents in red.
[0094] The multimodal document parsing module uses NLP technology to extract 18 document elements, such as the title and issuing authority, to improve recognition accuracy; it also integrates visual model technology to automatically detect the coordinates of non-text elements such as graphs and tables.
[0095] The dynamic typesetting engine has a built-in GB / T 9704-2012 standard template library, supporting format rules for 15 types of documents, including official documents and minutes. It automatically matches parameters such as font size (2-point font for official document titles and 3-point font for body text) and font (small Song for official document titles, bold for first-level body text titles, Kai for second-level body text titles, and Fangsong for other body text content) through the rule engine.
[0096] The intelligent verification system compares the issuance order with the main text elements (such as document number and security classification) based on a multimodal large model, and automatically corrects any inconsistencies; it also checks for common errors such as different lines for whole words in real time.
[0097] For the purpose of simplicity, the method steps disclosed in the above embodiments are described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0098] like Figure 4 As shown, the present invention also provides a document typesetting system, comprising:
[0099] The document data parsing module 201 is configured to perform multimodal parsing in response to received document data, extract multi-dimensional features of the document data, and identify various structured elements and unstructured content contained in the document data based on the multi-dimensional features. The multi-dimensional features include text semantic features, visual layout features, and layout structure features.
[0100] The layout template adaptation module 202 is configured to match a preset layout rule library based on the identified various structured elements and unstructured content, dynamically determine the adapted layout template according to the parameterized template set in the layout rule library, and adjust and configure the layout template parameters according to the various structured elements.
[0101] The preliminary typesetting result generation module 203 is configured to perform typesetting processing on the text, image, and table content of the document data based on the determined typesetting template and typesetting template parameters, and generate a preliminary typesetting result.
[0102] The compliance verification module 204 is configured to perform compliance verification on the preliminary layout results, verify the integrity, format standardization and consistency of various structured elements, and correct any deviations found during verification.
[0103] The typesetting result output module 205 is configured to output the final typesetting result that has passed the verification and meets the specification requirements, and record relevant processing information.
[0104] It is worth noting that although only some basic functional modules are disclosed in the embodiments of this invention, it does not mean that the composition of this system is limited to the above-mentioned basic functional modules. On the contrary, what this embodiment intends to express is that, based on the above-mentioned basic functional modules, those skilled in the art can arbitrarily add one or more functional modules in combination with existing technology to form an infinite number of embodiments or technical solutions. That is to say, this system is open rather than closed. The fact that this embodiment only discloses a few basic functional modules should not be considered as the scope of protection of the claims of this invention being limited to the disclosed basic functional modules. At the same time, for the convenience of description, the above device is described separately according to its functions as various units and modules. Of course, in implementing this invention, the functions of each unit and module can be implemented in one or more software and / or hardware.
[0105] like Figure 5 As shown, the present invention also provides an electronic device, including: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of a document typesetting method.
[0106] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. For example... Figure 5 The structure shown in this embodiment of the invention includes an electronic device comprising one or more processors 710 and a memory 720; the processors 710 in this electronic device may be one or more. Figure 5 Taking a processor 710 as an example; the memory 720 is used to store one or more programs; the one or more programs are executed by the one or more processors 710, so that the one or more processors 710 implement a document typesetting method as described in any one of the embodiments of the present invention.
[0107] The electronic device may also include an input device 730 and an output device 740.
[0108] The processor 710, memory 720, input device 730, and output device 740 in this electronic device can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.
[0109] The memory 720 in this electronic device serves as a computer-readable storage medium, capable of storing one or more programs. These programs can be software programs, computer-executable programs, or modules, such as the program instructions / modules corresponding to the document formatting method provided in this embodiment of the invention. The processor 710 executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the memory 720, thereby implementing the document formatting method described in the above embodiment.
[0110] The memory 720 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device. Furthermore, the memory 720 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 720 may further include memory remotely located relative to the processor 710, which can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0111] Input device 730 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the electronic device. Output device 740 may include display devices such as a display screen.
[0112] The present invention also provides a computer-readable storage medium storing a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of a document typesetting method.
[0113] Specifically, the computer storage medium in this embodiment of the invention can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be—but is not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for formatting official documents, characterized in that, include: In response to the received document data, multimodal parsing is performed to extract multidimensional features of the document data, and various structured elements and unstructured content contained in the document data are identified based on the multidimensional features. The multidimensional features include text semantic features, visual layout features, and layout structure features. Based on the identified structured elements and unstructured content, a preset layout rule library is matched, and a suitable layout template is dynamically determined according to the parameterized template set in the layout rule library. The layout template parameters are then adjusted and configured according to the various structured elements. Based on the determined typesetting template and typesetting template parameters, typesetting processing is performed on the text, image, and table content of the document data to generate preliminary typesetting results; Perform compliance checks on the preliminary layout results to verify the completeness, format standardization, and consistency of various structured elements, and correct any deviations found during the checks. Output the final layout result that passes the validation and meets the specifications, and record the relevant processing information.
2. The document typesetting method according to claim 1, characterized in that, In response to received document data, multimodal parsing is performed to extract multidimensional features from the document data, and various structured elements and unstructured content contained in the document data are identified based on the multidimensional features, further including: Based on natural language processing, the text content in document data is parsed to identify and extract various structured elements such as titles, agency names, and document numbers; Detect images, seals, and table areas in document data to obtain corresponding location and visual attribute information; The text semantic features and visual layout features are fused together to reconstruct the overall semantic structure and layout relationships of the document. The output contains parsed results including various structured elements and unstructured content metadata.
3. The document typesetting method according to claim 1, characterized in that, Based on the identified structured elements and unstructured content, a preset layout rule library is matched, and a suitable layout template is dynamically determined according to the parameterized template set in the layout rule library. Furthermore, the layout template parameters are adjusted and configured according to the identified structured elements. Based on the identified document type and the structure of various structured elements, the corresponding parameterized template in the typesetting rule library is called; Based on the layout requirements defined by the specifications, the page margins, font type, and font size parameters are dynamically calculated and adjusted. It adapts to the layout rules required by different document types to achieve automatic switching of the layout of various official document types; Generate template description information that includes layout parameters and visual style rules.
4. The document typesetting method according to claim 3, characterized in that, Based on the determined typesetting template and typesetting template parameters, typesetting processing is performed on the document content of the document data to generate a preliminary typesetting result, further including: Perform alignment and pagination processing on the text paragraphs based on the template description information; Scaling and repositioning of images and table elements; Implement line breaks and line continuation controls to ensure visual continuity of the text content; Generate preliminary layout results that meet visual presentation requirements and semantic structure specifications.
5. The document typesetting method according to claim 1, characterized in that, Perform compliance checks on the preliminary layout results to verify the completeness, format standardization, and consistency of various structured elements, and correct any deviations found during the checks, further including: Compare key structured elements from different document sources to identify any inconsistencies in content; Verify that the position and parameters of key visual elements meet the specifications. Detect formatting deviations in the layout results and perform automatic corrections.
6. The document typesetting method according to claim 1, characterized in that, Output the final layout result that passes validation and meets the specifications, and record relevant processing information, including: Convert the final typesetting result to the specified output format; Generate a visual preview of the layout results and provide methods for obtaining the results; Record the application of rules and parameter adjustment information during the typesetting process; Provides a mechanism for updating and expanding layout rules and templates.
7. A document typesetting method according to claim 1, characterized in that, The method further includes: During the typesetting process, monitor the output quality and status of each stage and automatically revert to the previous processing stage when an anomaly is identified. Receive manual adjustment instructions from users regarding layout rules and template parameters, and update the layout rule library configuration; Manage layout template versions, supporting multiple version calls and rollback functions; Based on the processed record data, statistical analysis is performed on typesetting efficiency and quality.
8. A document typesetting system, characterized in that, include: The document data parsing module is configured to perform multimodal parsing in response to received document data, extract multi-dimensional features of the document data, and identify various structured elements and unstructured content contained in the document data based on the multi-dimensional features. The multi-dimensional features include text semantic features, visual layout features, and layout structure features. The layout template adaptation module is configured to match a preset layout rule library based on the identified various structured elements and unstructured content, dynamically determine the adapted layout template according to the parameterized template set in the layout rule library, and adjust and configure the layout template parameters according to the various structured elements. The preliminary typesetting result generation module is configured to perform typesetting processing on the text, image, and table content of the document data based on the determined typesetting template and typesetting template parameters, and generate a preliminary typesetting result. The compliance verification module is configured to perform compliance verification on the preliminary layout results, verify the integrity, format standardization and consistency of various structured elements, and correct any deviations found during verification. The typesetting result output module is configured to output the final typesetting result that has passed the verification and meets the specification requirements, and record relevant processing information.
9. An electronic device, characterized in that, include: The system includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; the memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of the method according to any one of claims 1 to 7.