Function calculation mechanism for document generation

By combining the JavaScript engine and the POI-TL template engine, dynamic document generation is achieved, and the problems of insufficient flexibility, limited intelligence level, complex user interaction and high maintenance costs in the existing document generation technology are solved, and the efficiency, flexibility and accuracy of document generation are improved.

CN119849465APending Publication Date: 2025-04-18SHENZHEN HAIGUI NETWORK TECH CO LTD

Patent Information

Application Number
CN202411910545.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The existing document generation technology has problems such as insufficient flexibility, limited intelligence, complex user interaction and high maintenance costs.

Method used

The JavaScript engine and the POI-TL template engine are adopted to realize the generation of dynamic content and the automated processing of documents by defining templates, data input, function calculation processing and document generation.

Benefits of technology

It significantly improves the efficiency and flexibility of document generation, enhances the accuracy and user experience of document generation, and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119849465A_ABST
    Figure CN119849465A_ABST
Patent Text Reader

Abstract

The invention discloses a function calculation mechanism for document generation, which belongs to the technical field of complex logic content generation and comprises the following steps of: introducing a JavaScript engine: utilizing the JavaScript engine as a core processing unit for function calculation, providing strong script execution capability and wide library support by the JavaScript engine, and generating a function by using the JavaScript engine; various complex logic calculation and data processing can be efficiently executed; a Word template engine is used, a POI-TL is used as a template engine for document generation, the POI-TL is based on an Apache POI library, and a Word document can be conveniently read and written in; according to the method, efficient calculation is carried out, namely, the JavaScript engine can quickly execute complex logical operation and data processing, so that the document generation time is shortened, for example, all calculation and document generation tasks can be completed within several seconds when a contract containing complex calculation and logical judgment is generated; and automatic processing: high automation is realized in the whole process from data input to document generation, manual intervention is reduced, and the overall working efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of complex logic content generation, and in particular relates to a function calculation mechanism for document generation. Background Art

[0002] Currently, document generation technologies in the market are mostly based on template filling and rule engines. These systems usually include a large template library, and users need to manually select or define templates, and then fill in the necessary information. The system then fills the data into the template according to the preset rules to form the final document. In addition, some advanced systems try to apply natural language processing technology to understand user input and automatically generate text paragraphs, but these systems are often limited in their ability to understand context and adapt to personalized needs;

[0003] Disadvantages of existing technology:

[0004] Lack of flexibility: Existing template-based methods are difficult to adapt to complex and changing document requirements, especially when the content of the document needs to be highly customized.

[0005] Limited intelligence: Even systems that use natural language processing technology often lack knowledge in specific fields, resulting in insufficient accuracy and professionalism in the generated documents.

[0006] Complex user interaction: Users need to spend a lot of time learning how to use the system and configure templates, which reduces overall efficiency.

[0007] High maintenance costs: As regulations change and business requirements are updated, the maintenance of templates and rule bases becomes a heavy task.

[0008] Based on this, the present invention designs a function calculation mechanism for document generation to solve the above problems. Summary of the invention

[0009] The purpose of the present invention is to propose a function calculation mechanism for document generation in order to solve the problems of insufficient flexibility, limited intelligence level, complex user interaction and maintenance cost in the existing function calculation mechanism for document generation.

[0010] In order to achieve the above object, the present invention adopts the following technical solutions:

[0011] A function calculation mechanism for document generation, comprising the following steps:

[0012] 1. Introduce JavaScript engine:

[0013] Using the JavaScript engine as the core processing unit of function computing, the JavaScript engine provides powerful script execution capabilities and extensive library support, and can efficiently execute various complex logical calculations and data processing;

[0014] 2. Use Word template engine:

[0015] POI-TL is used as the template engine for document generation. POI-TL is based on the Apache POI library and can easily read and write Word documents to achieve dynamic content replacement and generation.

[0016] 3. Define the template:

[0017] Define a Word document template in POI-TL. The template contains placeholders to mark the content that needs to be dynamically generated.

