Document generation method and device based on variable analysis, equipment and storage medium

By detecting and completing the split variable identifiers in the financial document template, the problem of inability to correctly parse variable identifiers in the existing technology is solved, and the accuracy and efficiency of document generation is improved, ensuring compliance with legal documents is ensured. Sex and customer experience.

CN119129562APending Publication Date: 2024-12-13PING AN BANK CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411193768.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

When processing variables in financial document templates, the split variable identifier cannot be correctly identified and parsed, resulting in inaccurate content generated by the document, affecting business compliance and customer experience.

Method used

By receiving a document generation request containing template ID, version information and target value, searching the template document from the database, using text parsing technology to traverse each text unit, detecting and completing the split variable identifier to make it a complete identifier , then replace with the target value to generate the final target document.

Benefits of technology

It significantly improves the accuracy and efficiency of document generation, ensures that the generated legal documents meet business needs and legal effectiveness, and is suitable for legal documents and contracts with dynamically generated content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119129562A_ABST
    Figure CN119129562A_ABST
Patent Text Reader

Abstract

The invention relates to a document generation method based on variable analysis, and aims to solve the problems of difficult analysis and generation errors caused by splitting dependent variable identifiers into a plurality of text units in a template document in the prior art. According to the method, the document generation request containing the template ID, the version information and the target value is received, the corresponding template document is retrieved from the database, the text units of the template document are traversed through the text analysis technology, and the variable identifier is extracted and detected. When a complete variable identifier is detected, directly replacing the complete variable identifier with a target value; and if it is detected that the variable identifier is split into a plurality of text units, splicing the variable identifier into a complete variable identifier through completion operation, and replacing the complete variable identifier with the target value. And finally, updating the processed text unit into the template document, and generating a final target document. According to the method, the document generation accuracy and efficiency are remarkably improved, and the method is particularly suitable for legal documents and contracts needing dynamic content generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing and analysis, and in particular to a document generation method, device, equipment and storage medium based on variable parsing. Background Art

[0002] In the financial industry, legal documents are key tools for ensuring business compliance, safeguarding corporate rights, and clarifying the rights and obligations between customers and companies. As business needs change, financial institutions need to frequently generate and update legal documents to ensure the timeliness and accuracy of their content. In order to improve the efficiency of document generation, template-based automatic document generation technology is widely used in the industry. These templates usually exist in the form of Word documents, and dynamically generate content by configuring variables to meet personalized needs in different business scenarios.

[0003] In actual applications, financial institutions often need to update variables in document templates. For example, when the business logic changes, a variable A in the template may need to be replaced with a new variable B. However, due to the underlying structure of Word documents, this replacement operation may cause the variable to be split into multiple text units, making it impossible for traditional parsing tools to correctly identify and replace these split variables. This problem not only increases the complexity of document generation, but may also lead to inaccurate content in the generated documents, which in turn affects business compliance and customer experience.

[0004] In order to meet this challenge, the financial industry urgently needs a solution that can automatically identify and correctly parse the split variables. This solution should be able to accurately and efficiently replace the variables in the document template without affecting the structure of the document template, and ensure that the final generated legal document meets business needs and is legally effective and binding. Summary of the invention

[0005] The main purpose of the present invention is to provide a document generation method, device, equipment and storage medium based on variable parsing, aiming to solve the technical problem that the prior art cannot correctly identify and parse the variable identifier being split into multiple text units when processing variables in document templates, thereby causing parsing failure or content errors.

[0006] To achieve the above object, the present invention provides a document generation method based on variable parsing, comprising:

[0007] Receive a document generation request, the document generation request including a template ID, version information and a target value, and retrieve and obtain a corresponding template document from a database according to the template ID and version information;

[0008] Extract variable identifiers from the template document using text parsing technology, traverse each text unit of the template document, and detect whether the variable identifier exists;

[0009] If a complete variable identifier is detected in a single text unit, the variable identifier is replaced with the target value;

[0010] If it is detected that there is a split variable identifier in a single text unit, the split variable identifier is supplemented into a complete variable identifier through a completion operation, and the complete variable identifier is replaced with the target value;

[0011] The replaced text unit is updated into the template document to generate a final target document.

[0012] In one embodiment, if it is detected that a split variable identifier exists in a single text unit, the split variable identifier is completed into a complete variable identifier through a completion operation, including:

[0013] Traversing each text unit in the template document one by one, identifying the text unit containing the variable identifier;

[0014] Detect and record the positions of the split variable identifiers, including the index of the text unit, the paragraph position and the character position;

[0015] Determine the prefix and suffix of the split variable identifier in the text unit, and based on the structure of the variable identifier, character matching rules and the positional relationship of adjacent text units, screen out the split variable identifiers whose prefix and suffix belong to the same complete variable identifier;

[0016] The split variable identifiers where the prefix and suffix are located are merged to generate the complete variable identifier.

[0017] In one embodiment, the split variable identifiers where the prefix and the suffix are located are merged to generate the complete variable identifier, including:

[0018] In the visual interface, the split variable identifiers are displayed as independent identifiers, and multiple splicing suggestions are provided based on the structure of the variable identifiers and the positional relationship of the text units;

[0019] Automatically combine prefixes and suffixes to form complete variable identifiers based on generated concatenation suggestions;

[0020] During the splicing process, the generated complete variable mark will be automatically previewed to show the actual effect in the template document for users to correct or provide feedback;

[0021] After the splicing is completed, verification is automatically performed to check whether the spliced ​​complete variable identifier conforms to the preset format and the semantic logic of the template document. If there is an error, the exception is marked and correction suggestions are made.

[0022] In one embodiment, if it is detected that a split variable identifier exists in a single text unit, the split variable identifier is supplemented into a complete variable identifier through a completion operation, including:

[0023] Recording all variable identifiers retrieved from the template document into a total identifier set, and recording replaced complete variable identifiers into a replaced identifier set;

[0024] If it is detected that a certain text unit only contains the split variable identifier, judging whether the split variable identifier has been processed by the replaced identifier;

[0025] If it has not been processed, determine other split variable identifiers or complete variable identifiers corresponding to the split variable identifier according to the variable identifiers recorded in the total identifier set, and concatenate the split variable identifier and the corresponding other split variable identifiers to obtain a complete variable identifier.

[0026] In one embodiment, before generating the final target document, the method further includes:

[0027] The document generation request includes a custom parameter, the custom parameter includes a position insertion identifier, and the custom parameter is parsed to determine the type of content to be inserted;

[0028] If the inserted content type is a table, extract the table data and table parameters from the custom parameters;

[0029] Parsing the table parameters to determine the number of rows and columns of the table, and generating a target table according to the number of rows and columns of the table;

[0030] Extracting cell data of each row and each column from the table data, and filling the cell data into the target table;

[0031] The target table is inserted into the target document according to the position insertion identifier, and the layout of the target document is adjusted.

[0032] In one embodiment, after retrieving and acquiring the corresponding template document from the database according to the template ID and version information, the method further includes:

[0033] Verify the template document using a file verification algorithm;

