A Template-Based Method for Automatic Color Overlay and Format Integration Generation of Multiple Documents

By using hash fingerprinting and local updates for format elements, the problem of repetitive calculations in batch document overlay is solved, achieving efficient format integration and generation.

CN123117014APending Publication Date: 2026-11-17HUANENG INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611300230.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-26
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies, when generating batches of documents for red-marking and format integration, suffer from computational redundancy due to the need for full-volume reformatting of each document, making it impossible to reuse existing pagination decisions and resulting in low processing efficiency.

Method used

By hashing the format element layout size attribute sequence, a fingerprint decision cache pool is constructed, which directly reuses the document pagination decision sequence with the same fingerprint and performs local updates within the local sub-network, reducing the computation of repeated format constraint propagation.

Benefits of technology

It improves the processing throughput efficiency of batch document red-format integration and generation, reduces redundant calculations, and enhances processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123117014A_ABST
    Figure CN123117014A_ABST
Patent Text Reader

Abstract

This invention relates to the field of document processing technology and discloses a method for automatically generating multi-document red-marking and format integration based on template rules. The method includes: extracting the pagination decision sequence and the baseline constraint fingerprint of the baseline document; calculating the constraint fingerprint of subsequent documents and comparing it with the existing fingerprint; if a match is found, reusing the pagination decision sequence; if a match is not found, identifying the set of differing elements, delineating the affected local subnetwork in the format constraint propagation network, performing local constraint updates and generating a complete pagination decision sequence; caching the fingerprint and decision mapping and rendering and outputting the red-marking format integrated document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of document processing technology, and specifically to a method for automatically highlighting and integrating formatting of multiple documents based on template rules. Background Technology

[0002] In scenarios involving batch document overlay and format integration generation, numerous documents under the same template share highly similar layout constraint structures, with only minor differences in the content length of a few filler fields. Existing solutions independently trigger the construction of a complete format constraint propagation network and full pagination calculation process for each document. This results in the repeated construction and propagation of numerous layout constraint topologies, leading to low throughput efficiency in batch format integration generation. Summary of the Invention

[0003] This invention provides a method for automatic red-coloring and format integration generation of multiple documents based on template rules, which solves the technical problems in related technologies where batch document red-coloring processing results in computational redundancy and the inability to reuse existing pagination decisions due to full-volume re-layout of each document.

[0004] This invention discloses a method for automatically applying red text and integrating formatting across multiple documents based on template rules, comprising: Obtain a baseline document from the batch of documents to be processed, perform template rule parsing and format constraint propagation network construction on the baseline document, perform page-by-page capacity filling calculation, and record the baseline pagination decision sequence; The layout size attribute values ​​of each format element in the benchmark document are concatenated in the order of element position and then the hash digest is calculated to generate the benchmark constraint fingerprint. For each subsequent document to be red-labeled in the batch document set, extract the layout size attribute values ​​of each format element in the same position order and calculate the hash digest to generate the current document constraint fingerprint; The current document constraint fingerprint is compared with the baseline constraint fingerprint and the existing fingerprints in the fingerprint decision cache pool. If they match, the corresponding pagination decision sequence is directly reused and the rendering output is executed. If the current document constraint fingerprint is inconsistent with all existing fingerprints, then the layout size attribute values ​​of the current document and the reference document are compared element by element to identify the set of differences and generate a list of differences in element changes. Locate the nodes corresponding to the differences in the format constraint propagation network, and delineate the affected local subnetworks according to the constraint propagation depth threshold. Local capacity filling calculations and format pressure signal propagation are performed only within the affected local sub-networks to generate local update pagination decisions. These decisions are then merged with the parts of the baseline pagination decision sequence that do not belong to the affected local sub-networks, and the page numbering and header / footer content are updated in a cascading manner to generate the complete pagination decision sequence for the current document. Store the current document constraint fingerprint and the corresponding complete pagination decision sequence into the fingerprint decision cache pool, and render and output the integrated document in red format based on the complete pagination decision sequence.

[0005] Furthermore, the format constraint propagation network is a directed graph structure, where the nodes correspond to the format elements in the document, the directed edges represent the page space dependency relationship between adjacent elements or containers and the content, and the constraint propagation direction is consistent with the subordinate order of document layout; the format pressure signal is an overflow signal generated when the remaining page space is insufficient to accommodate the current format element, and the format pressure signal propagates along the directed edges to subsequent constraint nodes and triggers the pagination point insertion operation.

