Document generation method and device, equipment and storage medium
By constructing a document generation model, utilizing multi-level structural parsing and graph convolutional networks for template adaptive evolution, and combining knowledge graph retrieval and logical verification, the problems of template rigidity, knowledge disconnect, and difficulty in tracing the source in document generation are solved, realizing the structural adaptability and timeliness of documents, and improving generation efficiency and accuracy.
Patent Information
- Application Number
- CN202510953315.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-10
- Publication Date
- 2025-10-28
AI Technical Summary
Existing document generation technologies suffer from rigid templates, disconnected knowledge, lack of coherence, and difficulty in tracing the source, making it difficult to adapt to frequently changing regulations and user needs, resulting in insufficient content accuracy and low efficiency.
A document generation model is constructed, trained using a tagged corpus, and template adaptive evolution is achieved through multi-level structural parsing units and graph convolutional networks. Combined with knowledge graph retrieval and logical verification, dynamic adjustment and cross-modal knowledge embedding are realized to ensure the timeliness and compliance of document structure.
It achieves structural adaptability and timeliness in document generation, ensures content accuracy and coherence, provides a traceability mechanism, and improves generation efficiency and compliance.
Smart Images

Figure CN120850964A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of document generation technology, and in particular to a document generation method, apparatus, device, and storage medium. Background Technology
[0002] In modern enterprise management, structured documents such as requirements analysis documents and risk assessment documents occupy an important position. Traditional document writing relies on manual labor, which results in problems such as inconsistent document quality, inconsistent formatting, and low writing efficiency.
[0003] With the rapid development of Large Language Models (LLM), automated text generation technology has been widely applied in fields such as educational writing, corporate reports, and content creation. Traditional document generation relies on static templates and manual editing, which is difficult to adapt to frequently changing compliance rules and user needs. Especially in certain fields, where regulations change frequently and content is highly sensitive, higher demands are placed on the accuracy of document structure and content.
[0004] The existing document generation has the following problems: rigid templates, static templates cannot flexibly cope with frequent changes in regulations and clauses, requiring manual updates, which is inefficient; knowledge disconnect, the generated content often lacks in-depth integration of domain knowledge, resulting in insufficient accuracy; lack of coherence, the lack of natural connections and logical consistency between chapters affects readability and operability; and difficulty in tracing the source, the lack of a traceability mechanism for the content generation process is not conducive to auditing, accountability, and verification of regulatory compliance. Summary of the Invention
[0005] The purpose of this application is to provide a document generation method, apparatus, device, and storage medium to solve the current problems of rigid templates, disconnected knowledge, lack of coherence, and difficulty in tracing the source.
[0006] To address the aforementioned technical problems, this application provides a document generation method, employing the following technical solution:
[0007] Step 100: Construct a document generation model and train the document generation model using a tag corpus to obtain the target document generation model;
[0008] Step 200: Input the user's document generation request into the adaptive template generation module in the target document generation model. The adaptive template generation module uses a multi-level structure parsing unit to obtain the hierarchical tree diagram of the existing document template, and uses a graph convolutional network and topology unit to update the nodes to obtain the first document template.
[0009] Step 300: Input the first document template into the anchor point update module in the target document generation model to update the anchor points and obtain the second document template. If the difference between the second document template and the second structure of the external rules is less than a specified threshold, then the second document template is used as the newly generated template.
[0010] Step 400: Use the knowledge graph retrieval and generation module in the target document generation model to retrieve multi-source knowledge and obtain preliminary retrieval results. Use the cross-modal relevance ranking module in the target document generation model to optimize the preliminary retrieval results and obtain the final retrieval results. Use the final retrieval results and the newly generated template to embed cross-modal knowledge and obtain a preliminary document.
[0011] Step 500: Use the logic verification module in the target document generation model to perform logical consistency verification on the preliminary document. If the verification is successful, embed metadata and modify the preliminary document according to user feedback to obtain the final document.
[0012] Furthermore, step 100 includes:
[0013] Step 110: Obtain the corpus for each domain, define the tags for the corpus for each domain, and obtain the tag corpus for the corresponding domain;
[0014] Step 120: Train the document generation model using the tag corpus from different fields to ensure that the generated documents conform to industry standards.
[0015] Furthermore, before generating the hierarchical tree diagram, step 200 includes:
[0016] Step 210: Based on the content of the document generation request, compare the existing template with the new rules that have been monitored to obtain the first structural difference degree;
[0017] Step 220: If the first structural difference is greater than a specified threshold, then the existing document template is parsed using the multi-level structural parsing model.
[0018] Furthermore, step 210 includes:
[0019] Step 211: Parse the existing document template and the document corresponding to the external rules into the first tree structure diagram and the second tree structure diagram, respectively;
[0020] Step 212: Calculate the minimum editing cost of the first tree structure diagram and the second tree structure diagram using dynamic programming.
[0021] Step 213: Obtain the first structural difference degree based on the minimum editing cost and the maximum possible editing cost.
[0022] Furthermore, the adaptive template generation module utilizes a multi-level structure parsing unit to obtain a hierarchical tree diagram of the existing document template, including:
[0023] Step 230: Use a bidirectional long short-term memory network to encode the context of each word and obtain the grammatical and semantic relationships between words;
[0024] Step 240: Use a conditional random field model to predict the label of each word to obtain a hierarchical tree diagram of the existing document template.
[0025] Furthermore, the node update using graph convolutional networks and topology units includes:
[0026] Step 250: Use the graph convolutional network and topology unit to perform topological representation on the hierarchical tree graph to obtain the topology graph and adjacency matrix of the existing document template;
[0027] Step 260: Update the nodes in the topology graph based on the monitored external rules and user behavior, and using the adjacency matrix, to generate the first document template.
[0028] Furthermore, step 300 includes:
[0029] Step 310: Obtain the editing frequency and compliance risk level of each anchor point in the first document template;
[0030] Step 320: Calculate the anchor weight of each anchor point by weighting the editing frequency and the degree of compliance risk;
[0031] Step 330: If the anchor point weight is greater than a specified threshold, then mark the anchor point as an evolvable anchor point;
[0032] Step 340: Dynamically update the evolvable anchor points.
[0033] To address the aforementioned technical problems, this application also provides a document generation apparatus, employing the document generation method described in the first aspect, comprising:
[0034] A construction module is used to build a document generation model, and to train the document generation model using a tag corpus to obtain a target document generation model;
[0035] An adaptive template generation module is used to obtain a hierarchical tree diagram of an existing document template using a multi-level structure parsing unit, and to update nodes using a graph convolutional network and topology units to obtain the first document template.
[0036] The template update module is used to input the first document template into the anchor update module in the target document generation model to update the anchor points and obtain the second document template. If the second document template differs from the second structure of the external rules by less than a specified threshold, the second document template is used as the newly generated template.
[0037] The document generation module is used to retrieve multi-source knowledge using the knowledge graph retrieval generation module in the target document generation model, obtain preliminary retrieval results, optimize the preliminary retrieval results using the cross-modal relevance ranking module in the target document generation model, obtain final retrieval results, and use the final retrieval results and the newly generated template to perform cross-modal knowledge embedding to obtain a preliminary document.
[0038] The document verification module is used to perform logical consistency verification on the preliminary document using the logical verification module in the target document generation model. If the verification is successful, metadata is embedded, and the preliminary document is modified according to user feedback to obtain the final document.
[0039] To address the aforementioned technical problems, this application also provides a computer device, including a memory and a processor. The memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the document generation method as described in the first aspect.
[0040] To address the aforementioned technical problems, embodiments of this application also provide a computer-readable storage medium storing computer-readable instructions, which, when executed by a processor, implement the steps of the document generation method as described in the first aspect.
[0041] Compared with existing technologies, the embodiments of this application have the following main technical effects: By constructing a document generation model and using the multi-level structure parsing unit in the model to obtain the hierarchical tree diagram of existing document templates, a basic structure is provided for the adaptive evolution of templates. By using graph convolutional networks and topology units for node updates, the generation model can intelligently determine the validity of the template structure and automatically adjust relevant parts of the document when the external environment or user editing behavior changes, ensuring structural adaptability and timeliness. By using anchor point weights for anchor point update evolution, dynamic adjustments can be made according to changes in external regulations or user behavior, ensuring that the document template maintains the optimal structure in a changing environment. Attached Figure Description
[0042] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a flowchart of an embodiment of a document generation method according to this application;
[0044] Figure 2 yes Figure 1 A flowchart of one specific implementation of step 100;
[0045] Figure 3 yes Figure 1 A flowchart of a specific implementation method in step 200;
[0046] Figure 4 yes Figure 3 A flowchart of a specific implementation of step 210;
[0047] Figure 5 yes Figure 3 A flowchart of a specific implementation method following step 220;
[0048] Figure 6 yes Figure 5 A flowchart of another specific implementation of step 240;
[0049] Figure 7 yes Figure 1 A flowchart of a specific implementation of step 300;
[0050] Figure 8 This is a flowchart of the document generation process in this application;
[0051] Figure 9 This is a schematic diagram of one embodiment of a document generation apparatus according to this application;
[0052] Figure 10 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0053] The technical solutions of this invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are all within the scope of protection of this invention.
[0054] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0055] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings of this application are intended to cover non-exclusive inclusion.
[0056] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. Throughout the description of this application, "plurality" means two or more, unless otherwise specifically defined.
[0057] The document generation method provided in this application can be applied to computer devices capable of executing instructions or programs. These computer devices can be, but are not limited to, various servers, workstations, personal computers, laptops, etc. The difference in execution between different computing devices is merely a difference in the execution entity; those skilled in the art will foresee that running the method on different computing devices will produce the same technical effect. The invention will now be described in detail through specific embodiments.
[0058] The purpose of this application is to provide a document generation method, apparatus, device, and storage medium to solve the current problems of rigid templates, disconnected knowledge, lack of coherence, and difficulty in tracing the source.
[0059] To address the aforementioned technical problems, this application provides a document generation method, employing the following technical solution: Figure 1 , Figure 1 This is a flowchart of an embodiment of a document generation method according to this application; including:
[0060] Step 100: Construct a document generation model and train it using a tag corpus to obtain the target document generation model.
[0061] In one possible implementation, such as Figure 2 , Figure 2yes Figure 1 A flowchart of a specific implementation of step 100; step 100 includes: step 110, obtaining a corpus for each domain, defining tags for the corpus for each domain, and obtaining a tag corpus for the corresponding domain; step 120, training the document generation model using tag corpora from different domains to ensure that the generated documents conform to industry domain standards.
[0062] In this embodiment, to ensure the accuracy of structure parsing, the system uses a labeled corpus during training. This corpus contains a wealth of document template samples, covering common document structures from various industries.
[0063] By concatenating the template structure encoding (Enc_S) with the semantic representation of historical documents (Emb_D), multi-dimensional input features are formed. This allows the system to adjust the style and terminology of the generated content according to the needs of different domains, thus adapting to the writing requirements of different document types. For example, in the financial field, specific legal and financial terminology is required during document generation, while in the medical field, medical-related professional terminology is needed. The system defines tags for each domain (such as...) <financial> , <medical>It also controls the adaptation of language style and professional terminology through domain tags to ensure that the generated documents conform to domain standards.
[0064] In this embodiment, a cross function is used to update the model parameters. The model only fine-tunes the parameters of the last layer attention head, and a loss function is used to update the model. The form of the loss function is:
[0065] L=α·CrossEntropy(Y,Y * )+β·KL_Div(Attn old ||Attn new (1),
[0066] Here, L represents the final total loss function value, used to guide the optimization and updating of model parameters. This loss function combines the error of the traditional output layer with the distribution constraints of the attention mechanism, ensuring that the model can learn the results of user modifications without disrupting the original attention structure. α and β control the weights of cross-entropy loss and KL divergence, respectively. This mechanism ensures that the model can effectively absorb new user feedback during fine-tuning, while avoiding the loss of existing knowledge and catastrophic forgetting. CrossEntropy(Y,Y) * L_Div(Attn) is the cross-entropy loss function, which measures the difference between the model's predicted output Y and the user's actual corrected label Y*. It reflects the degree of agreement between the model's current output and the expected output; the smaller the value, the closer the model's generated result is to the user's corrected content. old ||Attn new KL divergence (KL divergence) is the attention distribution, which measures the difference between the attention distribution before and after the update. The smaller the value, the closer the updated attention structure is to the original structure, and the better the model stability.
[0067] Step 200: Input the user's document generation request into the adaptive template generation module in the target document generation model. The adaptive template generation module uses a multi-level structure parsing unit to obtain the hierarchical tree diagram of the existing document template, and uses a graph convolutional network and topology unit to update the nodes to obtain the first document template.
[0068] In one possible implementation, before generating the hierarchical tree diagram, such as Figure 3 , Figure 3 yes Figure 1 A flowchart of a specific implementation of step 200; step 200 includes: step 210, comparing the existing template with the new rules monitored according to the content of the document generation request to obtain a first structural difference degree; step 220, if the first structural difference degree is greater than a specified threshold, then using a multi-level structural parsing model to parse the existing document template.
[0069] In one possible implementation, such as Figure 4 , Figure 4 yes Figure 3 A flowchart of a specific implementation of step 210; step 210 includes:
[0070] Step 211: Parse the existing document template and the document corresponding to the external rules into a first tree structure diagram and a second tree structure diagram, respectively; Step 212: Calculate the minimum editing cost of the first tree structure diagram and the second tree structure diagram using dynamic programming; Step 213: Obtain the first structural difference degree based on the minimum editing cost and the maximum possible editing cost.
[0071] In this embodiment, to ensure the timeliness and adaptability of the document template structure, a template evolution triggering mechanism with dynamic response capabilities is adopted. This mechanism is based on structural consistency constraints and content distribution characteristics, and determines whether the current template needs to be reconstructed or evolved by monitoring changes in the external environment and internal usage behavior.
[0072] Specifically, the system model first continuously monitors incremental update streams from policy and regulation databases, standard update interfaces, and knowledge graph sources. Once a version change in external regulations or industry standards is detected, the system model calculates the structural difference between the current template structure and the newly added rules. If the difference exceeds a preset threshold, the current template is marked as "structurally inconsistent" and added to the evolution candidate pool.
[0073] In this embodiment, the calculation of the first structural difference is mainly based on the hierarchical structure comparison between the document template and the detected new rules (new regulations), and is implemented using an improved tree structure similarity algorithm. Specifically, the system model first uses a multi-level structural parsing unit model to parse the template and regulatory text into tree structures (first tree structure diagram and second tree structure diagram) with node type, hierarchical depth, and position encoding, respectively. The minimum editing cost (minimum editing distance) of the two tree structure diagrams is calculated using a dynamic programming method, including the cost of node insertion, deletion, and replacement operations. The editing cost of each node is determined by its type importance and hierarchical depth, with key clause nodes having a higher weight for operation cost.
[0074] In this embodiment, the first structural difference is ultimately represented as the ratio of the normalized minimum editing cost to the maximum possible editing cost; the closer this value is to 1, the greater the structural difference. A node position offset penalty factor is also introduced to quantitatively evaluate changes in the order of sibling nodes. When the calculated first structural difference exceeds a preset threshold, the system model determines that the current template has a significant structural mismatch with the monitored new rules (new regulations), triggering the template evolution process. This tree-edit distance-based quantification method can effectively capture the degree of deviation of the document template from the requirements of the new regulations in terms of chapter arrangement, clause order, and structural integrity.
[0075] In this embodiment, the system model collects users' operation trajectories in real time during document writing or revision, constructs an editing heatmap, and evaluates the editing density distribution of a certain template area. If multiple users repeatedly perform structural rearrangement, content addition, or clause rewriting operations in similar locations, the system will determine that the area is a "high-frequency editing area," inferring that the original template structure's matching degree with the actual use scenario has decreased, thereby triggering a structure validity warning.
[0076] Furthermore, the system model will conduct long-term evolution monitoring of key positions marked as anchors in the template. If certain anchors are frequently deleted or replaced in historical documents, or if their generated content is inconsistent with domain specifications, it indicates that the anchor has lost its original structural guidance capability. In this case, the system model will combine template sparsity (i.e., the matching rate and call frequency of each section of the template) and logical consistency detection results to determine whether to reconstruct, replace, or move the anchor.
[0077] At the human feedback level, the system allows users to proactively submit template improvement suggestions after document generation. Once sufficient user feedback is collected and a consensus is reached, the system model will automatically extract the mapping relationship between user feedback content and the original template structure, and make evolutionary decisions based on feedback intensity indicators (such as the average rewriting rate of paragraphs in the same template).
[0078] All trigger signals generated during the above process will be uniformly incorporated into the template evolution judgment engine, and a comprehensive score will be formed by combining indicators such as structural mismatch scoring function, logical coverage, and clause retention rate. If the comprehensive score exceeds the evolution threshold, the system model will activate the template evolution engine, recalculate the template structure topology, optimize the anchor point layout, and generate a new version of the template, while retaining the old version for backtracking and comparative analysis. This strategy ensures that the template maintains structural stability while possessing dynamic adaptive capabilities, making it suitable for highly compliant and frequently changing industry scenarios.
[0079] In one possible implementation, the adaptive template generation module utilizes a multi-level structure parsing unit to obtain a hierarchical tree diagram of the existing document template, such as... Figure 5 , Figure 5 yes Figure 3 A flowchart of a specific implementation method following step 220; including: step 230, using a bidirectional long short-term memory network to encode the context of each word and obtain the grammatical and semantic relationships between words; step 240, using a conditional random field model to predict the label of each word and obtain a hierarchical tree diagram of the existing document template.
[0080] In this embodiment, the multi-level structure parsing unit engine accurately identifies the hierarchical structure in a document by combining a bidirectional long short-term memory network (BiLSTM) and a conditional random field (CRF) model. Specifically, the input document is first segmented and labeled with pairs of words. Then, the BiLSTM model performs context encoding on each word to capture the grammatical and semantic relationships between words. Subsequently, the CRF model is used to predict the label of each word, ultimately identifying the hierarchical structure of the document and obtaining a hierarchical tree diagram of the existing document template.
[0081] In one possible implementation, graph convolutional networks and topological units are used for node updates, such as... Figure 6 , Figure 6 yes Figure 5 A flowchart of another specific implementation of step 240; including: step 250, using graph convolutional networks and topology units to perform topological representation of the hierarchical tree graph, and obtaining the topology graph of the existing document template and its adjacency matrix; step 260, updating the nodes in the topology graph according to the monitored external rules and user behavior and using the adjacency matrix to generate the first document template.
[0082] In this embodiment, the Graph Convolutional Network (GCN) and the topological unit model represent structured information such as clauses and tables in a document as graph nodes, and the relationships between nodes as graph edges. The system can perform topological modeling of the document structure, realize the structured propagation and information transmission of document content, and thus perform topological representation of the hierarchical tree diagram to obtain the topological graph of the existing document template and its adjacency matrix.
[0083] Graph Convolutional Networks (GCNs) and Topological Unit Models update each node of a document through an adjacency matrix. The node representation is weighted and propagated in each layer of the GCN network based on the characteristics of its neighboring nodes. This approach enables information exchange between different parts of the document, ensuring the flexibility and consistency of the template structure across various contexts. It intelligently assesses the validity of the template structure and automatically adjusts relevant parts of the document when external environments or user editing behavior change, ensuring structural adaptability and timeliness.
[0084] Step 300: Input the first document template into the anchor point update module in the target document generation model to update the anchor points and obtain the second document template. If the difference between the second document template and the second structure of the external rules is less than the specified threshold, then the second document template is used as the newly generated template.
[0085] In one possible implementation, such as Figure 7 , Figure 7 yes Figure 1 A flowchart of a specific implementation of step 300; step 300 includes: step 310, obtaining the editing frequency and compliance risk level of each anchor point in the first document template; step 320, calculating the anchor point weight of each anchor point by weighting the editing frequency and compliance risk level; step 330, if the anchor point weight is greater than a specified threshold, then marking the anchor point as an evolvable anchor point; step 340, dynamically updating the evolvable anchor points.
[0086] This embodiment proposes a dynamic anchor point-based tagging strategy for dynamically identifying and adjusting key structural nodes in a document. Anchor points represent core locations within the document that play a crucial role in the evolution of the document's content, such as paragraph headings and clause numbers.
[0087] During template evolution, the system model calculates the weight value of each anchor point based on its editing frequency and compliance risk. The formula for calculating the anchor point weight is as follows:
[0088] Weight(a)=λ·EditGreq(a)+(1-λ)·ComplianceRisk(a) (2),
[0089] Weight(a) represents the overall weight of the anchor point in the current template, used to measure whether the position should be marked as an "evolvable anchor point". A higher weight indicates greater structural instability or compliance risk, making it more likely to be automatically included in the template evolution candidate by the system. λ is the weight balancing coefficient, ranging from [0,1], used to adjust the relative importance of "user editing frequency" and "compliance risk" in the overall weight calculation. EditGreq(a) is the historical editing frequency of the anchor point position. A higher value indicates poorer stability of the template structure at that position in actual use, suggesting a possible unreasonable structural design or incompatibility with new requirements. ComplianceRisk(a) is the compliance risk assessment value of the anchor point position, used to measure whether the position, under the current template structure, risks violating the latest regulations, standards, or industry norms. A higher value indicates potential compliance issues with the structure or content of that position, and the system is more inclined to adjust the structure of that position.
[0090] When the weight of an anchor point exceeds a set threshold, the system automatically marks it as an "evolvable anchor point" and uses it as a candidate point for structural adjustment. The state of each anchor point is dynamically adjusted based on changes in external regulations or user behavior, ensuring that the document template maintains its optimal structure in changing environments.
[0091] Step 400: Use the knowledge graph retrieval and generation module in the target document generation model to retrieve multi-source knowledge and obtain preliminary retrieval results. Use the cross-modal relevance ranking module in the target document generation model to optimize the preliminary retrieval results and obtain the final retrieval results. Use the final retrieval results and the newly generated template to embed cross-modal knowledge and obtain the preliminary document.
[0092] In this embodiment, a knowledge graph-enhanced retrieval generation mechanism (RAG) is employed. By integrating structured and unstructured knowledge sources, such as legal provisions, technical charts, and standard codes, a multimodal knowledge graph is constructed, supporting joint retrieval of text, graph, and table formats. Within this framework, the system first embeds various types of information from the knowledge sources across modalities to form a unified index structure. Based on the current document generation requirements, relevant provisions, standards, or technical content are retrieved from the knowledge graph to obtain preliminary search results. These results are then combined with the document generation task to ensure the professionalism and accuracy of the document content.
[0093] In this embodiment, a cross-modal relevance ranking mechanism is used to calculate the relevance score for each search result. The relevance score is composed of a combination of the following factors:
[0094] Score=γ·Sim legal (Q,D)+μ·Sim project (Q,D)+v·Consistency term (Q,D) (3)
[0095] Here, Score is the final comprehensive relevance score, used to quantitatively evaluate the degree of matching between the search results in the knowledge graph and the current document generation requirements. γ, μ, and ν represent the weights of legal relevance, project relevance, and terminology consistency, respectively, and the sum of these weights is 1. legal (Q,D) represents the semantic similarity between the search results and legal / regulatory provisions, calculated through embedding legal-specific word vectors or regulatory knowledge graphs to ensure that the generated content meets compliance requirements. project (Q,D) represents the degree of match between the search results and the current project context, calculated based on project documents, user requirements, and other data to ensure that the content is relevant to the specific scenario. term (Q,D) represents the consistency between the search results and existing terms in the document. Through terminology database comparison or co-occurrence frequency analysis, it avoids conflicts between technical terms. This mechanism can dynamically adjust the weights according to the needs of different document types, thereby optimizing the accuracy and relevance of the search results.
[0096] Step 500: Use the logical verification module in the target document generation model to perform logical consistency verification on the preliminary document. If the verification is successful, embed metadata and modify the preliminary document according to user feedback to obtain the final document.
[0097] In this embodiment, the logical consistency verification mechanism has a built-in structured logic reasoning module, which defines the following detection constraints:
[0098] Time order: Avoid having the later item precede the earlier item;
[0099] Terminology consistency: Use consistent professional terminology throughout;
[0100] Consistency in citation of clauses: The logic is clear when citing other documents or sections;
[0101] Mandatory clause missing rate detection: Ensure that required paragraphs are complete.
[0102] When a conflict or missing item is detected, a prompt is generated and a remediation strategy is recommended (such as "It is recommended to supplement clause 'A.1 Data Collection Path' to meet the integrity requirements").
[0103] After successful verification, multi-dimensional metadata is embedded, and the following metadata is embedded in each generated text segment:
[0104] The template version number used (e.g., "template_v3.1");
[0105] Call the knowledge resource list (e.g., "GG_AA_77", "Audit Process 2025Q1");
[0106] Generate timestamps and responsible person identifiers.
[0107] This metadata is hidden or stored as notes within the document structure, supporting retrospective analysis and version comparison.
[0108] In this embodiment of the application, to facilitate auditing and traceability, an audit chain and hash fingerprint can also be manipulated. Specifically, each round of document generation and modification operations will record the following information:
[0109] User ID and operation time;
[0110] Enter the template version and editing area;
[0111] Modify content and behavior type (add, delete, replace);
[0112] Document fingerprint hash (encrypted using SHA256, uniquely identifying the electronic document).
[0113] All operations are recorded in the operation log block and stored in a chain structure (similar to blockchain auditing) to ensure accountability, version restoration, and audit compliance.
[0114] In the embodiments of this application, such as Figure 8 , Figure 8 This is a flowchart of the document generation process in this application. By constructing a document generation model and using multi-level structural parsing units within the model to obtain a hierarchical tree diagram of existing document templates, a basic structure is provided for the adaptive evolution of templates. By using graph convolutional networks and topology units for node updates, the generation model can intelligently determine the validity of the template structure and automatically adjust relevant parts of the document when the external environment or user editing behavior changes, ensuring structural adaptability and timeliness. By using anchor point weights for anchor point update evolution, dynamic adjustments can be made according to changes in external regulations or user behavior, ensuring that the document template maintains an optimal structure in changing environments.
[0115] To address the aforementioned technical problems, this application also provides a document generation apparatus 600, employing the document generation method of the first aspect, such as... Figure 9 , Figure 9 This is a schematic diagram of one embodiment of a document generation apparatus according to this application, comprising:
[0116] Module 601 is used to build a document generation model, and to train the document generation model using a tag corpus to obtain the target document generation model.
[0117] The adaptive template generation module 602 is used to obtain the hierarchical tree diagram of the existing document template using a multi-level structure parsing unit, and to update the nodes using a graph convolutional network and topology unit to obtain the first document template.
[0118] The template update module 603 is used to input the first document template into the anchor point update module in the target document generation model to update the anchor points and obtain the second document template. If the difference between the second document template and the second structure of the external rules is less than a specified threshold, the second document template is used as the newly generated template.
[0119] The document generation module 604 is used to retrieve multi-source knowledge using the knowledge graph retrieval generation module in the target document generation model, obtain preliminary retrieval results, optimize the preliminary retrieval results using the cross-modal relevance ranking module in the target document generation model, obtain the final retrieval results, and use the final retrieval results and newly generated templates to embed cross-modal knowledge to obtain a preliminary document.
[0120] The document verification module 605 is used to perform logical consistency verification on the preliminary document using the logical verification module in the target document generation model. If the verification is successful, metadata is embedded, and the preliminary document is modified according to user feedback to obtain the final document.
[0121] To address the aforementioned technical problems, this application also proposes a computer device that employs the following technical solution: it includes a processor, a network module, and a memory, with the processor and memory interconnected via the network module.
[0122] This computer device can be a computer, server, workstation, or other similar device; it can also be a mobile device such as a mobile phone, tablet, or in-vehicle mobile terminal; or other devices with program execution capabilities. Its internal structure diagram can be as follows: Figure 10 As shown, Figure 10 This is a schematic diagram of a computer device according to an embodiment of the present application. The computer device includes a processor, a memory, and a network module. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores an operating system, instructions, or code. The internal memory provides an environment for the operation of the operating system and instructions or code in the non-volatile storage media. When the instructions or code are executed by the processor, they implement the functions or steps of a document generation method. The network module of the computer device may include a network interface and / or a wireless network module, through which the computer device can communicate with other devices or service platforms. Furthermore, the computer device may also include a display screen and input devices, etc.
[0123] The memory is used to store computer programs, which include program instructions. The processor is configured to call the program instructions, and when the processor executes the instructions or code, it implements the steps of the ring data communication method with a one-frame multi-packet data structure as described above.
[0124] To address the aforementioned problems, this application also proposes a computer-readable storage medium, employing the following technical solution: the computer-readable storage medium stores a computer program, the computer program including program instructions, which are implemented when executed by a processor. Figures 1 to 7 The document generation methods provided in each step are detailed in the implementation methods provided in the above steps, and will not be repeated here.
[0125] The aforementioned computer-readable storage medium may be the apparatus of the document generation method provided in any of the foregoing embodiments or the internal storage unit of the aforementioned terminal device, such as the hard disk or memory of a computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on the computer device.
[0126] Furthermore, the computer-readable storage medium may include both internal storage units and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0127] However, it should be understood that it is not required to implement all the components shown; more or fewer components may be implemented instead. Those skilled in the art will understand that the computer device described herein is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0128] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0129] Compared with existing technologies, the embodiments of this application have the following main technical effects: By constructing a document generation model and using the multi-level structure parsing unit in the model to obtain the hierarchical tree diagram of existing document templates, a basic structure is provided for the adaptive evolution of templates. By using graph convolutional networks and topology units for node updates, the generation model can intelligently determine the validity of the template structure and automatically adjust relevant parts of the document when the external environment or user editing behavior changes, ensuring structural adaptability and timeliness. By using anchor point weights for anchor point update evolution, dynamic adjustments can be made according to changes in external regulations or user behavior, ensuring that the document template maintains the optimal structure in a changing environment.
[0130] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.< / medical> < / financial>
Claims
1. A document generation method, characterized in that it includes: Step 100: Construct a document generation model and train the document generation model using a tag corpus to obtain the target document generation model; Step 200: Input the user's document generation request into the adaptive template generation module in the target document generation model. The adaptive template generation module uses a multi-level structure parsing unit to obtain the hierarchical tree diagram of the existing document template, and uses a graph convolutional network and topology unit to update the nodes to obtain the first document template. Step 300: Input the first document template into the anchor point update module in the target document generation model to update the anchor points and obtain the second document template. If the difference between the second document template and the second structure of the external rules is less than a specified threshold, then the second document template is used as the newly generated template. Step 400: Use the knowledge graph retrieval and generation module in the target document generation model to retrieve multi-source knowledge and obtain preliminary retrieval results. Use the cross-modal relevance ranking module in the target document generation model to optimize the preliminary retrieval results and obtain the final retrieval results. Use the final retrieval results and the newly generated template to embed cross-modal knowledge and obtain a preliminary document. Step 500: Use the logic verification module in the target document generation model to perform logical consistency verification on the preliminary document. If the verification is successful, embed metadata and modify the preliminary document according to user feedback to obtain the final document.
2. The document generation method according to claim 1, characterized in that, Step 100 includes: Step 110: Obtain the corpus for each domain, define the tags for the corpus for each domain, and obtain the tag corpus for the corresponding domain; Step 120: Train the document generation model using the tag corpus from different fields to ensure that the generated documents conform to industry standards.
3. The document generation method according to claim 1, characterized in that, Before generating the hierarchical tree diagram, step 200 includes: Step 210: Based on the content of the document generation request, compare the existing template with the new rules that have been monitored to obtain the first structural difference degree; Step 220: If the first structural difference is greater than a specified threshold, then the existing document template is parsed using the multi-level structural parsing model.
4. The document generation method according to claim 3, characterized in that, Step 210 includes: Step 211: Parse the existing document template and the document corresponding to the external rules into the first tree structure diagram and the second tree structure diagram, respectively; Step 212: Calculate the minimum editing cost of the first tree structure diagram and the second tree structure diagram using dynamic programming. Step 213: Obtain the first structural difference degree based on the minimum editing cost and the maximum possible editing cost.
5. The document generation method according to claim 1, characterized in that, The adaptive template generation module uses a multi-level structure parsing unit to obtain a hierarchical tree diagram of existing document templates, including: Step 230: Use a bidirectional long short-term memory network to encode the context of each word and obtain the grammatical and semantic relationships between words; Step 240: Use a conditional random field model to predict the label of each word to obtain a hierarchical tree diagram of the existing document template.
6. The document generation method according to claim 1, characterized in that, The node update using graph convolutional networks and topology units includes: Step 250: Use the graph convolutional network and topology unit to perform topological representation on the hierarchical tree graph to obtain the topology graph and adjacency matrix of the existing document template; Step 260: Update the nodes in the topology graph based on the monitored external rules and user behavior, and using the adjacency matrix, to generate the first document template.
7. The document generation method according to claim 1, characterized in that, Step 300 includes: Step 310: Obtain the editing frequency and compliance risk level of each anchor point in the first document template; Step 320: Calculate the anchor weight of each anchor point by weighting the editing frequency and the degree of compliance risk; Step 330: If the anchor point weight is greater than a specified threshold, then mark the anchor point as an evolvable anchor point; Step 340: Dynamically update the evolvable anchor points.
8. A document generation apparatus, employing the document generation method according to any one of claims 1-7, characterized in that, include: A construction module is used to build a document generation model, and to train the document generation model using a tag corpus to obtain a target document generation model; An adaptive template generation module is used to obtain a hierarchical tree diagram of an existing document template using a multi-level structure parsing unit, and to update nodes using a graph convolutional network and topology units to obtain the first document template. The template update module is used to input the first document template into the anchor update module in the target document generation model to update the anchor points and obtain the second document template. If the second document template differs from the second structure of the external rules by less than a specified threshold, the second document template is used as the newly generated template. The document generation module is used to retrieve multi-source knowledge using the knowledge graph retrieval generation module in the target document generation model, obtain preliminary retrieval results, optimize the preliminary retrieval results using the cross-modal relevance ranking module in the target document generation model, obtain final retrieval results, and use the final retrieval results and the newly generated template to perform cross-modal knowledge embedding to obtain a preliminary document. The document verification module is used to perform logical consistency verification on the preliminary document using the logical verification module in the target document generation model. If the verification is successful, metadata is embedded, and the preliminary document is modified according to user feedback to obtain the final document.
9. A computer device, characterized in that, The document includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the document generation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the document generation method as described in any one of claims 1 to 7.
Citation Information
Cited By
Demand specification generation method and system based on multi-modal understanding
CN121525656A