[0034] If it is determined after verification that the template document is damaged, an error log is recorded and an alarm system is triggered to notify the user that the file is damaged;

[0035] If it is determined after verification that the template document is not damaged, checking the internal structure of the target file to verify whether key elements in the template document are missing;

[0036] If there is a missing key element, the missing key element is repaired according to the type of the key element and the pre-repair rule, or the key element is queried from the database and corrected into the template document.

[0037] In one embodiment, after generating the final target document, the method further includes:

[0038] Creating a review document according to the target document, and screening the content replaced by the variable identifier in the review document;

[0039] Filtering the review documents for financial related information involving amounts, interest rates, and fees, using regular expressions to match text containing currency symbols, percentage symbols, or numbers;

[0040] Annotating the screened and matched content in the review document, and sending the annotated review document to the reviewer for review;

[0041] When the review document is approved, the target document is confirmed to be qualified.

[0042] Furthermore, to achieve the above object, the present invention also provides a document generation device based on variable parsing, comprising:

[0043] The template determination module receives a document generation request including a template ID, version information, and a target value, and retrieves and obtains a corresponding template document from a database according to the template ID and version information;

[0044] A text parsing module, which uses text parsing technology to extract variable identifiers from the template document, traverses each text unit of the template document, and detects whether the variable identifier exists;

[0045] A variable replacement module, if a complete variable identifier is detected in a single text unit, replaces the variable identifier with the target value;

[0046] A variable completion module, if it is detected that there is a split variable identifier in a single text unit, supplements the split variable identifier into a complete variable identifier through a completion operation, and replaces the complete variable identifier with the target value;

[0047] The document generation module updates the replaced text unit into the template document to generate a final target document.

[0048] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a document generation device based on variable parsing, wherein the document generation device based on variable parsing includes a memory, a processor, and a document generation program based on variable parsing stored in the memory and executable on the processor, wherein the document generation program based on variable parsing implements the steps of the document generation method based on variable parsing as described above when executed by the processor.

[0049] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a computer storage medium, on which a document generation program based on variable parsing is stored, and when the document generation program based on variable parsing is executed by a processor, the steps of the document generation method based on variable parsing as described above are implemented.

[0050] Beneficial effects: The present invention relates to a document generation method based on variable parsing, which aims to solve the problems of parsing difficulties and generation errors caused by variable identifiers being split into multiple text units in the template document in the prior art. The present invention receives a document generation request containing a template ID, version information and a target value, retrieves the corresponding template document from a database, and uses text parsing technology to traverse each text unit of the template document to extract and detect variable identifiers. When a complete variable identifier is detected, it is directly replaced with the target value; if it is detected that the variable identifier is split into multiple text units, it is spliced ​​into a complete variable identifier through a completion operation and replaced with the target value. Finally, the processed text units are updated to the template document to generate the final target document. The present invention significantly improves the accuracy and efficiency of document generation, and is particularly suitable for legal documents and contracts that require dynamic content generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0052] Figure 1 It is a flow chart of an embodiment of a document generation method based on variable parsing of the present invention;

[0053] Figure 2 It is a functional module diagram of a preferred embodiment of a document generation device based on variable parsing of the present invention;

[0054] Figure 3 It is a structural schematic diagram of the device hardware operating environment involved in the embodiment of the document generation device based on variable parsing of the present invention. DETAILED DESCRIPTION

[0055] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0056] It should be noted that in the financial industry, legal documents are key tools to ensure business compliance, safeguard the rights and interests of the company, and clarify the rights and obligations between customers and the company. As business needs change, financial institutions need to frequently generate and update legal documents to ensure the timeliness and accuracy of their content. In order to improve the efficiency of document generation, template-based automatic document generation technology is widely used in the industry. These templates usually exist in the form of Word documents, and dynamically generate content by configuring variables to meet personalized needs in different business scenarios.

[0057] In actual applications, financial institutions often need to update variables in document templates. For example, when the business logic changes, a variable A in the template may need to be replaced with a new variable B. However, due to the underlying structure of Word documents, this replacement operation may cause the variable to be split into multiple text units, making it impossible for traditional parsing tools to correctly identify and replace these split variables. This problem not only increases the complexity of document generation, but may also lead to inaccurate content in the generated documents, which in turn affects business compliance and customer experience.

[0058] In order to meet this challenge, the financial industry urgently needs a solution that can automatically identify and correctly parse the split variables. This solution should be able to accurately and efficiently replace the variables in the document template without affecting the structure of the document template, and ensure that the final generated legal document meets business needs and is legally effective and binding.

[0059] See also Figure 1 , Figure 1 This is a flow chart of an embodiment of a document generation method based on variable parsing provided by the present invention. It should be noted that although a logical sequence is shown in the flow chart, in some cases, the steps shown or described may be performed in a different order than that shown here.

[0060] like Figure 1 As shown, the document generation method based on variable parsing proposed by the present invention includes the following steps:

[0061] S10, receiving a document generation request, the document generation request including a template ID, version information and a target value, and retrieving and acquiring a corresponding template document from a database according to the template ID and version information;

[0062] In this embodiment, the document generation request is an instruction initiated by a user or a system to generate a document based on a template. The request includes key parameters for determining the type of document to be generated, the template to be used, and its version. The template ID is a parameter that uniquely identifies a document template and is used to retrieve a specific template document from a database. For example, the template ID may correspond to a standard contract template. The version information indicates the specific version of the template used. This is essential for maintaining multi-version control of templates to ensure that the latest or specified template version is used to generate the document. The target value is the actual content that will replace the template variable identifier during the document generation process. The target value can be a customer name, contract amount, date, etc., which is dynamically generated according to different business scenarios. The database stores all available document templates, including information of different IDs and versions. After receiving the template ID and version information, the system will retrieve the corresponding template document from the database. This step ensures that the most appropriate template is used in the document generation process.

[0063] In one specific implementation, in a financial institution, a client manager sends a document generation request through a dedicated document management system, with the template ID being "Personal Loan Contract" and the version information being "v1.0". Based on the request, the system first retrieves the template document in the database, and automatically detects the timeliness of the template version when loading. If the template version is not the latest, the system will prompt you to update to the latest version to ensure that the contract complies with current legal requirements. The target value is dynamically entered by the client manager based on the client information, including the loan amount, repayment period, etc. After obtaining the template document, the system parses and identifies the variable identifiers in the template, such as "${loanAmount}", and then replaces them according to the target value. During the replacement process, if it is found that the variable identifier is split into different text units, the system will automatically splice and complete them to ensure that the content of the contract is complete and accurate. The final generated contract document is exported in PDF format for the client manager to review and send to the client for signature.