[0018] 4. Data input:

[0019] The user inputs the required data through the front-end interface. The data can be in various formats such as text, tables, and pictures. The front-end interface communicates with the back-end server through the API and passes the data to the function computing module.

[0020] 5. Function calculation processing:

[0021] The function calculation module calls the JavaScript engine to process and calculate data using the input data and predefined logic rules. The processed data is used as dynamic content and filled into the corresponding placeholder position in the Word template.

[0022] 6. Generate documents:

[0023] Call the POI-TL engine to combine the processed data with the Word template to generate the final Word document. The generated document can be saved as a file for users to download or further edit;

[0024] 7. Document verification:

[0025] Verify the generated document content, including data consistency check, logic verification and grammar check, to ensure the accuracy and correctness of the document content;

[0026] 8. Result output:

[0027] The final generated Word document can be displayed to users through the front-end interface, and users can choose to download it or view and edit it directly in the system.

[0028] As a further description of the above technical solution: the definition template includes:

[0029] 3.1. Use Spring expressions provided by POI-TL:

[0030] In POI-TL, Spring Expression Language (SpEL) is used to process complex logical operations. Spring expressions can be combined with placeholders in the template to generate the final document content based on dynamic input data;

[0031] Define a Word template in POI-TL and use placeholders and Spring expressions in the template; for example:

[0032]

[0033] 3.2. Processing JavaScript code:

[0034] In the template, the static class method evaluateJsCode is used to parse and execute JavaScript code. JavaScript code can be calculated based on input data, and the result is replaced in the template as dynamic content.

[0035] Example JavaScript snippet:

[0036]

[0037] 3.3. Parsing JavaScript engine using static class methods:

[0038] In the process of parsing the Word template, the static class method is used to parse and execute the JavaScript code. Through the extension mechanism of POI-TL, the JavaScript code is embedded in the template, and the placeholder part is dynamically calculated by the JavaScript code.

[0039] Example JavaScript snippet:

[0040]

[0041] As a further description of the above technical solution: the template can be various types of documents, such as contracts, reports, and invoices.

[0042] As a further description of the above technical solution: the document verification specifically includes the following steps:

[0043] Data consistency verification formula:

[0044] For dynamically generated fields, the hash function H(x) is used to perform consistency verification to ensure that the generated document content has not been tampered with;

[0045] H(x)=hash(x1+x2+...+x n );

[0046] Among them, x i is each dynamic field in the document, H(x) is the generated hash value, and the H(x) values ​​before and after generation are compared to see if they are consistent during verification;

[0047] Logical verification formula:

[0048] Perform logical checks on the amount fields in contract documents, for example:

[0049]

[0050] Verify whether the formula calculation result is consistent with the dynamically generated total amount field;

[0051] Grammar and format check:

[0052] Use Natural Language Processing (NLP) technology to verify grammar and format in documents; for example:

[0053] Spell check: Run a spelling check algorithm on each word;

[0054] Syntax checking: Generate a syntax tree and determine whether the syntax structure is correct.

[0055] As a further description of the above technical solution: the static class method parsing process specifically includes:

[0056] Receiving JavaScript code:

[0057] Users pass JavaScript code by defining placeholders in the template, such as formulas such as "quantity × unit price" or "weighted average calculation";

[0058] The JavaScript code snippet contained in the placeholder is received as an input parameter by the static class method;

[0059] Initialize the logic engine:

[0060] The static class method calls the internal JavaScript engine as the core tool for parsing and execution;

[0061] The engine is responsible for parsing the input JavaScript code into calculation logic and binding it with dynamic data;

[0062] Injecting dynamic data:

[0063] Before parsing the JavaScript code, the system will inject the dynamic data entered by the user into the logic engine as the context for code execution;

[0064] Execution code logic:

[0065] The JavaScript code parsed by the engine is executed according to the input data to complete operations such as total price calculation and logical judgment;

[0066] Returns the calculation result:

[0067] After execution is completed, the static class method returns the calculation result to the template engine;