[0006] Furthermore, the constraint propagation depth threshold is the maximum number of hops propagating along the directed edge from the difference node; when the size change of the difference element exceeds the remaining capacity of the current page, the constraint propagation depth threshold is extended to the first constraint node of the next page.

[0007] Furthermore, when calculating the constraint fingerprint of the current document, the sequence of layout size attribute values ​​is first segmented and encoded according to element type. Incremental hash is calculated for segments containing variable length fields, and the results of previous calculations are reused for segments containing fixed size elements.

[0008] Furthermore, during the merging and combining phase, the changes in page numbers caused by local update pagination decisions are statistically analyzed. Only page numbers whose pagination point positions are after the affected area in the baseline pagination decision sequence are subject to offset correction. Static content in the header and footer that does not contain dynamic page number references is not re-rendered.

[0009] Furthermore, the cached entries in the fingerprint decision cache pool are sorted by hit frequency, and entries with a hit frequency lower than a preset threshold are eliminated.

[0010] This invention discloses a multi-document automatic overlay and format integration generation system based on template rules, comprising: The benchmark processing module is used to obtain benchmark documents from the batch of documents to be processed, perform template rule parsing and format constraint propagation network construction and page-by-page capacity filling calculation, record the benchmark pagination decision sequence, and calculate the hash digest by concatenating the layout size attribute values ​​of each format element in the order of element position to generate benchmark constraint fingerprints. The fingerprint comparison module is used to calculate the constraint fingerprint of each subsequent document to be red-copied, compare the constraint fingerprint with the baseline constraint fingerprint and the existing fingerprint in the fingerprint decision cache pool, and output the comparison results and the corresponding reuse pagination decision sequence or trigger difference analysis. The difference analysis module is used to compare the layout size attribute values ​​of the current document with those of the baseline document element by element when the constraint fingerprints are inconsistent, and generate a list of differences in element changes. The local subnetwork delineation module is used to locate the nodes corresponding to the differences in the format constraint propagation network and delineate the affected local subnetworks according to the constraint propagation depth threshold. The local update module is used to perform local capacity filling calculation and format pressure signal propagation within the affected local sub-network, generate local update pagination decisions, and cascade update page numbering and header / footer content after merging with the baseline pagination decision sequence to generate the complete pagination decision sequence for the current document. The caching and rendering module is used to store the current document constraint fingerprint and the complete pagination decision sequence into the fingerprint decision cache pool, and render and output the integrated document in red-out format based on the complete pagination decision sequence.

[0011] Furthermore, when the size change of the difference element exceeds the remaining capacity of the current page, the local sub-network delineation module extends the constraint propagation depth threshold to the first constraint node of the next page.

[0012] Furthermore, the caching and rendering module sorts the cache entries in the fingerprint decision cache pool according to their hit frequency and removes entries with a hit frequency lower than a preset threshold.

[0013] The beneficial effects of this invention are as follows: This invention solves the technical problem of low processing throughput caused by repeated execution of full format constraint propagation network construction and pagination calculation in batches of documents under the same template by hashing the format element layout size attribute sequence and constructing a fingerprint decision cache pool. It achieves the technical effect of reducing repeated format constraint propagation calculation and improving the processing throughput of batch red-color format integration generation. Attached Figure Description

[0014] Figure 1 This is a flowchart of a method for automatically highlighting and integrating formats of multiple documents based on template rules, provided in an embodiment of the present invention. Detailed Implementation

[0015] The subject matter described herein will now be discussed with reference to exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and implement the subject matter described herein, and changes may be made to the function and arrangement of the elements discussed without departing from the scope of this specification. Various processes or components may be omitted, substituted, or added as needed in the examples. Furthermore, some features described in the examples may be combined in other examples.

[0016] At least one embodiment of the present invention discloses a method for automatic overlaying and format integration generation of multiple documents based on template rules, see [link to documentation]. Figure 1 This includes the following steps: Step 1: Extract the pagination decision sequence and baseline constraint fingerprint of the baseline document.

[0017] The first document in the batch of documents to be processed is obtained as the baseline document. A complete template rule parsing and format constraint propagation network is constructed on the baseline document, and page-by-page capacity filling calculation is performed, recording the baseline pagination decision sequence. The layout size attribute value of each format element in the baseline document is extracted, and the layout size attribute values ​​of each element are concatenated according to the element's position in the document to calculate a hash digest, generating the baseline constraint fingerprint.