[0064] In another specific implementation, a large financial institution processes batch loan applications through an automated platform. The document generation request is automatically triggered by the system, the template ID is "corporate loan contract", and the version information is "v2.3". During the request processing, the system not only retrieves the template document in the database, but also automatically checks the compliance of the template according to the business rules. If the template version does not meet the latest regulatory requirements, the system will automatically apply the latest compliance revision and record the version update log. The target value includes the basic information of the corporate customer, the loan amount, the risk rating, etc. In this implementation, while replacing the variable identifier, the system will also adjust the specific terms of the contract according to the customer's credit score, such as the loan interest rate or the default liability clause. The system will handle complex variable splicing, such as some variable identifiers spanning paragraphs or tables, to ensure that each identifier is accurately replaced with the corresponding target value. The final generated document is automatically reviewed at multiple levels to ensure the accuracy and legal compliance of the content before being sent to the corporate customer.

[0065] In other specific implementations, on the online platform of a financial institution, a customer initiates a compliance report generation request on his own initiative, with the template ID being "Compliance Check Report" and the version information being "v3.0". After receiving the request, the system first retrieves the corresponding template document from the database, and uses an AI-driven compliance check tool to update the template content in real time to adapt to the latest regulatory requirements. The target value is automatically generated by the system based on the data provided by the user, including the compliance status of different business departments, key risk indicators, etc. After obtaining the template document, the system parses and replaces complex variable identifiers in the template, such as dynamically generated risk assessment formulas or compliance checkpoints cross-referenced by multiple departments. If a variable identifier is detected to be split in the template, the system not only splices and completes the identifier, but also performs a content consistency check to ensure that the logic and data between different parts of the content are consistent. The final generated compliance report is automatically formatted into multiple file formats (such as PDF and HTML) to meet different review and archiving requirements, and is distributed to relevant departments for review through the compliance management platform.

[0066] Through the above steps, the accuracy of template version control, compliance of document content and accuracy of data replacement are improved when processing financial document generation. In particular, the reliability and business adaptability of generated documents are significantly improved in processing complex variable identifier splicing and content updates, ensuring that documents always meet the latest legal and business requirements.

[0067] S20, extracting a variable identifier from the template document using a text parsing technique, traversing each text unit of the template document, and detecting whether the variable identifier exists;

[0068] In this embodiment, text parsing technology refers to technical means for automatically extracting and analyzing text content from a document. This can include regular expressions, natural language processing (NLP) and other technologies for identifying specific text patterns or identifiers. In this scenario, text parsing technology is used to scan each text unit in the template document to extract and identify predefined variable identifiers, such as text fragments in the format of "${variableName}". The template document consists of multiple text units (such as paragraphs, sentences, table cells, etc.), and traversing the text units means that the system checks each text part in the document one by one to ensure that each unit that may contain variable identifiers is processed. This ensures that variable identifiers can be accurately detected even if they are distributed in different document parts. During the traversal process, the system checks whether each text unit contains variable identifiers in a predefined format. After detecting variable identifiers, the system will further process these identifiers, such as replacement, splicing or completion operations. Example: For example, in a template of a loan contract, the text parsing technology will scan the entire document, identify variable identifiers similar to "${loanAmount}", and detect their presence in different text units, whether these identifiers are complete or split.

[0069] In one specific implementation, the document generation system uses regular expressions as a text parsing technique to extract variable identifiers. When the system traverses each text unit, it first identifies the formatted variable identifier (such as "${loanAmount}") through regular expressions and records its position in the document. If the variable identifier is fully detected, it is directly marked as a replaceable object. If the variable identifier is split into different text units, the system will splice these parts to form a complete variable identifier. This method expands the logic of detection and splicing to ensure that all variable identifiers can be accurately identified and processed even in complex contract templates.

[0070] In another specific embodiment, the system uses natural language processing (NLP) technology for text parsing. In financial document templates, NLP not only recognizes formatted variable identifiers, but also analyzes non-standard variable identifiers based on contextual semantics. For example, when variable identifiers span multiple paragraphs or table cells, NLP technology can identify these incomplete identifiers and automatically complete them based on semantic logic to ensure accurate extraction and processing of variables. This implementation not only expands the detection range of variable identifiers, but also increases the ability to recognize variable identifiers in complex contexts.

[0071] In other specific embodiments, the compliance report generation system uses a pattern matching algorithm for text parsing to process complex nested tables and text units that span paragraphs. When traversing a document, the system not only detects variable identifiers, but also analyzes their relevance in the entire document based on the context of the identifier. If an identifier is split or deformed, the system tracks all its instances in different text units and restores it to a complete identifier through pattern matching. This approach expands the detection and splicing logic of identifiers and is particularly suitable for processing documents with high complexity and highly dispersed identifiers.

[0072] By using text parsing technology to traverse each text unit in the template document one by one and detect variable identifiers, the system can accurately identify and process identifiers regardless of how they are distributed and split. This significantly improves the accuracy and consistency of the document generation process, especially when dealing with complex document structures and diverse variable identifiers, ensuring the reliability and integrity of the final generated document.

[0073] S30, if it is detected that a complete variable identifier exists in a single text unit, the variable identifier is replaced with the target value;

[0074] In this embodiment, during the document generation process, the system traverses each text unit in the template document to identify whether there is a complete variable identifier therein. A complete variable identifier refers to a variable that has not been split and is fully presented in a single text unit, such as "${customerName}" or "${loanAmount}". Once a complete variable identifier is detected, the system replaces it with a predetermined target value. The target value is usually determined based on user input or system-generated dynamic data, such as the customer's name, loan amount, or contract date. The replacement operation ensures that the position of the variable identifier in the document is accurately replaced with the actual business data.

[0075] In one specific implementation, when the system detects that there is a complete variable identifier in a single text unit, it directly replaces the identifier with the target value. In this process, the system not only performs a simple replacement, but also automatically formats the target value according to the document format requirements. For example, if the target value is a date, the system will convert the date format to a specific format (such as "YYYY-MM-DD") according to the requirements of the template. If the target value is an amount, the system will also convert it to a format with a currency symbol and a thousandth separator to ensure that the generated document content format is consistent and meets business specifications.

[0076] In another specific implementation, during the financial contract generation process, when replacing the complete variable identifier, the system not only performs a single replacement, but also supplements the target value with context-sensitive content according to the business logic. For example, when replacing the variable identifier of the customer name, the system automatically checks whether there are variable identifiers related to the customer in other parts of the document, and synchronously updates all related identifiers in the document when necessary to ensure the consistency of the document content. At the same time, the system will also automatically adjust the font, color and other styles of the text unit according to business needs, so that the presentation of the target value is consistent with the overall style of the document.

[0077] By detecting and replacing complete variable identifiers, the data replacement problem in the document generation process is effectively solved, ensuring the accuracy and consistency of the document content. In the scenario of financial document generation, variable identifiers in document templates are often used to dynamically insert customer-related information, such as name, amount, etc. Through precise variable replacement, the system can generate customized documents that meet actual business needs, reduce manual intervention, and improve generation efficiency.

[0078] S40, if it is detected that there is a split variable identifier in the single text unit, the split variable identifier is supplemented into a complete variable identifier through a completion operation, and the complete variable identifier is replaced with the target value;