[0068] The template engine replaces the placeholders with the results to generate the final document content.

[0069] As a further description of the above technical solution: the data processing and calculation using the input data and predefined logical rules specifically include:

[0070] (1) Data parsing and rule adaptation: Parsing input data into a structured format that the system can process and determining applicable logical rules;

[0071] Data analysis:

[0072] The received user input data may include different formats such as text, numbers, tables, etc.

[0073] The system parses this data into a unified structured format through preprocessing;

[0074] Rule adaptation:

[0075] The system automatically matches the logical rules in the predefined rule base according to the document type;

[0076] Logical dynamic expansion:

[0077] Support dynamic loading or updating of logic rules according to specific scenarios;

[0078] (2) Binding data to logic rules: Mapping input data to variables of predefined logic rules to ensure that the rules can be executed normally;

[0079] Mapping logic:

[0080] The system binds user input data with logical rules through the rule engine;

[0081] Dynamic inspection:

[0082] The system verifies the mapping results to ensure that all required fields have corresponding data;

[0083] Prompt for missing fields or complete them with default values;

[0084] (3) Dynamic logic calculation: Based on the bound data, the function calculation module in the system is used to complete dynamic logic processing;

[0085] Core processing module:

[0086] The system introduces the JavaScript engine as the core logic processing unit;

[0087] Use dynamic scripts to execute rule logic, supporting complex calculations and dynamic adjustments;

[0088] Execution of logic rules:

[0089] The rule execution process usually includes the following common scenarios:

[0090] Automatically generate paragraph content for documents;

[0091] Dynamic processing calculations;

[0092] Error detection:

[0093] When executing rule logic, the system detects in real time whether there are logical conflicts or calculation errors;

[0094] Provide correction suggestions for unreasonable input values ​​or logical errors;

[0095] (4) Dynamic result generation: The intermediate results are output through the calculation module, and these results will be filled into the document template;

[0096] Intermediate result generation:

[0097] Generate intermediate content that meets the needs of the document based on the output of logical rules;

[0098] Hierarchical structuring of results:

[0099] The system divides the results into multiple levels to facilitate subsequent document content filling;

[0100] (5) Dynamic content optimization: Optimize the semantics and format of the generated intermediate results to ensure that they are suitable for filling into the document template;

[0101] Semantic optimization:

[0102] Conduct semantic analysis on calculation results and adjust wording to suit the document language style;

[0103] Format optimization:

[0104] Adapt the format of results to the instrument type;

[0105] (6) Integration with templates: Mapping dynamic processing results to placeholder positions in predefined document templates;

[0106] Placeholder identification:

[0107] The system recognizes the placeholders in the template and makes a one-to-one correspondence with the intermediate results;

[0108] Dynamic Fill:

[0109] Automatically replace placeholders with processing results and adjust the template's statement structure based on the context;

[0110] Inspection and verification:

[0111] The system automatically checks the filled template content to ensure that all placeholders have been replaced and the document content is complete and correct.

[0112] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:

[0113] 1. In the present invention, the efficiency of document generation is significantly improved:

[0114] Efficient calculation: JavaScript engine can quickly perform complex logical operations and data processing, shortening the time of document generation. For example, to generate a contract containing complex calculations and logical judgments, all calculations and document generation tasks can be completed in a few seconds. Automated processing: The entire process from data input to document generation is highly automated, reducing manual intervention and improving overall work efficiency.

[0115] Enhanced flexibility in document generation:

[0116] Dynamic content generation: Through Spring expressions and JavaScript code, content can be dynamically generated based on input data. For example, based on the contract terms and details entered by the user, the system can automatically generate the corresponding contract content to meet the needs of different business scenarios; Flexible template definition: The POI-TL template engine supports a variety of placeholders and dynamic content tags, making template definition very flexible and suitable for various types of document generation needs;

[0117] Improve the accuracy of document generation:

[0118] Accurate code parsing: JavaScript code is parsed through static class methods to ensure the accuracy and consistency of code execution, and the generated document content is reliable and correct. For example, during the contract generation process, the system will accurately calculate the contract amount and terms based on the parameters entered by the user to avoid errors that may be caused by manual calculations; Data verification: During the data input and processing stage, data verification and validation are performed through JavaScript code to avoid document generation problems caused by erroneous data;

[0119] Improve user experience and usability:

[0120] Friendly interface: Users input data through an intuitive front-end interface, and the system automatically handles complex calculations and document generation. The operation is simple and intuitive. For example, users can input company name, contract date and contract terms through the interface, and the system automatically generates a complete contract document. Instant feedback: The generated documents can be displayed to users immediately, and users can directly view, download or further edit them, which improves the convenience and flexibility of operation.

[0121] Scalability and maintainability:

[0122] Modular design: The system adopts a modular design. The JavaScript engine, POI-TL template engine and Spring expression are independent and work together to facilitate system maintenance and expansion. For example, developers can add new templates or extend JavaScript functions as needed without affecting the overall architecture of the system. Easy to integrate: The solution can be easily integrated into existing office automation systems to interact with other systems and services for data and functional collaboration. BRIEF DESCRIPTION OF THE DRAWINGS

[0123] Figure 1 A schematic diagram of the steps of a function calculation mechanism for document generation proposed by the present invention;

[0124] Figure 2 A schematic diagram of document inspection for a function calculation mechanism for document generation proposed by the present invention. DETAILED DESCRIPTION

[0125] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0126] Please see attached Figure 1 -Attached Figure 2 The present invention provides a technical solution: a function calculation mechanism for document generation, comprising the following steps:

[0127] 1. Introduce JavaScript engine:

[0128] Using the JavaScript engine as the core processing unit of function computing, the JavaScript engine provides powerful script execution capabilities and extensive library support, and can efficiently execute various complex logical calculations and data processing;

[0129] 2. Use Word template engine:

[0130] POI-TL is used as the template engine for document generation. POI-TL is based on the Apache POI library and can easily read and write Word documents to achieve dynamic content replacement and generation.

[0131] 3. Define the template:

[0132] Define a Word document template in POI-TL. The template contains placeholders to mark the content that needs to be dynamically generated.

[0133] 4. Data input:

[0134] The user inputs the required data through the front-end interface. The data can be in various formats such as text, tables, and pictures. The front-end interface communicates with the back-end server through the API and passes the data to the function computing module.

[0135] 5. Function calculation processing:

[0136] The function calculation module calls the JavaScript engine to process and calculate data using the input data and predefined logic rules. The processed data is used as dynamic content and filled into the corresponding placeholder position in the Word template.

[0137] 6. Generate documents:

[0138] Call the POI-TL engine to combine the processed data with the Word template to generate the final Word document. The generated document can be saved as a file for users to download or further edit;

[0139] 7. Document verification:

[0140] Verify the generated document content, including data consistency check, logic verification and grammar check, to ensure the accuracy and correctness of the document content;

[0141] 8. Result output:

[0142] The final generated Word document can be displayed to users through the front-end interface, and users can choose to download it or view and edit it directly in the system.

[0143] The template definition includes:

[0144] 3.1. Use Spring expressions provided by POI-TL:

[0145] In POI-TL, Spring Expression Language (SpEL) is used to process complex logical operations. Spring expressions can be combined with placeholders in the template to generate the final document content based on dynamic input data;

[0146] Define a Word template in POI-TL and use placeholders and Spring expressions in the template; for example:

[0147]

[0148] 3.2. Processing JavaScript code:

[0149] In the template, the static class method evaluateJsCode is used to parse and execute JavaScript code. JavaScript code can be calculated based on input data, and the result is replaced in the template as dynamic content.

[0150] Example JavaScript snippet:

[0151]

[0152] 3.3. Parsing JavaScript engine using static class methods:

[0153] In the process of parsing the Word template, the static class method is used to parse and execute the JavaScript code. Through the extension mechanism of POI-TL, the JavaScript code is embedded in the template, and the placeholder part is dynamically calculated by the JavaScript code.

[0154] Example JavaScript snippet:

[0155]

[0156] Templates can be various types of documents, such as contracts, reports, invoices.

[0157] The document verification process includes the following steps:

[0158] Data consistency check formula:

[0159] For dynamically generated fields, the hash function H(x) is used to perform consistency verification to ensure that the generated document content has not been tampered with;

[0160] H(x)=hash(x1+x2+...+x n );

[0161] Among them, x i is each dynamic field in the document, H(x) is the generated hash value, and the H(x) values ​​before and after generation are compared to see if they are consistent during verification;

[0162] Logical verification formula:

[0163] Perform logical checks on the amount fields in contract documents, for example:

[0164]

[0165] Verify whether the formula calculation result is consistent with the dynamically generated total amount field;

[0166] Grammar and format check:

[0167] Use Natural Language Processing (NLP) technology to verify grammar and format in documents; for example:

[0168] Spell check: Run a spelling check algorithm on each word;

[0169] Syntax checking: Generate a syntax tree and determine whether the syntax structure is correct.

[0170] The static class method parsing process specifically includes:

[0171] Receiving JavaScript code:

[0172] Users pass JavaScript code by defining placeholders in the template, such as formulas such as "quantity × unit price" or "weighted average calculation";

[0173] The JavaScript code snippet contained in the placeholder is received as an input parameter by the static class method;

[0174] Initialize the logic engine:

[0175] Static class methods call the internal JavaScript engine as the core tool for parsing and execution;

[0176] The engine is responsible for parsing the input JavaScript code into calculation logic and binding it with dynamic data;

[0177] Injecting dynamic data:

[0178] Before parsing the JavaScript code, the system will inject the dynamic data entered by the user into the logic engine as the context for code execution;

[0179] Execution code logic:

[0180] The JavaScript code parsed by the engine is executed according to the input data to complete operations such as total price calculation and logical judgment;

[0181] Returns the calculation result:

[0182] After execution is completed, the static class method returns the calculation result to the template engine;

[0183] The template engine replaces the placeholders with the results to generate the final document content.

[0184] Use input data and predefined logic rules to perform data processing and calculations, including:

[0185] (1) Data parsing and rule adaptation: Parsing input data into a structured format that the system can process and determining applicable logical rules;

[0186] Data analysis:

[0187] The received user input data may include different formats such as text, numbers, tables, etc.

[0188] The system parses this data into a unified structured format through preprocessing;

[0189] Rule adaptation:

[0190] The system automatically matches the logical rules in the predefined rule base according to the document type;

[0191] Logical dynamic expansion:

[0192] Support dynamic loading or updating of logic rules according to specific scenarios;

[0193] (2) Binding data to logic rules: Mapping input data to variables of predefined logic rules to ensure that the rules can be executed normally;

[0194] Mapping logic:

[0195] The system binds user input data with logical rules through the rule engine;

[0196] Dynamic inspection:

[0197] The system verifies the mapping results to ensure that all required fields have corresponding data;

[0198] Prompt for missing fields or complete them with default values;

[0199] (3) Dynamic logic calculation: Based on the bound data, the function calculation module in the system is used to complete dynamic logic processing;

[0200] Core processing module:

[0201] The system introduces the JavaScript engine as the core logic processing unit;

[0202] Use dynamic scripts to execute rule logic, supporting complex calculations and dynamic adjustments;

[0203] Execution of logic rules:

[0204] The rule execution process usually includes the following common scenarios:

[0205] Automatically generate paragraph content for documents;

[0206] Dynamic processing calculations;

[0207] Error detection:

[0208] When executing rule logic, the system detects in real time whether there are logical conflicts or calculation errors;

[0209] Provide correction suggestions for unreasonable input values ​​or logical errors;

[0210] (4) Dynamic result generation: The intermediate results are output through the calculation module, and these results will be filled into the document template;