[0018] It should be noted that the layout size attribute value refers to the quantitative description of the space occupied by the formatting element on the page, including paragraph height, number of character lines, chart boundary size, and table row and column size, etc. The formatting constraint propagation network is a directed graph structure, where the nodes correspond to the various formatting elements in the document, and the directed edges represent the page space dependencies between adjacent elements or containers and the content. The direction of constraint propagation in the network is consistent with the subordinate order of the document layout.

[0019] Step 2: Calculate the constraint fingerprint of the current document and perform fingerprint comparison.

[0020] For each document in the batch document set to be subsequently highlighted, extract the layout size attribute values ​​of each format element. Concatenate the layout size attribute values ​​of each element in the same positional order as in step 1, and calculate the hash digest to generate the current document constraint fingerprint. Compare the current document constraint fingerprint with the baseline constraint fingerprint and the existing fingerprints in the fingerprint decision cache pool in turn. If the current document constraint fingerprint is completely consistent with any existing fingerprint, directly reuse the corresponding pagination decision sequence, jump to step 6 to perform rendering output, and skip steps 3 to 5.

[0021] In this embodiment of the application, in order to reduce the resource consumption of hash digest calculation, before splicing the layout size attribute values ​​of each element, the attribute value sequence can be segmented and encoded according to the element type. Incremental hash is calculated only for segments containing variable length fields, and the previous calculation results are reused for segments containing fixed size elements, thereby reducing the amount of repeated hash operations.

[0022] Step 3: Identify the set of elements that differ between the current document and the baseline document.

[0023] When the current document constraint fingerprint is inconsistent with all existing fingerprints, the layout size attribute values ​​of the current document and the baseline document are compared element by element. The set of differing elements whose layout size attribute values ​​have changed is identified, the size change of each differing element is calculated, and a list of differing element changes is generated. The list of differing element changes records the element identifier of each differing element, its position index of the corresponding node in the format constraint propagation network, and its size change.

[0024] Step 4: Define the affected local subnetworks in the format constraint propagation network.

[0025] In the format constraint propagation network, locate the network nodes corresponding to each difference element in the list of difference element changes. Starting from these nodes, trace their directly associated constraint nodes along the directed edges. Determine all nodes reachable from the difference nodes by a finite number of hops according to the constraint propagation depth threshold. The subgraph formed by these nodes and the directed edges between them is determined as the affected local subnetwork.

[0026] It should be noted that the constraint propagation depth threshold refers to the maximum number of hops propagating along directed edges from the difference node, used to control the boundary range of the local subnetwork. The constraint propagation depth threshold can be preset based on the number of constraint levels in the template structure, or it can be adaptively adjusted based on the size change of the difference element: when the size change exceeds the remaining capacity of the current page, the constraint propagation depth threshold is extended to the first constraint node of the next page to cover possible cross-page effects.

[0027] Step 5: Perform local constraint updates and generate the complete pagination decision sequence for the current document.

[0028] Within the affected local sub-network, the original size values ​​of the differing elements are replaced with the new size values. The local capacity filling calculation and format pressure signal propagation are then re-executed to generate a local update pagination decision. The local update pagination decision and the portions of the baseline pagination decision sequence that do not belong to the affected local sub-network are concatenated and merged. The pagination point displacement caused by the local update is then cascaded along the subsequent direction of the document to update the affected page numbers and header / footer content, generating the complete pagination decision sequence for the current document.

[0029] It should be noted that the format pressure signal refers to the overflow signal generated during the capacity fill calculation when the remaining space on the page is insufficient to accommodate the current format element. The format pressure signal propagates along the directed edges to subsequent constraint nodes, triggering the pagination point insertion operation. The local capacity fill calculation starts from the first node of the affected local subnet and ends at the boundary node of the local subnet. It only performs fill and overflow judgments within the subnet and does not affect nodes outside the boundary.

[0030] In this embodiment of the application, in order to reduce the computational load of cascading page number updates, during the merging stage, the amount of page number change caused by local update pagination decisions can be statistically analyzed. Only the page number whose pagination point position in the baseline pagination decision sequence is after the affected area is offset and corrected. Static content in the header and footer that does not contain dynamic page number references is not re-rendered, thereby narrowing the operation scope of cascading page number updates to the content segment containing dynamic page number references.

[0031] Step 6: Cache the current document fingerprint and decision mapping, and render and output the integrated document in red format.