[0079] In this embodiment, during the document generation process, the system traverses each text unit in the template document to identify whether there is a split variable identifier therein. A split variable identifier refers to a partial variable identifier that is divided into multiple text units due to document editing or formatting reasons. For example, the variable "${loanAmount}" may be divided into two parts, "${loanA" and "mount}" due to paragraph separation. After detecting the split variable identifier, the system merges these scattered parts into a complete variable identifier through a completion operation. This process includes identifying the order and position of each part and splicing them into a continuous complete identifier. Once the split variable identifier is completed, the system will replace it with a predetermined target value. The target value is usually generated based on actual business data, such as a customer's loan amount or contract number.

[0080] In one specific implementation, when processing split variable identifiers, the system uses natural language processing (NLP) technology to perform in-depth analysis of the document content. The system not only identifies the split variable identifiers, but also determines the integrity and rationality of the identifiers through contextual semantic analysis. In this way, the system can accurately locate and splice the split identifiers in complex documents and replace them with target values. In addition, the system can also adjust the expression of the target value according to the context of the document, such as expressing the amount in uppercase numbers, or adjusting the date format to a specified style. This method is suitable for processing long reports or compliance documents, where variable identifiers may be widely distributed and split.

[0081] By detecting and completing the split variable identifiers, the system effectively solves the parsing failure and content error problems caused by the dispersion of variable identifiers during document generation. The system can accurately identify, splice and replace variable identifiers in complex document structures to ensure that the generated document content is coherent, accurate and meets business needs.

[0082] S50, updating the replaced text unit into the template document to generate a final target document.

[0083] In this embodiment, during the document generation process, the system replaces the variable identifiers in the template document with the corresponding target values. The replaced text units refer to those text paragraphs, sentences or table units that have been modified. The replaced text units are reinserted back into the original template document, replacing the parts that originally contained the variable identifiers. This operation ensures that the content of the entire document is correctly updated and the generated document contains accurate business data. After all replacement and update operations are completed, the template document is converted into the final target document. This document is the version for final use or publication by the user, such as a contract, report, etc. The target document is usually a complete formatted document ready for review, signing or archiving.

[0084] In complex compliance report generation scenarios, the system performs real-time content verification when updating replaced text units into template documents. The system not only inserts the replaced text units, but also checks the consistency of text formatting, the logic of the content, and the accuracy of the layout. For example, the system ensures that all updated table rows and columns are aligned, and automatically adjusts text fonts and paragraph styles to meet the company's document format standards. Ultimately, the target document generated by the system is a strictly verified compliance report that can be used directly for regulatory submissions or internal reviews.

[0085] By updating the replaced text units to the template document and generating the final target document, the present invention significantly improves the accuracy and consistency of document generation. After processing complex variable replacements, the system can automatically adjust the document format and structure to ensure that the generated target document meets business requirements and format specifications.

[0086] The present invention relates to a document generation method based on variable parsing, which aims to solve the problem of parsing difficulties and generation errors caused by variable identifiers being split into multiple text units in a template document in the prior art. The present invention receives a document generation request containing a template ID, version information and a target value, retrieves the corresponding template document from a database, and uses text parsing technology to traverse each text unit of the template document to extract and detect variable identifiers. When a complete variable identifier is detected, it is directly replaced with the target value; if it is detected that the variable identifier is split into multiple text units, it is spliced ​​into a complete variable identifier through a completion operation and replaced with the target value. Finally, the processed text units are updated to the template document to generate the final target document. The present invention significantly improves the accuracy and efficiency of document generation, and is particularly suitable for legal documents and contracts that require dynamic content generation.

[0087] In one embodiment, in the above S40, if it is detected that there is a split variable identifier in a single text unit, the split variable identifier is completed into a complete variable identifier through a completion operation, including:

[0088] S401, traversing each text unit in the template document one by one, identifying a text unit containing a variable identifier;

[0089] S402, detecting and recording the position of the split variable identifier, including the index of the text unit, the paragraph position and the character position;

[0090] S403, determining the prefix and suffix of the split variable identifier in the text unit, and based on the structure of the variable identifier, character matching rules and the positional relationship of adjacent text units, screening out the split variable identifiers whose prefix and suffix belong to the same complete variable identifier;

[0091] S404: Merge the split variable identifiers where the prefix and the suffix are located to generate the complete variable identifier.

[0092] In this embodiment, the system scans each text unit (such as a paragraph, a table cell) in the document to find and identify whether a variable identifier exists. The system not only detects the existence of the variable identifier, but also records its position in the document, including the index of the text unit, the paragraph position, and the character position. These position data are crucial for processing the split variable identifiers. The system detects and records the prefix and suffix parts of the split variable identifier. Due to format adjustments or other reasons, a complete variable identifier (such as "${loanAmount}") may be split into multiple parts. For example, "${loanA" and "mount}" become prefixes and suffixes, respectively. These parts usually appear in adjacent or close positions in the document.

[0093] The system analyzes the contents of the text units one by one to identify whether there are split identifier parts. The identification method includes detecting the beginning part of the symbol "${" as a prefix and the ending part of "}" as a suffix. The system temporarily marks these parts as possible prefixes and suffixes, waiting for subsequent matching and merging operations.

[0094] The system performs structural analysis based on the definition format of variable identifiers (such as "${variableName}"). This structure usually includes an identifier name enclosed between "${" and "}". The system uses this fixed format to identify the different parts of the identifier and compares possible prefixes and suffixes with the standard format to confirm whether they belong to the same identifier.

[0095] Character matching rules are used to associate prefixes and suffixes. The system compares the prefix part (such as "loanA") and the suffix part (such as "mount") to confirm whether they can be spliced ​​into a complete variable identifier that conforms to the identifier format. When matching characters, the system considers letters, numbers, and possible special symbols within the identifier to ensure the accuracy of the match.

[0096] The system not only analyzes the content of the identifiers, but also considers the positional relationship of these identifiers in the document. The system gives priority to adjacent text units, because the split variable identifier parts usually appear in adjacent or nearby text units. Through the analysis of positional relationships, the system can further filter out which prefixes and suffixes belong to the same variable identifier.

[0097] If the prefix and suffix are spread across adjacent cells, the system will merge them into a complete identifier through a concatenation operation. For example, in a multi-column or multi-table document, the prefix of a variable identifier may be in one column and the suffix in another column. The system will search across cells and concatenate these parts.

[0098] Through the previous steps, the system will generate a list of possible prefix and suffix pairs. Then, the system will screen out the best pairing combination based on the standard format of the variable identifier, character matching results and position relationship, and confirm which prefixes and suffixes should be merged into a complete identifier.

[0099] Once the correct pairing is confirmed, the system merges these prefixes and suffixes into a complete variable identifier. This merging operation not only simply connects the prefix and suffix, but also adjusts the spliced ​​identifier to match the overall style of the document according to the format and layout requirements of the document.

[0100] In one specific implementation, when the system traverses the text units in the template document, it uses character matching rules to identify the split variable identifiers. The system first detects "${loanA" as a prefix, and finds the matching "mount}" as a suffix in the subsequent text unit. By analyzing the structure and position relationship of the two, the system determines that they belong to the same variable identifier, merges them into the complete "${loanAmount}", and then replaces them with the specific loan amount.