[0211] Intermediate result generation:

[0212] Generate intermediate content that meets the needs of the document based on the output of logical rules;

[0213] Hierarchical structuring of results:

[0214] The system divides the results into multiple levels to facilitate subsequent document content filling;

[0215] (5) Dynamic content optimization: Optimize the semantics and format of the generated intermediate results to ensure that they are suitable for filling into the document template;

[0216] Semantic optimization:

[0217] Conduct semantic analysis on calculation results and adjust wording to suit the document language style;

[0218] Format optimization:

[0219] Adapt the format of results to the instrument type;

[0220] (6) Integration with templates: Mapping dynamic processing results to placeholder positions in predefined document templates;

[0221] Placeholder identification:

[0222] The system recognizes the placeholders in the template and makes a one-to-one correspondence with the intermediate results;

[0223] Dynamic Fill:

[0224] Automatically replace placeholders with processing results and adjust the template's statement structure based on the context;

[0225] Inspection and verification:

[0226] The system automatically checks the filled template content to ensure that all placeholders have been replaced and the document content is complete and correct.

[0227] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A function calculation mechanism for document generation, characterized in that: The following steps are involved:

1. Introduce JavaScript engine: Using the JavaScript engine as the core processing unit of function computing, the JavaScript engine provides powerful script execution capabilities and extensive library support, and can efficiently execute various complex logical calculations and data processing; 2. Use Word template engine: POI-TL is used as the template engine for document generation. POI-TL is based on the Apache POI library and can easily read and write Word documents to achieve dynamic content replacement and generation.

3. Define the template: Define a Word document template in POI-TL. The template contains placeholders to mark the content that needs to be dynamically generated.

4. Data input: The user inputs the required data through the front-end interface. The data can be in various formats such as text, tables, and pictures. The front-end interface communicates with the back-end server through the API and passes the data to the function computing module.

5. Function calculation processing: The function calculation module calls the JavaScript engine to process and calculate data using the input data and predefined logic rules. The processed data is used as dynamic content and filled into the corresponding placeholder position in the Word template.

6. Generate documents: Call the POI-TL engine to combine the processed data with the Word template to generate the final Word document. The generated document can be saved as a file for users to download or further edit; 7. Document verification: Verify the generated document content, including data consistency check, logic verification and grammar check, to ensure the accuracy and correctness of the document content; 8. Result output: The final generated Word document can be displayed to users through the front-end interface, and users can choose to download it or view and edit it directly in the system.

2. A function calculation mechanism for document generation according to claim 1, characterized in that: The definition template includes: 3.

1. Use Spring expressions provided by POI-TL: In POI-TL, Spring Expression Language (SpEL) is used to process complex logical operations. Spring expressions can be combined with placeholders in the template to generate the final document content based on dynamic input data; Define a Word template in POI-TL and use placeholders and Spring expressions in the template; for example: 3.

2. Processing JavaScript code: In the template, the static class method evaluateJsCode is used to parse and execute JavaScript code. JavaScript code can be calculated based on input data, and the result is replaced in the template as dynamic content. Example JavaScript snippet: 3.

3. Parsing JavaScript engine using static class methods: In the process of parsing the Word template, the static class method is used to parse and execute the JavaScript code. Through the extension mechanism of POI-TL, the JavaScript code is embedded in the template, and the placeholder part is dynamically calculated by the JavaScript code. Example JavaScript snippet:

3. The function calculation mechanism for document generation according to claim 1, characterized in that: The template may be various types of documents, such as contracts, reports, and invoices.

4. The function calculation mechanism for document generation according to claim 1, characterized in that: The document verification specifically includes the following steps: Data consistency verification formula: For dynamically generated fields, the hash function H(x) is used to perform consistency verification to ensure that the generated document content has not been tampered with; H(x)=hash(x1+x2+...+x n ); Among them, x i is each dynamic field in the document, H(x) is the generated hash value, and the H(x) values ​​before and after generation are compared to see if they are consistent during verification; Logical verification formula: Perform logical checks on the amount fields in contract documents, for example: Verify whether the formula calculation result is consistent with the dynamically generated total amount field; Grammar and format check: Use Natural Language Processing (NLP) technology to verify grammar and format in documents.