[0032] Store the constraint fingerprint of the current document and its corresponding complete pagination decision sequence into the fingerprint decision cache pool to form a new fingerprint and decision mapping entry. Based on the complete pagination decision sequence of the current document, render and output the template-highlighted content and format integration result page by page to generate the highlighted format integrated document of the current document. Repeat steps 2 to 6 for all subsequent documents in the batch document set to generate the final batch highlighted format integrated document set.

[0033] In this embodiment, as batch processing progresses, the number of fingerprint and decision mapping entries accumulated in the fingerprint decision cache pool continuously increases, and the probability of subsequent documents hitting the cache during the fingerprint comparison stage in step 2 gradually increases. To control the size of the cache pool, cache entries can be sorted by hit frequency, and entries with a hit frequency lower than a preset threshold can be eliminated, while high-frequency reused pagination decision sequences can be retained.

[0034] On the other hand, this invention also proposes a multi-document automatic overlay and format integration generation system, comprising: The benchmark processing module is used to obtain benchmark documents from the batch of documents to be processed, perform complete template rule parsing and format constraint propagation network construction, page-by-page capacity filling calculation, record benchmark paging decision sequence, and generate benchmark constraint fingerprints; The fingerprint comparison module is used to calculate the constraint fingerprint of each subsequent document to be red-copied, compare the constraint fingerprint with the baseline constraint fingerprint and the existing fingerprint in the fingerprint decision cache pool, and output the comparison results and the corresponding reuse pagination decision sequence or trigger difference analysis. The difference analysis module is used to compare the layout size attribute values ​​of the current document with those of the baseline document element by element when the constraint fingerprints are inconsistent, and generate a list of differences in element changes. The local subnetwork delineation module is used to locate the nodes corresponding to the differences in the format constraint propagation network and delineate the affected local subnetworks according to the constraint propagation depth threshold. The local update module is used to perform local capacity filling calculation and format pressure signal propagation within the affected local sub-network, generate local update pagination decisions, and cascade update page numbering and header / footer content after merging with the baseline pagination decision sequence to generate the complete pagination decision sequence for the current document. The caching and rendering module is used to store the current document constraint fingerprint and the complete pagination decision sequence into the fingerprint decision cache pool, and render and output the integrated document in red-out format based on the complete pagination decision sequence.

[0035] By way of example, the system proposed in this invention may also include various features and combinations thereof in the method embodiments, which will not be elaborated here.

[0036] This invention transforms document layout equivalence judgment into fingerprint comparison by hashing the format element size attribute sequence. This allows documents with identical fingerprints to directly reuse existing pagination decision sequences, eliminating redundant full-format constraint propagation network construction and pagination calculations. For documents with inconsistent fingerprints, the list of differing element changes precisely identifies the range of format elements whose size has changed. Combined with the constraint propagation depth threshold, the scope of format constraint propagation calculation is narrowed to the layout area actually affected by changes in field content length, avoiding redundant constraint calculations across the entire document caused by differences in a few fill fields. As batch processing progresses, the fingerprint decision cache pool continuously accumulates fingerprints and decision mapping entries, gradually increasing the cache hit rate of subsequent documents. This specifically improves the processing throughput efficiency of large-scale document batch red-format integration under the same template.

[0037] The embodiments of the present invention have been described above. However, the embodiments are not limited to the specific implementation methods described above. The specific implementation methods described above are merely illustrative and not restrictive. Those skilled in the art can make more equivalent embodiments under the guidance of the present embodiments, and all of them are within the protection scope of the present embodiments.

Claims

1. A method for automatically generating multiple documents with red-line marking and format integration based on template rules, characterized in that, At least the following steps are included: Obtain a baseline document from the batch of documents to be processed, perform template rule parsing and format constraint propagation network construction on the baseline document, perform page-by-page capacity filling calculation, and record the baseline pagination decision sequence; The layout size attribute values ​​of each format element in the benchmark document are concatenated in the order of element position and then the hash digest is calculated to generate the benchmark constraint fingerprint. For each subsequent document to be red-labeled in the batch document set, extract the layout size attribute values ​​of each format element in the same position order and calculate the hash digest to generate the current document constraint fingerprint; The current document constraint fingerprint is compared with the baseline constraint fingerprint and the existing fingerprints in the fingerprint decision cache pool. If they match, the corresponding pagination decision sequence is directly reused and the rendering output is executed. If the current document constraint fingerprint is inconsistent with all existing fingerprints, then the layout size attribute values ​​of the current document and the reference document are compared element by element to identify the set of differences and generate a list of differences in element changes. Locate the nodes corresponding to the differences in the format constraint propagation network, and delineate the affected local subnetworks according to the constraint propagation depth threshold. Local capacity filling calculations and format pressure signal propagation are performed only within the affected local sub-networks to generate local update pagination decisions. These decisions are then merged with the parts of the baseline pagination decision sequence that do not belong to the affected local sub-networks, and the page numbering and header / footer content are updated in a cascading manner to generate the complete pagination decision sequence for the current document. Store the current document constraint fingerprint and the corresponding complete pagination decision sequence into the fingerprint decision cache pool, and render and output the integrated document in red format based on the complete pagination decision sequence.

