Document generation methods and related equipment
Patent Information
- Application Number
- CN202610761899.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-29
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2046-05-29
AI Technical Summary
为此,本申请提出了一种文档生成方法,能够解决文档生成效率低下、数据提取准确性差、人工干预成本高且易出错、结果可靠性不足及上下文碎片化等问题
[0014]为达到上述目的,本发明第三方面实施例提出了一种电子设备,包括:处理器和存储器,存储器存储可在处理器上运行的程序或指令,程序或指令被处理器执行时实现如前述任一项的文档生成方法的步骤。
Smart Images

Figure CN122287574B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of document generation technology, specifically relating to a document generation method, a document generation system, an electronic device, and a computer-readable storage medium. Background Technology
[0002] In fields such as office work and power operation and maintenance, there are numerous scenarios that require generating various documents and filling tables based on multi-source data. These scenarios demand higher efficiency and reliability in document generation. However, existing document generation solutions, such as traditional manual and semi-automatic methods, are inefficient and costly, prone to data errors due to human fatigue, and simple scripts cannot handle semantic changes in unstructured text. Furthermore, automated solutions based on traditional workflows rely on manually preset processes and prompts, resulting in poor adaptability. Mechanical segmentation can lead to contextual fragmentation, and general-purpose large language models lack rigorous logical constraints and multi-dimensional verification mechanisms. Existing solutions cannot accurately determine the reliability of results and fail to meet the high-quality, highly reliable document generation needs of various fields. Therefore, a document generation method is urgently needed to solve these problems. Summary of the Invention
[0003] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes a document generation method that can solve problems such as low document generation efficiency, poor data extraction accuracy, high cost and error-proneness of manual intervention, insufficient reliability of results, and fragmented context.
[0004] To achieve the above objectives, a first aspect of the present invention proposes a document generation method, comprising: in response to receiving a target document template, parsing the target document template and identifying parameters to be filled; determining an information extraction path based on the semantic type of the parameters to be filled; obtaining candidate results related to the parameters to be filled based on the information extraction path; evaluating the confidence of the candidate results to obtain a confidence evaluation result; and in response to determining that the confidence evaluation result is not lower than a preset threshold, filling the candidate results into the target document template.
[0005] In some embodiments, determining the information extraction path based on the semantic type of the parameter to be filled includes: classifying the parameter to be filled into at least one of the following types according to the information acquisition method: direct extraction type, relational query type, logical reasoning type, and calculation verification type; and determining the information extraction path based on the type of the parameter to be filled.
[0006] In some embodiments, based on the information extraction path, candidate results related to the parameter to be filled are obtained, including: in response to determining that the type of the parameter to be filled is direct extraction, obtaining text fragments related to the parameter to be filled from the candidate document set through a retrieval enhancement generation method as the first candidate result; in response to determining that the type of the parameter to be filled is relational query, generating a graph query statement based on the semantic information of the parameter to be filled, and executing the graph query statement using a preset knowledge graph to obtain the second candidate result, wherein the preset knowledge graph is constructed based on the candidate document set and stores entities extracted from the candidate document set and the relationships between entities; in response to determining that the type of the parameter to be filled is logical reasoning, generating a logic programming script based on the business rules of the parameter to be filled, and calling a logic solver to execute the logic programming script to obtain the third candidate result; in response to determining that the type of the parameter to be filled is computational verification, generating program code based on the numerical values and logical relationships involved in the parameter to be filled, and executing the program code to obtain the fourth candidate result.
[0007] In some embodiments, a graph query statement is generated based on the semantic information of the parameters to be filled, and the graph query statement is executed using a preset knowledge graph, including: converting the natural language description of the parameters to be filled into a graph query language statement; executing the graph query language statement through a graph database storing a preset knowledge graph; receiving and parsing the query results returned by the graph database, and using the parsed query results as a second candidate result.
[0008] In some embodiments, generating a logic programming script based on business rules with parameters to be filled in, and calling a logic solver to execute the logic programming script includes: converting the business rules into rules and facts in a logic programming language; calling a logic solver corresponding to the logic programming language, loading and executing the rules and facts; and using the reasoning conclusion returned by the logic solver as a third candidate result.
[0009] In some embodiments, a confidence assessment is performed on the candidate results to obtain a confidence assessment result, including: generating a confidence assessment result based on at least one of the following methods: determining the confidence assessment result based on the certainty level of the information extraction path corresponding to the candidate result; determining the confidence assessment result based on the source reliability and content relevance of the source information on which the candidate result is obtained; determining the confidence assessment result based on the consistency between the multiple candidate results when multiple candidate results exist; and determining the confidence assessment result based on the logical consistency or numerical reasonableness of the candidate results.
[0010] In some embodiments, the method further includes: triggering a correction mechanism in response to determining that the confidence assessment result is lower than a preset threshold; wherein the correction mechanism includes at least one of the following operations: re-determining the information extraction path based on the parameter to be filled, and re-executing the step of obtaining candidate results related to the parameter to be filled based on the re-determined path; generating prompt information for manual review.
[0011] According to an embodiment of the present invention, a document generation method includes: in response to receiving a target document template, parsing the target document template and identifying parameters to be filled in; determining an information extraction path based on the semantic type of the parameters to be filled in; obtaining candidate results related to the parameters to be filled in based on the information extraction path; evaluating the confidence level of the candidate results to obtain a confidence level evaluation result; and, in response to determining that the confidence level evaluation result is not lower than a preset threshold, filling the candidate results into the target document template. Therefore, this application can solve problems such as low document generation efficiency, poor data extraction accuracy, high cost and error-proneness of manual intervention, insufficient reliability of results, and fragmented context. It ensures the accuracy and standardization of each parameter filled into the target template, significantly reduces the human resource cost, operational complexity, and labor intensity of document generation, allows for complete traceability of the extraction source of each parameter from the reasoning chain, facilitates manual review, and improves the efficiency and reliability of document generation.
[0012] To achieve the above objectives, a second aspect of the present invention provides a document generation system, comprising: a parameter identification module configured to: in response to receiving a target document template, parse and process the target document template and identify the parameters to be filled; an extraction path determination module configured to: determine an information extraction path based on the semantic type of the parameters to be filled; a candidate result determination module configured to: obtain candidate results related to the parameters to be filled based on the information extraction path; a confidence assessment module configured to: assess the confidence of the candidate results and obtain a confidence assessment result; and a document filling module configured to: in response to determining that the confidence assessment result meets preset conditions, fill the candidate results into the target document template.
[0013] A document generation system according to an embodiment of the present invention includes: a parameter identification module configured to: parse and identify parameters to be filled in in response to receiving a target document template; an extraction path determination module configured to: determine an information extraction path based on the semantic type of the parameters to be filled in; a candidate result determination module configured to: obtain candidate results related to the parameters to be filled in based on the information extraction path; a confidence assessment module configured to: assess the confidence of the candidate results and obtain a confidence assessment result; and a document filling module configured to: fill the candidate results into the target document template in response to determining that the confidence assessment result meets preset conditions. Therefore, this application can solve problems such as low document generation efficiency, poor data extraction accuracy, high cost and error-proneness of manual intervention, insufficient result reliability, and fragmented context. It ensures the accuracy and standardization of each parameter filled into the target template, significantly reduces the human resource cost, operational complexity, and labor intensity of document generation, and allows complete traceability of the extraction source of each parameter from the reasoning chain, facilitating manual review and improving the efficiency and reliability of document generation.
[0014] To achieve the above objectives, a third aspect of the present invention provides an electronic device, comprising: a processor and a memory, wherein the memory stores a program or instructions executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the document generation method as described in any of the foregoing.
[0015] The electronic device according to the embodiments of the present invention, by executing the above-described document generation method, can solve problems such as low document generation efficiency, poor data extraction accuracy, high cost and error-proneness of manual intervention, insufficient reliability of results and fragmented context. It ensures the accuracy and standardization of each parameter filled into the target template, greatly reduces the human cost, operational complexity and labor intensity of document generation, and can completely trace the extraction source of each parameter from the reasoning chain, which is convenient for manual review and improves the efficiency and reliability of document generation.
[0016] To achieve the above objectives, a fourth aspect of the present invention provides a computer-readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the document generation method as described in any of the preceding claims.
[0017] According to the computer-readable storage medium of the present invention, by executing the above-described document generation method, problems such as low document generation efficiency, poor data extraction accuracy, high cost and error-proneness of manual intervention, insufficient reliability of results and fragmented context can be solved. It ensures the accuracy and standardization of each parameter filled into the target template, greatly reduces the human cost, operational complexity and labor intensity of document generation, and can completely trace the extraction source of each parameter from the reasoning chain, which is convenient for manual review and improves the efficiency and reliability of document generation.
[0018] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0019] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a flowchart illustrating a document generation method according to an embodiment of this application; Figure 2 This is a diagram of an intelligent agent system architecture for a document generation method according to an embodiment of this application; Figure 3 This is a schematic diagram of the parameter extraction and verification process of a document generation method in an embodiment of this application; Figure 4 This is a schematic diagram of a document generation system according to an embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application.
[0020] Reference numerals: Document generation system 400, parameter recognition module 401, extraction path determination module 402, candidate result determination module 403, confidence assessment module 404, document filling module 405, processor 510, memory 520, input / output interface 530, communication interface 540, bus 550. Detailed Implementation
[0021] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While some embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this application. It should be understood that the drawings and embodiments of this application are for illustrative purposes only and are not intended to limit the scope of protection of this application.
[0022] It should be understood that the steps described in the method embodiments of this application may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this application is not limited in this respect.
[0023] As described in the background section, document generation and table filling are fundamental and frequently used tasks in various scenarios such as office work, power operation and maintenance, and corporate administration. These documents need to be compiled based on multi-source data such as records, equipment ledgers, and plans, and must strictly follow the corresponding template specifications. Before the document is officially generated, it is necessary to ensure the accuracy and completeness of data extraction and the standardization of document filling.
[0024] Currently, the document generation solutions commonly used in the industry are mainly divided into manual or semi-automatic processing solutions and automated solutions based on traditional workflows. Manual or semi-automatic solutions rely on staff reading massive amounts of candidate documents, understanding the requirements of the target template, manually extracting relevant parameters, and filling them into the corresponding positions. In some scenarios, basic parameter filling is completed using preset regular expressions or keyword matching. However, this approach is inefficient when faced with massive amounts of documents and complex parameter extraction needs. Furthermore, manual operation is prone to data entry errors due to fatigue, and simple script matching cannot handle the semantic changes in unstructured text, making it difficult to guarantee the accuracy of extracted parameters. Automated solutions based on traditional workflows introduce large language models, processing the template file through a preset fixed process. First, the template file is mechanically divided into chapters or paragraphs. Then, prompts for parameter extraction are generated for each block. Next, relevant segments are retrieved from the candidate document library based on these prompts. Finally, the large language model extracts parameters from the retrieved segments and completes the filling. However, this approach has extremely poor adaptability to complex and variable document structures. Mechanical template segmentation can destroy the integrity of information, leading to the loss of parameter dependencies across paragraphs.
[0025] To address the aforementioned shortcomings, the document generation method of this invention can solve problems such as low document generation efficiency, poor data extraction accuracy, high cost and error-proneness of manual intervention, insufficient reliability of results, and fragmented context. It avoids the errors and hidden dangers brought about by manual operation and traditional automation solutions, and improves the efficiency and quality of document generation.
[0026] The following is for reference. Figures 1-3 This application describes a document generation method provided in its embodiments.
[0027] like Figure 1 The diagram shown is a flowchart of a document generation method according to an embodiment of this application. The document generation method of this application embodiment may include the following steps: Step S101: In response to receiving the target document template, the target document template is parsed and the parameters to be filled in are identified.
[0028] Specifically, the target document template supports commonly used document formats in various fields. First, the integrity of the template is initially checked to confirm that there are no issues such as format corruption or missing core structures. Then, the template parsing tool scans the chapter divisions, paragraph layouts, and content identifiers of the template to identify the preset identifiers to be filled in and extract the corresponding parameters to be filled in for each identifier.
[0029] Step S102: Determine the information extraction path based on the semantic type of the parameter to be filled in.
[0030] Specifically, by combining the specific location, context, and parameter identifier of the parameter to be filled in the target document template, the semantic type of each parameter to be filled in is determined, and then the information extraction path is determined according to the preset semantic type and corresponding rules.
[0031] Step S103: Based on the information extraction path, obtain candidate results related to the parameters to be filled in.
[0032] Specifically, for each parameter to be filled in, according to the data acquisition and processing rules matched by its corresponding information extraction path, information that is highly semantically related to the parameter to be filled in is retrieved and extracted from preset candidate document sets, related databases and other data sources. The obtained information is then subjected to preliminary deduplication, noise reduction and semantic filtering to select valid information that meets the parameter filling requirements as candidate results.
[0033] Step S104: Calculate the confidence level of the candidate results to obtain the confidence level assessment results.
[0034] Specifically, the reliability of the source data of the information extraction path corresponding to the candidate result, the semantic relevance with the parameter to be filled, and the numerical rationality of the candidate result itself are evaluated. If there are multiple candidate results of the same type, the consistency between the results will be further compared. The final confidence evaluation result is obtained through the above multi-dimensional analysis.
[0035] Step S105: In response to determining that the confidence assessment result is not lower than a preset threshold, the candidate result is filled into the target document template.
[0036] Specifically, the confidence assessment result of each item is compared with a preset threshold. When it is determined that the confidence assessment result of a certain parameter to be filled is not lower than the preset threshold, the candidate result that meets the requirements is filled into the corresponding parameter position in the target document template according to the specific position of the parameter to be filled in.
[0037] As an optional embodiment, the information extraction path is determined according to the semantic type of the parameter to be filled, including: classifying the parameter to be filled into at least one of the following types according to the information acquisition method: direct extraction type, relational query type, logical reasoning type, and calculation verification type; and determining the information extraction path according to the type of the parameter to be filled.
[0038] Specifically, after semantic parsing of each parameter to be filled in, and considering the complexity of information retrieval and the characteristics of data sources, the parameters are categorized into at least one of the following types based on their information retrieval methods: direct extraction, relational query, logical reasoning, and computational verification. Direct extraction parameters refer to basic information that can be directly extracted from candidate documents; relational query parameters refer to related parameters that require understanding the relationships between entities; logical reasoning parameters refer to parameters derived based on specific business rules; and computational verification parameters refer to parameters involving numerical calculations or format validation. Based on this, and according to the system's pre-defined mapping rules between parameter types and information extraction paths, a suitable information extraction path is determined for each type of parameter to be filled in.
[0039] As an optional embodiment, based on the information extraction path, candidate results related to the parameter to be filled are obtained, including: in response to determining that the type of the parameter to be filled is direct extraction, text fragments related to the parameter to be filled are obtained from the candidate document set through a retrieval enhancement generation method as the first candidate result; in response to determining that the type of the parameter to be filled is relational query, a graph query statement is generated based on the semantic information of the parameter to be filled, and the graph query statement is executed using a preset knowledge graph to obtain the second candidate result, wherein the preset knowledge graph is constructed based on the candidate document set and stores entities extracted from the candidate document set and the relationships between entities; in response to determining that the type of the parameter to be filled is logical reasoning, a logic programming script is generated based on the business rules of the parameter to be filled, and a logic solver is called to execute the logic programming script to obtain the third candidate result; in response to determining that the type of the parameter to be filled is computational verification, program code is generated based on the numerical values and logical relationships involved in the parameter to be filled, and the program code is executed to obtain the fourth candidate result.
[0040] Specifically, refer to Figure 2This is a diagram of an intelligent agent system architecture for a document generation method in this application embodiment. When the type of the parameter to be filled is determined to be direct extraction type, the core controller schedules a vector database tool and uses a retrieval-enhanced generation (RAG) method to retrieve text fragments that are highly semantically related to the parameter to be filled from the candidate document set. After preliminary screening such as deduplication and noise reduction, the effective fragments are taken as the first candidate results. When the type of the parameter to be filled is determined to be relational query type, the core controller generates a corresponding graph query statement based on the semantic information of the parameter, calls the Neo4j graph database tool to execute the statement, and queries the relationship between entities from the preset knowledge graph. The retrieved relational query results are then used to obtain the relevant relational query results. The first candidate result is the result of the connection. When the type of the parameter to be filled is determined to be logical reasoning type, the core controller generates a logic programming script (such as a Prolog script) according to the business rules corresponding to the parameter to be filled, calls the logic solver (Swipl) tool to execute the script, and obtains a deterministic conclusion through deductive reasoning. This conclusion is the third candidate result. When the type of the parameter to be filled is determined to be calculation verification type, the core controller generates the corresponding program code (such as Python code) according to the numerical calculation, statistical summary or format verification requirements involved in the parameter to be filled, calls the code execution tool to run the code, and uses the obtained result as the fourth candidate result.
[0041] It should be noted that the Search Enhanced Generation (RAG) method retrieves relevant and credible information from external real data sources, and then extracts or generates content based on the search results.
[0042] The logic solver (Swipl) is widely used in scenarios such as complex business rule deduction and constraint satisfaction problem solving. It can convert natural language business rules in fields such as power operation and maintenance and office work into standardized Prolog fact and rule statements. After being loaded into the runtime environment, it can perform reasoning operations according to strict logical deduction rules and output unique and definite reasoning conclusions, rather than the fuzzy inference based on probability of large language models.
[0043] As an optional embodiment, a graph query statement is generated based on the semantic information of the parameters to be filled, and the graph query statement is executed using a preset knowledge graph, including: converting the natural language description of the parameters to be filled into a graph query language statement; executing the graph query language statement through a graph database storing a preset knowledge graph; receiving and parsing the query results returned by the graph database, and using the parsed query results as the second candidate results.
[0044] Specifically, the natural language description of the relational query parameters to be filled is semantically parsed to extract the core entities, relation types, and query constraints (such as querying the line entities, crossing relationships, and voltage level constraints of all 500kV and above substations crossed by a certain line). Then, the Natural Language to Graph Query Statement (NL2Cypher) conversion model is used to convert the parsed semantic elements into graph query language statements that conform to the graph database syntax specifications. The core controller calls the Neo4j graph database tool to submit the generated graph query language statement to the preset knowledge graph for execution. After the query is executed, a structured result set is returned. The core controller receives the result set and performs format parsing and field mapping processing to convert it into structured data that matches the format requirements of the parameters to be filled. Finally, the parsed result is used as the second candidate result.
[0045] As an optional embodiment, a logic programming script is generated based on the business rules of the parameters to be filled in, and the logic programming script is executed by calling a logic solver, including: converting the business rules into rules and facts in a logic programming language; calling a logic solver corresponding to the logic programming language, loading and executing the rules and facts; and using the reasoning conclusion returned by the logic solver as a third candidate result.
[0046] Specifically, semantic parsing is performed on the business rules corresponding to the logical reasoning parameters to be filled, extracting the core logical conditions, constraints, and judgment criteria (such as the judgment rule for determining the risk level based on the maintenance status of multiple lines in the power operation and maintenance scenario). These business rules described in natural language are then converted into logic programming languages (such as Prolog and Swipl). The core controller calls the appropriate logic solver (such as Swipl) according to the type of logic programming language generated. First, the converted rules and facts are loaded into the logic solver's runtime environment to complete initialization. Then, the logic solver is triggered to perform inference operations according to formal logical deduction rules. After the logic solver completes the execution, it returns a unique and definite inference conclusion. The core controller receives the conclusion and verifies its logical consistency. Then, it converts the conclusion into text or numerical form that meets the format requirements of the parameters to be filled, and finally uses the conclusion as the third candidate result.
[0047] As an optional embodiment, a confidence assessment is performed on the candidate results to obtain a confidence assessment result, including: generating a confidence assessment result based on at least one of the following methods: determining the confidence assessment result based on the certainty level of the information extraction path corresponding to the candidate result; determining the confidence assessment result based on the source reliability and content relevance of the source information on which the candidate result is obtained; determining the confidence assessment result based on the consistency between multiple candidate results when multiple candidate results exist; and determining the confidence assessment result based on the logical consistency or numerical reasonableness of the candidate results.
[0048] Specifically, such as Figure 3 The diagram illustrates the parameter extraction and verification process of a document generation method in this application embodiment. The evaluation module performs weighted adjustments based on the reliability of the source information and the relevance of the content when obtaining candidate results. If the source information comes from reliable channels such as authoritative equipment ledgers and official survey records, and is highly semantically matched with the parameters to be filled in, the confidence level is increased accordingly; otherwise, it is decreased. When there are multiple candidate results, the evaluation module further compares the consistency between results obtained from different paths or different source information. If the results from multiple paths are highly consistent, the confidence level is significantly increased. If there is a significant discrepancy, a consistency check is triggered. At the same time, the evaluation module also checks the logical consistency or numerical rationality of the candidate results themselves, such as whether the values are within the range allowed by business specifications and whether the logical deduction conforms to preset rules. If there are contradictions or unreasonable aspects, the confidence level is reduced.
[0049] As an optional embodiment, the method further includes: triggering a correction mechanism in response to determining that the confidence assessment result is lower than a preset threshold; wherein the correction mechanism includes at least one of the following operations: re-determining the information extraction path based on the parameter to be filled, and re-executing the step of obtaining candidate results related to the parameter to be filled based on the re-determined path; generating prompt information for manual review.
[0050] Specifically, after completing the confidence assessment, if the confidence assessment result of a certain parameter to be filled is determined to be lower than the system's preset qualified threshold, a correction mechanism is triggered. When it is necessary to replan the information acquisition path, the core controller will combine the semantic context of the parameter to be filled and the execution feedback of the previous extraction path to re-parse the information acquisition requirements of the parameter, adjust the parameter type classification or optimize the path matching rules, determine a new information extraction path, schedule the corresponding tool to execute the candidate result acquisition step again, generate candidate results again, and re-enter the confidence assessment stage until the result meets the standard. When manual intervention is required, the system will automatically generate a manual review prompt message containing the identifier of the parameter to be filled, the current candidate result, the confidence score, the source document, and the reasoning process, and push it to the terminal of the designated business personnel or reviewers to request manual confirmation or supplementary information. At the same time, the review request and related data will be synchronized to the short-term memory module for subsequent traceability and management.
[0051] In summary, the document generation method provided in this application includes: in response to receiving a target document template, parsing and processing the target document template and identifying parameters to be filled in; determining an information extraction path based on the semantic type of the parameters to be filled in; obtaining candidate results related to the parameters to be filled in based on the information extraction path; evaluating the confidence of the candidate results to obtain a confidence evaluation result; and, in response to determining that the confidence evaluation result is not lower than a preset threshold, filling the candidate results into the target document template. Therefore, this application can solve problems such as low document generation efficiency, poor data extraction accuracy, high cost and error-proneness of manual intervention, insufficient reliability of results, and fragmented context. It ensures the accuracy and standardization of each parameter filled into the target template, significantly reducing the human resource cost, operational complexity, and labor intensity of document generation. It allows for complete traceability of the extraction source of each parameter from the reasoning chain, facilitating manual review and improving the efficiency and reliability of document generation.
[0052] It should be noted that the method of this embodiment can be executed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method of this embodiment, and the multiple devices will interact with each other to complete the above method.
[0053] It should be noted that the above description describes some embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in a different order than that shown in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0054] refer to Figure 4 This is a schematic diagram of a document generation system in an embodiment of this application.
[0055] The document generation system 400 includes: a parameter recognition module 401, an extraction path determination module 402, a candidate result determination module 403, a confidence assessment module 404, and a document filling module 405.
[0056] The parameter recognition module 401 is configured to: in response to receiving a target document template, parse and process the target document template and identify the parameters to be filled in.
[0057] The extraction path determination module 402 is configured to determine the information extraction path based on the semantic type of the parameter to be filled in.
[0058] The candidate result determination module 403 is configured to: obtain candidate results related to the parameters to be filled in based on the information extraction path.
[0059] The confidence assessment module 404 is configured to: assess the confidence of candidate results and obtain the confidence assessment result.
[0060] The document filling module 405 is configured to fill the candidate results into the target document template in response to determining that the confidence assessment result meets the preset conditions.
[0061] The extraction path determination module 402 is also configured as follows: The information extraction path is determined based on the semantic type of the parameters to be filled in, including: The parameters to be filled in are classified into at least one of the following types according to the information acquisition method: direct extraction type, relational query type, logical reasoning type, and calculation verification type. The information extraction path is determined based on the type of parameter to be filled in.
[0062] Candidate result determination module 403 is also configured as follows: Based on the information extraction path, candidate results related to the parameters to be filled in are obtained, including: In response to determining that the type of the parameter to be filled is direct extraction, the text fragments related to the parameter to be filled are obtained from the candidate document set through a search-enhanced generation method and used as the first candidate result; In response to determining that the type of the parameter to be filled is a relational query, a graph query statement is generated based on the semantic information of the parameter to be filled, and the graph query statement is executed using a preset knowledge graph to obtain a second candidate result. The preset knowledge graph is constructed based on a set of candidate documents and stores entities extracted from the set of candidate documents and the relationships between entities. In response to determining that the type of the parameter to be filled is logical reasoning, a logic programming script is generated based on the business rules of the parameter to be filled, and the logic solver is called to execute the logic programming script to obtain the third candidate result; In response to the determination that the type of the parameter to be filled is calculation verification type, program code is generated based on the numerical values and logical relationships involved in the parameter to be filled, and the program code is executed to obtain the fourth candidate result.
[0063] Optionally, the candidate result determination module 403 is also configured to: Generate a graph query statement based on the semantic information of the parameters to be filled in, and execute the graph query statement using a preset knowledge graph, including: Convert the natural language description of the parameters to be filled into a graph query language statement; Execute graph query language statements through a graph database that stores pre-defined knowledge graphs; Receive and parse the query results returned by the graph database, and use the parsed query results as the second candidate results.
[0064] Optionally, the candidate result determination module 403 is also configured to: A logic programming script is generated based on the business rules for the parameters to be filled in, and the logic solver is called to execute the logic programming script, including: Translate business rules into rules and facts in a logic programming language; Invoke the logic solver corresponding to the logic programming language, load and execute the rules and facts; The reasoning conclusion returned by the logic solver is used as the third candidate result.
[0065] The confidence assessment module 404 is also configured as follows: The confidence level of the candidate results is evaluated to obtain the confidence level evaluation results, including: Generate confidence assessment results based on at least one of the following methods: The confidence assessment result is determined based on the certainty level of the information extraction path corresponding to the candidate results; The confidence assessment result is determined based on the reliability of the source information and the relevance of the content when obtaining the candidate results; When multiple candidate results exist, the confidence assessment result is determined based on the degree of consistency among the multiple candidate results; The confidence level assessment result is determined based on the logical consistency or numerical reasonableness of the candidate results.
[0066] The document entry module 405 is also configured as follows: In response to determining that the confidence assessment result is lower than the preset threshold, a correction mechanism is triggered; The correction mechanism includes at least one of the following operations: The information extraction path is redefined based on the parameters to be filled in, and the step of obtaining candidate results related to the parameters to be filled in is executed again based on the redefined path. Generate prompts for manual review.
[0067] The document generation system provided in this application can solve problems such as low document generation efficiency, poor data extraction accuracy, high cost and error-proneness of manual intervention, insufficient reliability of results and fragmented context. It ensures the accuracy and standardization of each parameter entered into the target template, significantly reduces the human cost, operational complexity and labor intensity of document generation, and can fully trace the extraction source of each parameter from the reasoning chain, which is convenient for manual review and improves the efficiency and reliability of document generation.
[0068] refer to Figure 5The diagram below is a block diagram of an electronic device according to some embodiments of the present invention. It illustrates a more specific hardware structure of an electronic device provided in this application embodiment. The device may include: a processor 510, a memory 520, an input / output interface 530, a communication interface 540, and a bus 550. The processor 510, memory 520, input / output interface 530, and communication interface 540 are interconnected internally via the bus 550.
[0069] The processor 510 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0070] The memory 520 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 520 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 520 and is called and executed by the processor 510.
[0071] Input / output interface 530 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.
[0072] The communication interface 540 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0073] Bus 550 includes a pathway for transmitting information between various components of the device, such as processor 510, memory 520, input / output interface 530, and communication interface 540.
[0074] It should be noted that although the above-described device only shows the processor 510, memory 520, input / output interface 530, communication interface 540, and bus 550, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.
[0075] The electronic devices described above are used to implement the corresponding document generation methods in any of the foregoing embodiments, and have the beneficial effects of the corresponding document generation method embodiments, which will not be repeated here.
[0076] Based on the same concept, corresponding to the document generation method provided in any of the above embodiments, this application also provides a computer-readable storage medium storing a program or instructions, which, when executed by a processor, implements the document generation method as described in the first aspect.
[0077] The aforementioned computer-readable storage medium can be any available medium or data storage device that a computer can access, including but not limited to magnetic storage (e.g., floppy disks, hard disks, magnetic tapes, magneto-optical disks (MOs), etc.), optical storage (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND flash), solid-state drives (SSDs)).
[0078] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the corresponding document generation method in any of the foregoing embodiments, and have the beneficial effects of the corresponding document generation method embodiments, which will not be repeated here.
[0079] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0080] From the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of computer software products plus necessary general-purpose hardware platforms, and of course, they can also be implemented by hardware. The computer software product is stored in a storage medium (such as ROM, RAM, magnetic disk, optical disk, etc.) and includes several instructions to cause the terminal or network-side device to execute the methods described in the various embodiments of this application.
[0081] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other implementations under the guidance of this application without departing from the spirit and scope of the claims. All of these implementations are within the protection scope of this application.
Claims
1. A document generation method, characterized in that, include: In response to receiving a target document template, the target document template is parsed and the parameters to be filled in are identified; The information extraction path is determined based on the semantic type of the parameter to be filled in, including: The parameters to be filled are classified into at least one of the following types according to the information acquisition method: direct extraction type, relational query type, logical reasoning type, and calculation verification type. The information extraction path is determined based on the type of the parameter to be filled in; Based on the information extraction path, candidate results related to the parameter to be filled are obtained, including: In response to determining that the type of the parameter to be filled is direct extraction type, a text fragment related to the parameter to be filled is obtained from the candidate document set through a search-enhanced generation method, and used as the first candidate result; In response to determining that the type of the parameter to be filled is a relational query, a graph query statement is generated based on the semantic information of the parameter to be filled, and the graph query statement is executed using a preset knowledge graph to obtain a second candidate result. The preset knowledge graph is constructed based on the candidate document set and stores entities extracted from the candidate document set and the relationships between the entities. In response to determining that the type of the parameter to be filled is logic reasoning type, a logic programming script is generated based on the business rules of the parameter to be filled, and the logic solver is called to execute the logic programming script to obtain a third candidate result; In response to determining that the type of the parameter to be filled is calculation verification type, program code is generated based on the numerical values and logical relationships involved in the parameter to be filled, and the program code is executed to obtain a fourth candidate result; The confidence level of the candidate results is evaluated to obtain the confidence level evaluation result; In response to determining that the confidence assessment result is not lower than a preset threshold, the candidate result is filled into the target document template.
2. The document generation method according to claim 1, characterized in that, The process of generating a graph query statement based on the semantic information of the parameters to be filled in, and executing the graph query statement using a preset knowledge graph, includes: The natural language description of the parameters to be filled in is converted into a graph query language statement; The graph query language statement is executed through a graph database storing the preset knowledge graph; The system receives and parses the query results returned by the graph database, and uses the parsed query results as the second candidate results.
3. The document generation method according to claim 1, characterized in that, The process of generating a logic programming script based on the business rules for the parameters to be filled in, and then calling a logic solver to execute the logic programming script, includes: The business rules are then converted into rules and facts in a logic programming language. Invoke the logic solver corresponding to the logic programming language, load and execute the rules and facts; The reasoning conclusion returned by the logic solver is taken as the third candidate result.
4. The document generation method according to claim 1, characterized in that, The step of evaluating the confidence level of the candidate results to obtain the confidence evaluation result includes: The confidence assessment result is generated based on at least one of the following methods: The confidence assessment result is determined based on the certainty level of the information extraction path corresponding to the candidate result; The confidence assessment result is determined based on the reliability of the source information and the relevance of the content when obtaining the candidate results; When multiple candidate results exist, the confidence assessment result is determined based on the degree of consistency among the multiple candidate results; The confidence assessment result is determined based on the logical consistency or numerical reasonableness of the candidate results.
5. The document generation method according to claim 1, characterized in that, The method further includes: In response to determining that the confidence assessment result is lower than the preset threshold, a correction mechanism is triggered; The correction mechanism includes at least one of the following operations: The information extraction path is redefined based on the parameters to be filled in, and the step of obtaining candidate results related to the parameters to be filled in is executed again based on the redefined path. Generate prompts for manual review.
6. A document generation system, characterized in that, include: The parameter recognition module is configured to: in response to receiving a target document template, parse the target document template and identify the parameters to be filled in; The extraction path determination module is configured to determine the information extraction path based on the semantic type of the parameter to be filled in, including: The parameters to be filled are classified into at least one of the following types according to the information acquisition method: direct extraction type, relational query type, logical reasoning type, and calculation verification type. The information extraction path is determined based on the type of the parameter to be filled in; The candidate result determination module is configured to: obtain candidate results related to the parameter to be filled in based on the information extraction path, including: In response to determining that the type of the parameter to be filled is direct extraction type, a text fragment related to the parameter to be filled is obtained from the candidate document set through a search-enhanced generation method, and used as the first candidate result; In response to determining that the type of the parameter to be filled is a relational query, a graph query statement is generated based on the semantic information of the parameter to be filled, and the graph query statement is executed using a preset knowledge graph to obtain a second candidate result. The preset knowledge graph is constructed based on the candidate document set and stores entities extracted from the candidate document set and the relationships between the entities. In response to determining that the type of the parameter to be filled is logic reasoning type, a logic programming script is generated based on the business rules of the parameter to be filled, and the logic solver is called to execute the logic programming script to obtain a third candidate result; In response to determining that the type of the parameter to be filled is calculation verification type, program code is generated based on the numerical values and logical relationships involved in the parameter to be filled, and the program code is executed to obtain a fourth candidate result; The confidence assessment module is configured to: assess the confidence of the candidate results and obtain a confidence assessment result; The document filling module is configured to: in response to determining that the confidence assessment result meets preset conditions, fill the candidate result into the target document template.
7. An electronic device, characterized in that, include: A processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the document generation method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the document generation method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
File generation method and device
CN118133798A
Document and engineering object automatic matching method and system based on artificial intelligence
CN121581013A