5. The function calculation mechanism for document generation according to claim 1, characterized in that: The static class method parsing process specifically includes: Receiving JavaScript code: Users pass JavaScript code by defining placeholders in the template, such as formulas such as "quantity × unit price" or "weighted average calculation"; The JavaScript code snippet contained in the placeholder is received as an input parameter by the static class method; Initialize the logic engine: The static class method calls the internal JavaScript engine as the core tool for parsing and execution; The engine is responsible for parsing the input JavaScript code into calculation logic and binding it with dynamic data; Injecting dynamic data: Before parsing the JavaScript code, the system will inject the dynamic data entered by the user into the logic engine as the context for code execution; Execution code logic: The JavaScript code parsed by the engine is executed according to the input data to complete operations such as total price calculation and logical judgment; Returns the calculation result: After execution is completed, the static class method returns the calculation result to the template engine; The template engine replaces the placeholders with the results to generate the final document content.

6. The function calculation mechanism for document generation according to claim 1, characterized in that: The data processing and calculation using the input data and predefined logical rules specifically include: (1) Data parsing and rule adaptation: Parsing input data into a structured format that the system can process and determining applicable logical rules; Data analysis: The received user input data may include different formats such as text, numbers, tables, etc. The system parses this data into a unified structured format through preprocessing; Rule adaptation: The system automatically matches the logical rules in the predefined rule base according to the document type; Logical dynamic expansion: Support dynamic loading or updating of logic rules according to specific scenarios; (2) Binding data to logic rules: Mapping input data to variables of predefined logic rules to ensure that the rules can be executed normally; Mapping logic: The system binds user input data with logical rules through the rule engine; Dynamic inspection: The system verifies the mapping results to ensure that all required fields have corresponding data; Prompt for missing fields or complete them with default values; (3) Dynamic logic calculation: Based on the bound data, the function calculation module in the system is used to complete dynamic logic processing; Core processing module: The system introduces the JavaScript engine as the core logic processing unit; Use dynamic scripts to execute rule logic, supporting complex calculations and dynamic adjustments; Execution of logic rules: The rule execution process usually includes the following common scenarios: Automatically generate paragraph content for documents; Dynamic processing calculations; Error detection: When executing rule logic, the system detects in real time whether there are logical conflicts or calculation errors; Provide correction suggestions for unreasonable input values ​​or logical errors; (4) Dynamic result generation: The intermediate results are output through the calculation module, and these results will be filled into the document template; Intermediate result generation: Generate intermediate content that meets the needs of the document based on the output of logical rules; Hierarchical structuring of results: The system divides the results into multiple levels to facilitate subsequent document content filling; (5) Dynamic content optimization: Optimize the semantics and format of the generated intermediate results to ensure that they are suitable for filling into the document template; Semantic optimization: Conduct semantic analysis on calculation results and adjust wording to suit the document language style; Format optimization: Adapt the format of results to the instrument type; (6) Integration with templates: Mapping dynamic processing results to placeholder positions in predefined document templates; Placeholder identification: The system recognizes the placeholders in the template and makes a one-to-one correspondence with the intermediate results; Dynamic Fill: Automatically replace placeholders with processing results and adjust the template's statement structure based on the context; Inspection and verification: The system automatically checks the filled template content to ensure that all placeholders have been replaced and the document content is complete and correct.

Citation Information

Patent Citations

  • Extensible Word report automatically-generating method based on dynamic web page

    CN101976235A

  • Data exporting method and system, computer equipment and readable storage medium

    CN114154474A

  • Method and system for automatically generating judicial complex document, electronic equipment and storage medium

    CN115935940A

  • Document generation method and device and computer readable storage medium

    CN118261753A

Cited By

  • Interrupt system integrated automation tool

    CN120805878A