[0101] In another specific implementation, the system uses enhanced semantic analysis to identify split variable identifiers when processing long documents. By analyzing the content of the prefix and suffix of the variable identifier, combined with the semantics of the context, the system can more accurately filter out the parts that belong to the same identifier. When the system detects and merges prefixes and suffixes, it also checks the logical consistency of the document to ensure that the replaced variable identifier is semantically correct.

[0102] In other embodiments, when processing complex financial statements, the system uses cross-unit position analysis to concatenate split variable identifiers. The system recognizes that the prefix of the variable identifier is located in one column of the table, while the suffix is ​​located in another adjacent column. Through position matching rules, the system concatenates these parts and generates a complete variable identifier, such as "${totalIncome}", which is then replaced with the actual financial data.

[0103] Through the above steps, this embodiment can effectively handle the problem of variable identifier splitting caused by format adjustment. The system ensures that all split variable identifiers can be accurately identified, spliced ​​and replaced, thereby improving the accuracy and consistency of document generation. Especially when dealing with complex document structures, this method can ensure that the generated document content is complete and conforms to the expected format, reducing the need for manual intervention.

[0104] In one embodiment, the above S404 includes:

[0105] S4041, displays the split variable identifiers as independent identifiers in the visual interface, and provides multiple splicing suggestions based on the structure of the variable identifiers and the positional relationship of the text units;

[0106] S4042, automatically combining prefixes and suffixes to form a complete variable identifier based on the generated concatenation suggestion;

[0107] S4043, during the splicing process, the generated complete variable identification will be automatically previewed to show the actual effect in the template document for users to correct or provide feedback;

[0108] S4044, after the splicing is completed, verification is automatically performed to check whether the spliced ​​complete variable identifier conforms to the preset format and the semantic logic of the template document. If there is an error, the exception is marked and correction suggestions are made.

[0109] In this embodiment, the system displays the detected prefixes and suffixes as independent identifiers in the visual interface. The user can see the parts of the split variable identifier and their positions in the document. This display method enables the user to clearly identify which identifiers are split and their current status.

[0110] Based on the standard structure of variable identifiers (such as "${variableName}") and the positional relationship of text units, the system generates multiple concatenation suggestions. For example, the system may suggest concatenating "${loanA" and "mount}" into "${loanAmount}". The system can provide users with the best concatenation options based on the structure of the identifier and the positional relationship of the text.

[0111] After the user confirms or automatically selects the splicing suggestion, the system automatically combines the prefix and suffix to form a complete variable identifier. This process is completed in the background, and the system operates according to the established splicing rules to ensure that the spliced ​​variable identifier conforms to the standard format.

[0112] During the splicing process, the system automatically generates a preview to show the actual effect of the spliced ​​variable identifiers in the template document. This preview function allows users to see the actual results of the splicing before the final document is generated, and provides the opportunity to make corrections or feedback.

[0113] After the splicing is completed, the system will automatically check whether the generated complete variable identifier conforms to the preset format and the semantic logic of the template document. The system will perform semantic analysis on the splicing results to ensure that its content is logically correct and meets the context requirements. If errors or illogicality are found in the spliced ​​variable identifiers during the verification process, the system will automatically mark these errors and make correction suggestions. For example, if the format of the spliced ​​identifier is incorrect or appears in an inappropriate position in the document, the system will prompt the user and provide possible solutions.

[0114] In another specific embodiment, the system uses natural language processing technology to enhance the generation of splicing suggestions. When processing split identifiers, the system not only generates suggestions based on location and structure, but also generates more intelligent splicing suggestions based on the context and semantic relationships of the document. For example, the system may suggest splicing "${customer" and "Name}" into one of "${customerName}" or "${customerAccount}", and prompt the best choice based on the context of the document. After the splicing is completed, the system not only displays a preview of the splicing, but also uses NLP technology to check the logical consistency of the spliced ​​identifiers in the entire document. After the final splicing result is verified, if any problems are found, the system will mark them and provide detailed correction suggestions.

[0115] In other embodiments, the system provides an enhanced visual interface in complex documents, showing each split variable identifier and its splicing options. Users can adjust the splicing method of the identifier directly in the interface by dragging and dropping. The system previews the splicing effect adjusted by the user in real time, and automatically verifies the correctness of the splicing after the user completes the adjustment. The system checks whether the splicing result is properly positioned in the document and ensures that the overall format and logic of the document are not affected. After the verification process is completed, the system automatically fixes minor errors and prompts the user for any problems that need manual correction.

[0116] This embodiment significantly improves the efficiency of splicing and replacing variable identifiers when processing complex documents by visually displaying the split variable identifiers, generating splicing suggestions, automatically combining prefixes and suffixes, and verifying them. Users can not only intuitively understand the splicing process of variable identifiers, but also preview and feedback the splicing results before document generation to ensure the accuracy and logic of the final document. The system's automatic verification and error correction functions further reduce human errors in the document generation process and improve the quality and reliability of document generation.

[0117] In one embodiment, in the above S40, if it is detected that there is a split variable identifier in a single text unit, the split variable identifier is supplemented into a complete variable identifier through a completion operation, including:

[0118] S405, recording all variable identifiers retrieved from the template document into a total identifier set, and recording the replaced complete variable identifiers into a replaced identifier set;

[0119] S406, if it is detected that a certain text unit only contains the split variable identifier, judging whether the split variable identifier has been processed through the replaced identifier;

[0120] S407, if not processed, determine other split variable identifiers or complete variable identifiers corresponding to the split variable identifier according to the variable identifiers recorded in the total identifier set, and concatenate the split variable identifier and the corresponding other split variable identifiers to obtain a complete variable identifier.

[0121] In this embodiment, during the document parsing process, the system stores all variable identifiers retrieved from the template document in a total identifier set. This set contains all detected variable identifiers, whether complete or split. Through this set, the system can track all variable identifiers that appear in the document to ensure that there are no omissions.

[0122] The system records the replaced complete variable identifiers in the replaced identifier set. This set is used to track the variable identifiers that have been processed, ensuring that each identifier is replaced only once to avoid duplicate processing or missed processing.

[0123] When the system detects that a text unit contains only split variable identifiers, the system will first query the replaced identifier set to determine whether the split part has been processed. If it has been processed, the system will skip this part; if not, the system will continue with the splicing operation.

[0124] The system determines the other split parts or complete identifiers corresponding to the current split variable identifier by consulting the total identifier set. Then, the system will splice these split parts according to the recorded location information and identifier structure to generate a complete variable identifier. This step ensures that all variable identifiers are complete and correct in the document.

[0125] In one specific embodiment, when parsing a template document, the system stores all variable identifiers in a total identifier set, regardless of whether the identifiers are complete or split. When it is detected that a text unit contains only a partial identifier, the system first queries the replaced identifier set to confirm whether the portion has been processed. If not, the system will search through the data in the total identifier set to find other partial or complete identifiers that match it. The system then splices these parts and generates a complete identifier to replace the corresponding position in the document. This embodiment is particularly suitable for the generation scenario of simple contracts or reports, where the number of identifiers is relatively small and the positions are clear.