2. The method for automatic overlaying and format integration of multiple documents based on template rules as described in claim 1, wherein, The format constraint propagation network is a directed graph structure, where nodes correspond to format elements in the document, and directed edges represent the page space dependency relationship between adjacent elements or containers and content. The constraint propagation direction is consistent with the subordinate order of document layout. The format pressure signal is an overflow signal generated when the remaining page space is insufficient to accommodate the current format element. The format pressure signal propagates along the directed edges to subsequent constraint nodes and triggers the pagination point insertion operation.

3. The method for automatic overlaying and format integration of multiple documents based on template rules as described in claim 1, wherein, The constraint propagation depth threshold is the maximum number of hops propagating along the directed edge from the difference node; when the size change of the difference element exceeds the remaining capacity of the current page, the constraint propagation depth threshold is extended to the first constraint node of the next page.

4. The method for automatic overlaying and format integration of multiple documents based on template rules as described in claim 1, wherein, When calculating the constraint fingerprint of the current document, the sequence of layout size attribute values ​​is first segmented and encoded according to element type. Incremental hash is calculated for segments containing variable length fields, and the results of previous calculations are reused for segments containing fixed size elements.

5. The method for automatic overlaying and format integration of multiple documents based on template rules as described in claim 1, wherein, During the merging phase, the changes in page numbers caused by local update pagination decisions are statistically analyzed. Offset correction is only performed on page numbers whose pagination point positions are after the affected area in the baseline pagination decision sequence. Static content in the header and footer that does not contain dynamic page number references is not re-rendered.

6. The method for automatic overlaying and format integration of multiple documents based on template rules as described in claim 1, wherein, The cached entries in the fingerprint decision cache pool are sorted by hit frequency, and entries with a hit frequency lower than a preset threshold are evicted.

7. A multi-document automatic overlay and format integration generation system based on template rules, characterized in that, include: The benchmark processing module is used to obtain benchmark documents from the batch of documents to be processed, perform template rule parsing and format constraint propagation network construction and page-by-page capacity filling calculation, record the benchmark pagination decision sequence, and calculate the hash digest by concatenating the layout size attribute values ​​of each format element in the order of element position to generate benchmark constraint fingerprints. The fingerprint comparison module is used to calculate the constraint fingerprint of each subsequent document to be red-copied, compare the constraint fingerprint with the baseline constraint fingerprint and the existing fingerprint in the fingerprint decision cache pool, and output the comparison results and the corresponding reuse pagination decision sequence or trigger difference analysis. The difference analysis module is used to compare the layout size attribute values ​​of the current document with those of the baseline document element by element when the constraint fingerprints are inconsistent, and generate a list of differences in element changes. The local subnetwork delineation module is used to locate the nodes corresponding to the differences in the format constraint propagation network and delineate the affected local subnetworks according to the constraint propagation depth threshold. The local update module is used to perform local capacity filling calculation and format pressure signal propagation within the affected local sub-network, generate local update pagination decisions, and cascade update page numbering and header / footer content after merging with the baseline pagination decision sequence to generate the complete pagination decision sequence for the current document. The caching and rendering module is used to store the current document constraint fingerprint and the complete pagination decision sequence into the fingerprint decision cache pool, and render and output the integrated document in red-out format based on the complete pagination decision sequence.

8. The multi-document automatic overlay and format integration generation system based on template rules according to claim 7, wherein, When the size change of the difference element exceeds the remaining capacity of the current page, the local sub-network delineation module extends the constraint propagation depth threshold to the first constraint node of the next page.

9. The multi-document automatic overlay and format integration generation system based on template rules according to claim 7, wherein, The caching and rendering module sorts the cache entries in the fingerprint decision cache pool according to their hit frequency and removes entries with a hit frequency lower than a preset threshold.