[0126] In another specific embodiment, when processing complex financial documents, the system not only records and manages all variable identifiers, but also performs advanced splicing operations based on the semantic structure and paragraph organization of the document. When a split identifier part is detected, the system determines other possible matching parts based on the logical relationship of the document and automatically splices them. If there are multiple possible matching options during the splicing process, the system will provide the best match suggestion and allow the user to confirm the splicing result through the preview function. After processing all splicing operations, the system replaces the generated complete identifier into the document to ensure the consistency and accuracy of the document content.

[0127] In other specific embodiments, when processing complex documents with a large number of tables or cross-paragraph content, the system adopts a multi-level identifier management mechanism. All detected variable identifiers are first stored in the total identifier set and tracked through a marking and indexing mechanism. When the system detects that a text unit only contains the split identifier part, it will automatically find the corresponding other parts or complete identifiers for splicing according to the index of the total identifier set. The system will automatically verify whether the spliced ​​identifier meets the format and content requirements of the document, and provide error correction suggestions when necessary.

[0128] This embodiment records and manages all variable identifiers, and automatically splices them when split identifiers are detected, effectively solving the problem of replacement failure or document content errors caused by scattered identifiers. The system can automatically identify, splice and replace all variable identifiers in the document to ensure that the generated document content is accurate. Especially when processing complex documents, this method can significantly improve the efficiency and accuracy of document generation, reduce the workload of manual processing, and ensure that the final generated document meets the expected standards in both format and content.

[0129] In one embodiment, in the above S50, before generating the final target document, the following step is further included:

[0130] S501, the document generation request includes a custom parameter, the custom parameter includes a position insertion identifier, and the custom parameter is parsed to determine the type of content to be inserted;

[0131] S502, if the inserted content type is a table, extracting table data and table parameters from the custom parameters;

[0132] S503, parsing the table parameters to determine the number of rows and columns of the table, and generating a target table according to the number of rows and columns of the table;

[0133] S504, extracting cell data of each row and each column from the table data, and filling the cell data into the target table;

[0134] S505: insert the target table into the target document according to the position insertion identifier, and adjust the layout of the target document.

[0135] In this embodiment, the custom parameters included in the document generation request may include user-specific input or system-generated dynamic data, which determine the dynamically generated content in the document. Specifically, the custom parameters may include a position insertion identifier for identifying the position where new content is inserted in the document, and the type of content to be inserted (such as a table, picture, text, etc.).

[0136] The system parses these custom parameters to determine the type of content being inserted. For example, if the content type is a table, the system extracts the table data and table parameters and continues processing with the next steps.

[0137] If the parsing result determines that the inserted content type is a table, the system will extract relevant data and parameters from the custom parameters. Table data includes the specific content of each cell, while table parameters usually include the structure information of the table, such as the number of rows and columns.

[0138] The system generates an empty target table based on the table parameters. For example, if the table parameters specify a table with 3 rows and 4 columns, the system will first create a table template with this structure. The system will then fill the generated table with the extracted table data, and the cell data of each row and column will be filled into the corresponding cells in turn.

[0139] After the table is generated, the system will insert the target table into the specified position of the document according to the position insertion identifier. After the table is inserted, the system will automatically adjust the document layout, including paragraph alignment, text wrapping, paging, etc., to ensure that the overall layout and format of the document remain consistent.

[0140] In one specific implementation, in a financial contract generation system, when a document generation request includes custom parameters, the system parses a position insertion identifier and identifies that the type of content to be inserted is a table. The system extracts the number of rows and columns of the table from the custom parameters, and based on this generates a simple target table with 3 rows and 4 columns. The system then extracts the data of each cell from the parameters, such as the amount, date, etc., and fills these data into the target table one by one. After the table is generated, the system inserts the table into the specified paragraph of the document according to the position insertion identifier, and adjusts the surrounding paragraph format and paging to ensure that the table is consistent with the layout of other parts of the document. This implementation is suitable for processing contract or agreement documents with simple structures and relatively static data.

[0141] In another specific embodiment, when processing complex financial report generation, the system first parses the custom parameters in the document generation request and determines that multiple tables need to be inserted. The system generates tables of different sizes and structures based on the parameters of each table. The system extracts real-time financial data from the database and dynamically fills the data into the corresponding table cells. Then, the system inserts these tables in multiple locations of the document, locates and adjusts the table position based on the position insertion identifier, and ensures that the table is consistent with the logic and layout of the surrounding content. For example, the system may generate and insert a complex financial report containing multiple merged cells and dynamically generated data entries, and these tables may be distributed in different chapters of the document.

[0142] In other specific embodiments, when generating a project report involving multiple content types, the system not only inserts tables based on custom parameters, but also dynamically inserts other content types, such as pictures, charts, etc. In the document generation request, the custom parameters not only specify the structure and data of the table, but also include the location insertion identifier of the picture and the data source of the chart. Based on these parameters, the system generates and inserts multiple content elements, and automatically adjusts the overall layout of the document to ensure that the format and position of the content are consistent. The system will also adjust the document's font, paragraph style, page layout, etc. according to different content types to ensure that the generated project report is beautiful and meets business needs.

[0143] This embodiment provides great flexibility and automation in the document generation process by parsing custom parameters and generating and inserting tables based on these parameters. Users can dynamically insert structured content (such as tables) into documents by specifying the insertion position and content type, thereby greatly reducing the time and errors of manual editing. The automatic adjustment of typesetting function ensures the overall format consistency of the document, making the generated document both beautiful and professional, which is particularly suitable for contract, report and business document generation scenarios that require customized content.

[0144] In one embodiment, in the above S10, after retrieving and acquiring the corresponding template document from the database according to the template ID and version information, the process further includes:

[0145] S101, verifying the template document using a file verification algorithm;

[0146] S102, if it is determined after verification that the template document is damaged, an error log is recorded, and an alarm system is triggered to notify the user that the file is damaged;

[0147] S103, if it is determined after verification that the template document is not damaged, check the internal structure of the target file to verify whether key elements in the template document are missing;

[0148] S104: If there is a missing key element, the missing key element is repaired according to the type of the key element and the pre-repair rule, or the key element is searched from the database and corrected into the template document.

[0149] In this embodiment, after obtaining the template document, the system first uses a file verification algorithm (such as MD5 or SHA-256) to verify the integrity of the document. These algorithms generate a unique hash value for the document to check whether the document has been changed or damaged during storage or transmission. The system compares the generated hash value with the reference value stored in the database to determine whether the document has been tampered with or damaged.

[0150] If the verification result shows that the document is damaged, the system will record a detailed error log, including the damaged file name, timestamp, error type, etc. The system will then trigger an alarm system to notify the user or administrator to take further action.

[0151] If the file verification result shows that the document is not damaged, the system will further check the internal structure of the template document. This includes verifying the existence and integrity of key elements in the document, such as titles, chapters, tables, images, etc. The system uses predefined rules to ensure that these key elements exist in the document in the expected format and location.

[0152] If a key element is detected to be missing or incomplete, the system will perform repair operations according to the pre-repair rules based on the type and importance of the key element. This may include re-querying the missing element from the database and inserting it into the document, or automatically completing it according to the default structure of the template. After the repair is completed, the system will record a log of the repair operation for subsequent review.

[0153] In one specific implementation, after obtaining the template document, the system uses the MD5 file verification algorithm to verify the document. If the verification passes, the system will continue to check the internal structure of the document to verify the integrity of key elements. For example, when verifying a contract template, the system will ensure that all necessary contract terms, signature areas, and company logos are present. If missing, the system will extract the corresponding elements from the database according to the preset repair rules to supplement and ensure that the document meets the requirements in terms of law and format.

[0154] In another specific implementation, after obtaining and verifying the template document, the system will also perform a more in-depth structural verification. The system will apply specific rule sets based on the document type. For example, when processing a financial report, the system will check whether there are key financial data tables and notes. The system automatically repairs or supplements missing tables and content by querying historical templates in the database to ensure that the final generated report is complete and meets the requirements of financial audits.

[0155] In other embodiments, when processing multi-page complex documents (such as technical manuals), after verifying the file, the system further verifies key elements such as the table of contents, index, charts, and references in the document. If some parts are missing or damaged, the system will automatically repair them based on the historical version of the template and complete the necessary content through database retrieval. After the repair is completed, the system will re-verify the document to ensure that all content is inserted correctly and meets the format requirements.

[0156] This embodiment can significantly improve the reliability and stability of the document generation process by using a file verification algorithm to verify the integrity of the template document and automatically repair it when damage or missing is detected. The system can not only detect and repair errors in template documents, but also automatically complete key elements according to predefined rules to ensure that the final generated document meets the requirements in both content and format. This method is particularly suitable for scenarios that require high reliability and accuracy, such as the generation of legal contracts, financial reports and technical documents.

[0157] In one embodiment, in the above S50, after the final target document is generated, the following step is further included:

[0158] S506, creating a review document according to the target document, and screening the content replaced by the variable identifier in the review document;

[0159] S507, screening the review document for financial related information involving amounts, interest rates and fees, using regular expressions to match text containing currency symbols, percentage symbols or numbers;

[0160] S508, marking the screened and matched content in the review document, and sending the marked review document to the reviewer for review;

[0161] S509: After the review document is approved, confirm that the target document is qualified.

[0162] In this embodiment, after the final target document is generated, the system will create a review document as a copy of the target document. This copy is specifically used for review and inspection to ensure the accuracy and completeness of the document content, especially the dynamic content replaced by variable identifiers. The system automatically filters all the content replaced by variable identifiers in the review document, such as the amount, date, customer name, etc. in the contract. The screening process will mark these contents separately so that the reviewer can quickly locate and check them. The system will use regular expressions to match and filter out all key financial information in the review document, including amounts, interest rates, fees, etc. Regular expressions automatically mark these key financial data by identifying currency symbols (such as "$", "¥"), percentage symbols (such as "%") and numbers in the text. The matched financial information will be specially marked in the review document, such as highlighted in different colors, or annotations added to the edge of the document. These markings enable the reviewer to clearly identify and check these important financial contents. The marked review document will be sent to the designated reviewer for review. The reviewer will check all marked content to confirm the accuracy of these replacements and matching content. If the review is passed, the reviewer will make a confirmation mark in the document. When the review document is reviewed and passed, the system will mark the target document as qualified, indicating that the document has been fully reviewed and can be finally published or archived.

[0163] In one specific implementation, after generating the target document, the system not only creates a review document, but also automatically generates multiple versions of review copies, which are customized based on different review rules and reviewer permissions. For example, in financial reports, different reviewers may focus on different content: financial managers may be more concerned with total amounts and expense allocations, while compliance officers will check whether the report meets regulatory requirements. When generating a review document, the system automatically filters and marks variable replacement content, and generates multiple versions of review copies according to different review rules, each version of which has content annotations and comments for specific review needs. Finally, the system integrates the feedback from all reviewers to generate a qualified target document. This approach can significantly improve review efficiency and ensure comprehensive consideration of different review perspectives.

[0164] In another specific implementation, for complex multi-page contract documents, the system introduces an intelligent semantic analysis module when generating review documents. This module can identify potential semantic conflicts or logical inconsistencies in the document. For example, when the system detects that the content replaced by multiple variable identifiers is semantically conflicting (such as different interest rates mentioned in different clauses), the system will automatically generate a conflict report and mark these conflict points for reviewers to check. At the same time, the system will provide correction suggestions based on the overall structure of the document to help reviewers quickly resolve these potential problems. Finally, before generating a qualified document, the system will perform a global verification to ensure that all modified content is logically and semantically consistent.

[0165] In other specific embodiments, when generating a project report involving cross-departmental cooperation, the system will introduce a cross-departmental collaboration module when creating a review document. This module allows reviewers from different departments to collaborate in real time on the same document, and each department can see the parts related to itself and mark them. The system will automatically adjust the content in the document based on the feedback from the departments, and generate a comprehensive review report, pointing out possible content overlaps or contradictions between departments. Ultimately, the system will integrate these feedbacks to generate a target document that is unanimously recognized across departments. This collaborative review method is particularly suitable for complex project reports and cross-departmental contract documents, and can ensure the full expression of the opinions of all parties and the consistency of the document content.

[0166] This embodiment significantly improves flexibility and accuracy in the document generation and review process by introducing multi-version review, intelligent semantic analysis of copies, and cross-departmental collaboration modules. Different specific implementations can handle various complex scenarios, such as the generation of financial reports, legal contracts, and cross-departmental project reports. The system can not only automatically generate and annotate review documents, but also ensure that the final generated documents meet the expected standards in terms of content and logic through intelligent analysis and collaboration mechanisms. Such improvements greatly reduce the workload of manual review and ensure a high degree of accuracy and reliability in the document generation process.

[0167] The present invention also provides a document generation device based on variable parsing, referring to Figure 2 , Figure 2 This is a functional module diagram of a preferred embodiment of a document generation device based on variable analysis of the present invention. The document generation device based on variable analysis includes:

[0168] The template determination module receives a document generation request including a template ID, version information, and a target value, and retrieves and obtains a corresponding template document from a database according to the template ID and version information;

[0169] A text parsing module, which uses text parsing technology to extract variable identifiers from the template document, traverses each text unit of the template document, and detects whether the variable identifier exists;

[0170] A variable replacement module, if a complete variable identifier is detected in a single text unit, replaces the variable identifier with the target value;

[0171] A variable completion module, if it is detected that there is a split variable identifier in a single text unit, supplements the split variable identifier into a complete variable identifier through a completion operation, and replaces the complete variable identifier with the target value;

[0172] The document generation module updates the replaced text unit into the template document to generate a final target document.

[0173] The specific implementation of the document generation device based on variable analysis of the present invention is basically the same as the various embodiments of the document generation method based on variable analysis described above, and will not be repeated here.

[0174] The present invention also provides a document generation device based on variable parsing, such as Figure 3 As shown, the document generation device based on variable parsing may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0175] Those skilled in the art will understand that Figure 3 The hardware structure of the document generation device based on variable parsing shown in the figure does not constitute a limitation of the document generation device based on variable parsing, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0176] like Figure 3As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a document generation program based on variable parsing. The operating system is a program for managing and controlling the document generation device and software resources based on variable parsing, and supports the operation of the network communication module, the user interface module, the document generation program based on variable parsing, and other programs or software; the network communication module is used to manage and control the network interface 1004; and the user interface module is used to manage and control the user interface 1003.

[0177] exist Figure 3 In the hardware structure of the document generation device based on variable parsing shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client and communicate data with the client; the processor 1001 can call the document generation program based on variable parsing stored in the memory 1005, and perform the same operations as the document generation method based on variable parsing.

[0178] The specific implementation of the document generation device based on variable parsing of the present invention is basically the same as the various embodiments of the document generation method based on variable parsing described above, and will not be repeated here.

[0179] In addition, an embodiment of the present invention further proposes a computer storage medium, on which a document generation program based on variable parsing is stored. When the document generation program based on variable parsing is executed by a processor, the steps of the document generation method based on variable parsing as described above are implemented.

[0180] The specific implementation of the computer storage medium of the present invention is basically the same as the various embodiments of the document generation method based on variable parsing described above, and will not be repeated here.

Claims

1. A document generation method based on variable parsing, characterized in that: The following steps are involved: Receive a document generation request, the document generation request including a template ID, version information and a target value, and retrieve and obtain a corresponding template document from a database according to the template ID and version information; Extract variable identifiers from the template document using text parsing technology, traverse each text unit of the template document, and detect whether the variable identifier exists; If a complete variable identifier is detected in a single text unit, the variable identifier is replaced with the target value; If it is detected that there is a split variable identifier in a single text unit, the split variable identifier is supplemented into a complete variable identifier through a completion operation, and the complete variable identifier is replaced with the target value; The replaced text unit is updated into the template document to generate a final target document.

2. The document generation method based on variable parsing according to claim 1, characterized in that: If a split variable identifier is detected in a single text unit, the split variable identifier is completed into a complete variable identifier through the completion operation, including: Traversing each text unit in the template document one by one, identifying the text unit containing the variable identifier; Detect and record the positions of the split variable identifiers, including the index of the text unit, the paragraph position and the character position; Determine the prefix and suffix of the split variable identifier in the text unit, and based on the structure of the variable identifier, character matching rules and the positional relationship of adjacent text units, screen out the split variable identifiers whose prefix and suffix belong to the same complete variable identifier; The split variable identifiers where the prefix and suffix are located are merged to generate the complete variable identifier.

3. The document generation method based on variable parsing as claimed in claim 2, characterized in that: The split variable identifiers where the prefix and suffix are located are merged to generate the complete variable identifier, including: In the visual interface, the split variable identifiers are displayed as independent identifiers, and multiple splicing suggestions are provided based on the structure of the variable identifiers and the positional relationship of the text units; Automatically combine prefixes and suffixes to form complete variable identifiers based on generated concatenation suggestions; During the splicing process, the generated complete variable mark will be automatically previewed to show the actual effect in the template document for users to correct or provide feedback; After the splicing is completed, verification is automatically performed to check whether the spliced ​​complete variable identifier conforms to the preset format and the semantic logic of the template document. If there is an error, the exception is marked and correction suggestions are made.

4. The document generation method based on variable parsing as claimed in claim 1, characterized in that: If a split variable identifier is detected in a single text unit, the split variable identifier is supplemented into a complete variable identifier through completion operation, including: Recording all variable identifiers retrieved from the template document into a total identifier set, and recording replaced complete variable identifiers into a replaced identifier set; If it is detected that a certain text unit only contains the split variable identifier, judging whether the split variable identifier has been processed by the replaced identifier; If it has not been processed, determine other split variable identifiers or complete variable identifiers corresponding to the split variable identifier according to the variable identifiers recorded in the total identifier set, and concatenate the split variable identifier and the corresponding other split variable identifiers to obtain a complete variable identifier.

5. The document generation method based on variable parsing according to claim 1, characterized in that: Before generating the final target document, it also includes: The document generation request includes a custom parameter, the custom parameter includes a position insertion identifier, and the custom parameter is parsed to determine the type of content to be inserted; If the inserted content type is a table, extract the table data and table parameters from the custom parameters; Parsing the table parameters to determine the number of rows and columns of the table, and generating a target table according to the number of rows and columns of the table; Extracting cell data of each row and each column from the table data, and filling the cell data into the target table; The target table is inserted into the target document according to the position insertion identifier, and the layout of the target document is adjusted.

6. The document generation method based on variable parsing according to claim 1, characterized in that: After retrieving and acquiring the corresponding template document from the database according to the template ID and version information, the method further includes: Verify the template document using a file verification algorithm; If it is determined after verification that the template document is damaged, an error log is recorded and an alarm system is triggered to notify the user that the file is damaged; If it is determined after verification that the template document is not damaged, checking the internal structure of the target file to verify whether key elements in the template document are missing; If there is a missing key element, the missing key element is repaired according to the type of the key element and the pre-repair rule, or the key element is queried from the database and corrected into the template document.

7. The document generation method based on variable parsing according to claim 1, characterized in that: After generating the final target document, it also includes: Creating a review document according to the target document, and screening the content replaced by the variable identifier in the review document; Filtering the review documents for financial related information involving amounts, interest rates, and fees, using regular expressions to match text containing currency symbols, percentage symbols, or numbers; Annotating the screened and matched content in the review document, and sending the annotated review document to the reviewer for review; When the review document is approved, the target document is confirmed to be qualified.

8. A document generation device based on variable parsing, characterized in that: The document generation device based on variable parsing includes: The template determination module receives a document generation request including a template ID, version information, and a target value, and retrieves and obtains a corresponding template document from a database according to the template ID and version information; A text parsing module, which uses text parsing technology to extract variable identifiers from the template document, traverses each text unit of the template document, and detects whether the variable identifier exists; A variable replacement module, if a complete variable identifier is detected in a single text unit, replaces the variable identifier with the target value; A variable completion module, if it is detected that there is a split variable identifier in a single text unit, supplements the split variable identifier into a complete variable identifier through a completion operation, and replaces the complete variable identifier with the target value; The document generation module updates the replaced text unit into the template document to generate a final target document.

9. A document generation device based on variable parsing, characterized in that: The document generation device based on variable parsing includes a memory, a processor, and a document generation program based on variable parsing stored in the memory and executable on the processor. When the document generation program based on variable parsing is executed by the processor, the steps of the document generation method based on variable parsing as described in any one of claims 1 to 7 are implemented.

10. A computer storage medium, characterized in that: The storage medium stores a document generation program based on variable parsing, and when the document generation program based on variable parsing is executed by a processor, the steps of the document generation method based on variable parsing as described in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Generative large model-based literature reference content extraction method

    CN120046583A

  • Data model table generation method and system based on Excel analysis

    CN120975059A

  • Document asset generation method and device based on variable entries and medium

    CN121301353A