Business rule automatic processing method and system based on natural language understanding
By using a BERT-based metadata extraction model and interactive question-and-answer mechanism, structured metadata is automatically extracted from business rule documents, and visual flowcharts and test cases are automatically generated. This solves the problems of low efficiency and large error in business rule conversion in existing technologies, and enables business personnel to define and maintain rules automatically without programming.
Patent Information
- Application Number
- CN202511157070.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-19
- Publication Date
- 2025-11-14
AI Technical Summary
In existing enterprise information management, the conversion of business rules from natural language descriptions to computer-executable forms requires a large amount of manual intervention. This conversion process is time-consuming, costly, and prone to errors. Furthermore, business personnel cannot directly participate, resulting in a gap between technical implementation and business requirements.
It adopts a BERT-based metadata extraction model to automatically extract structured metadata, combines an interactive question-and-answer mechanism to confirm and improve rules, automatically generates rule execution flowcharts and test cases, and converts rules into various symbolic representations, supporting formats such as Drools DSL and program code.
It lowers the technical barrier, enabling business personnel to define rules without programming, improving conversion efficiency, reducing misunderstandings, shortening rule definition time, enhancing rule quality and system flexibility, and reducing error rates.
Smart Images

Figure CN120951940A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of natural language processing, machine learning, and rule engine technology. Specifically, it relates to a method and system for automated processing of business rules based on natural language understanding, and also to a corresponding computer terminal and computer-readable storage medium. Background Technology
[0002] In enterprise information management, there are numerous complex business rules in areas such as financial reimbursement, financial statement analysis, risk control, and compliance auditing. These rules are usually in the form of natural language in policy documents, management systems, and operation manuals, and need to be converted into a computer-executable form to achieve automated processing.
[0003] Existing technologies primarily handle business rules in the following ways:
[0004] 1. Hard-coding method: Developers directly write business rules as program code and embed them into the business system. This method has the following disadvantages: rule modifications require source code modification and redeployment; rule logic is coupled with business code, making maintenance difficult.
[0005] 2. Rule Engine Approach: This approach uses rule engines such as Drools and Jess. Rules are defined using a Domain-Specific Language (DSL). This approach typically has the following technical problems: it requires professionals to manually convert natural language rules into a DSL, which has a high learning curve, is difficult for business personnel to master, and can easily lead to misunderstandings during the conversion process.
[0006] 3. Configuration file method: Define rule parameters through configuration files such as XML and JSON. This method is usually robust but has the following limitations: it can only handle simple parameterized rules, cannot express complex business logic, and still requires technical personnel to participate in the configuration.
[0007] In summary, existing technologies share the following common drawbacks: the conversion of business rules from natural language descriptions to executable forms requires extensive manual intervention, resulting in long conversion cycles, high costs, and a high risk of errors. Furthermore, business personnel cannot directly participate in the technical implementation, leading to a gap between business requirements and technical implementation.
[0008] With the development of large language model technology, natural language understanding capabilities have been significantly improved, providing a new technical approach to solving the aforementioned problems. However, how to apply large language models to the automated processing of business rules in enterprise information management remains a problem that urgently needs to be solved in this field. Currently, no descriptions or reports of technologies similar to this invention have been found, and no similar materials from domestic or international sources have been collected. Summary of the Invention
[0009] To address the aforementioned shortcomings in the prior art, this invention provides a method and system for automated processing of business rules based on natural language understanding, and also relates to a corresponding computer terminal and computer-readable storage medium.
[0010] According to one aspect of the present invention, a method for automating business rule processing based on natural language understanding is provided, comprising:
[0011] Extract the text content from the original document containing business rules and perform preprocessing;
[0012] Using a BERT-based metadata extraction model, structured metadata is extracted from preprocessed text content; the structured metadata includes: rule type, triggering condition, judgment logic, and threshold parameter;
[0013] The structured metadata was verified and improved.
[0014] Based on the confirmed metadata, the rule execution flowchart and / or test cases are automatically generated to verify the correctness of the rule logic;
[0015] Based on the target format, the validated rules are converted into corresponding symbolic representations using a template engine to obtain the defined rules.
[0016] Preferably, the step of extracting structured metadata from preprocessed text content using a BERT-based metadata extraction model includes:
[0017] Construct a training data set of business rule documents and structured metadata;
[0018] A multi-task learning head is added to the BERT-base model, and the initial model is trained multiple times using the training data set. At the same time, the rule classification and sequence labeling tasks are optimized to obtain a BERT-based metadata extraction model.
[0019] The preprocessed text content is input into the BERT-based metadata extraction model to obtain word vector representations containing contextual information;
[0020] The word vectors are sequence-labeled using a conditional random field layer to identify the boundaries and types of regular elements in the word vectors;
[0021] Use an attention mechanism to capture the dependencies between the rule elements;
[0022] Output structured metadata in JSON format.
[0023] Preferably, the verification and improvement of the structured metadata includes:
[0024] An interactive question-and-answer approach is used to guide users in answering questions regarding the confirmation and improvement of the structured metadata;
[0025] Understanding user responses through intent recognition and slot filling technologies;
[0026] Preferably, the above method further includes:
[0027] The defined rules are executed on the input business data, and the rule matching results and execution report are output.
[0028] According to another aspect of the present invention, an automated business rule processing system based on natural language understanding is provided, comprising:
[0029] The text content extraction module is used to extract the text content from the original document containing business rules and perform preprocessing.
[0030] The metadata extraction module utilizes a BERT-based metadata extraction model to extract structured metadata from preprocessed text content. This structured metadata includes rule types, triggering conditions, judgment logic, and threshold parameters. The module also verifies and refines the structured metadata.
[0031] The rule verification module automatically generates rule execution flowcharts and / or test cases based on the confirmed metadata to verify the correctness of the rule logic.
[0032] The rule symbolization module converts the validated rules into corresponding symbolic representations based on the target format using a template engine, thus obtaining the defined rules.
[0033] Preferably, the above system further includes:
[0034] The rule reasoning module is used to execute the defined rules on the input business data, and output the rule matching results and execution report; and / or
[0035] The interactive interface module provides an operation interface, supports full-process visualization of automated business rule processing, and implements role-based permission management.
[0036] According to a third aspect of the present invention, a computer terminal is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can be used to perform the method described in any one of the above-described inventions, or to run the system described in any one of the above-described inventions.
[0037] According to a fourth aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, can be used to perform the method described in any one of the preceding claims of the present invention, or to run the system described in any one of the preceding claims of the present invention.
[0038] By adopting the above technical solution, the present invention has at least one of the following beneficial effects compared with the prior art:
[0039] 1. Lowering the technical threshold: Business personnel can define rules without programming knowledge, which increases the autonomy of business departments.
[0040] 2. Improve conversion efficiency: Automated conversion reduces rule definition time from days to hours, improving work efficiency.
[0041] 3. Reduce misunderstandings: Through an interactive confirmation mechanism, ensure that the technical implementation aligns with business objectives. Figure 1 This reduces the error rate.
[0042] 4. Enhanced system flexibility: Supports multiple output formats, can be integrated into different technology stacks, and is highly adaptable.
[0043] 5. Promote knowledge accumulation: The accumulation of rule base forms enterprise knowledge assets, supporting rule reuse and optimization.
[0044] 6. Improve rule quality: Automatically generate test cases and fully verify rules before deployment to reduce production environment issues. Attached Figure Description
[0045] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0046] Figure 1 This is a flowchart of a preferred embodiment of the automated processing method for business rules based on natural language understanding according to the present invention.
[0047] Figure 2 This is a schematic diagram of the components of a business rule automated processing system based on natural language understanding in a preferred embodiment of the present invention.
[0048] Figure 3 This is a schematic diagram of the system architecture of a business rule automation processing system based on natural language understanding in a specific application example of the present invention.
[0049] Figure 4 This is a flowchart illustrating the rule definition process in a specific application example of the present invention.
[0050] Figure 5 This is a flowchart of rule execution in a specific application example of the present invention.
[0051] Figure 6 This is an example diagram of an interactive question-and-answer interface in an application example of the present invention.
[0052] Figure 7 This is a visualization example of the rule process in an application example of the present invention.
[0053] Figure 8 This is a diagram of the large model fine-tuning architecture in a specific application example of the present invention. Detailed Implementation
[0054] The embodiments of the present invention are described in detail below: These embodiments are implemented based on the technical solution of the present invention, and provide detailed implementation methods and specific operation processes. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention.
[0055] In enterprise information management, numerous complex business rules exist in areas such as financial reimbursement, financial statement analysis, risk control, and compliance auditing. These rules are typically expressed in natural language within policy documents, management systems, and operation manuals, and need to be converted into a computer-executable form for automated processing. How to automatically convert business rules from natural language descriptions to symbolic executable forms, enabling business personnel to directly define and maintain these rules using natural language, reducing manual conversion costs, and improving the accuracy and efficiency of rule processing, is a pressing issue in this field.
[0056] To address the aforementioned issues, one embodiment of the present invention provides an automated processing method for business rules based on natural language understanding. This method automatically extracts structured metadata from business rule documents using a fine-tuned BERT model, guides users to improve rule definitions using an interactive question-and-answer mechanism, automatically generates visual flowcharts and / or test cases for verification, and converts the confirmed rules into various symbolic representations such as Drools DSL and program code.
[0057] Specifically, such as Figure 1 As shown, the automated business rule processing method based on natural language understanding provided in this embodiment may include:
[0058] S1, extract the text content of the original document containing business rules and perform preprocessing;
[0059] S2 utilizes a BERT-based metadata extraction model to extract structured metadata from preprocessed text content. The structured metadata includes rule type, triggering conditions, judgment logic, and threshold parameters.
[0060] S3, confirm and improve structured metadata;
[0061] S4, based on the confirmed metadata, automatically generates a rule execution flowchart and / or test cases to verify the correctness of the rule logic;
[0062] S5, based on the target format, uses a template engine to convert the validated rules into corresponding symbolic representations, thus obtaining the defined rules.
[0063] In some preferred embodiments, the above method may further include:
[0064] S6 executes predefined rules on the input business data and outputs rule matching results and execution reports.
[0065] In some preferred embodiments, S1, which involves extracting text content from the original document containing business rules and performing preprocessing, may further include:
[0066] S11, Receive the original document containing business rules uploaded by the user;
[0067] S12, extract and preprocess the text content to obtain text content that meets the input requirements of the BERT model.
[0068] Furthermore, in S12 above, preprocessing refers to the standardization of the extracted text content, which may further include: removing redundant whitespace characters and special symbols, unifying the encoding format (converting to UTF-8), segmenting into sentences and paragraphs, identifying and marking key entities such as numbers / amounts / dates, removing irrelevant content (such as headers and footers), and cutting long texts into segments suitable for model processing. Preprocessing ensures that the text format is consistent and the structure is clear, facilitating accurate metadata extraction by the subsequent natural language understanding model (i.e., the BERT-based metadata extraction model).
[0069] In some preferred embodiments, S2 above, which uses a BERT-based metadata extraction model to extract structured metadata from the preprocessed text content, may further include:
[0070] S21, Construct a training data set of business rule documents and structured metadata;
[0071] S22, a multi-task learning head is added to the BERT-base model, and the initial model is trained in multiple rounds using training data pairs. At the same time, the rule classification and sequence labeling tasks are optimized to obtain a metadata extraction model based on BERT.
[0072] S23, input the preprocessed text content into the BERT-based metadata extraction model to obtain word vector representations containing contextual information;
[0073] S24, sequence labeling of word vectors is performed through a conditional random field layer to identify the boundaries and types of regular elements in word vectors;
[0074] S25 uses an attention mechanism to capture the dependencies between rule elements;
[0075] S26 integrates the boundaries, types, and dependencies of the acquired rule elements and outputs structured metadata in JSON format.
[0076] In some preferred embodiments, the above-mentioned S3, which involves verifying and improving the structured metadata, may further include:
[0077] S31 uses an interactive question-and-answer format to guide users in answering questions about confirming and improving structured metadata;
[0078] S32 understands user responses through intent recognition and slot filling technology;
[0079] In some preferred embodiments, the interactive question-and-answer method described in S31 may further include:
[0080] It supports context-sensitive multi-turn dialogues and referential resolution, and can dynamically adjust the question order and expression based on user roles and rule complexity;
[0081] In some preferred embodiments, the above-mentioned step S31, where the user answers questions regarding the confirmation and improvement of structured metadata, may further include:
[0082] S311, the detail clarification stage, is used to clarify ambiguous statements by guiding users to provide additional detailed information through preset questions;
[0083] S312, the consistency check phase, is used to supplement missing information and verify the completeness and logical consistency of the rule definition;
[0084] S313, Final Confirmation Stage, is used to confirm that the parameter values and all rule elements are correct.
[0085] In some preferred embodiments, the above-mentioned S32, which understands the user's answer through intent recognition and slot filling technology, may further include:
[0086] S321, Intent recognition aims to clarify the core purpose of the user's response, providing direction for subsequent processing. Specific implementation processes may include:
[0087] S3211, Preset Intent Category Definition: Based on business rule interaction scenarios, preset common intent categories to cover possible user response purposes in interactive question and answer;
[0088] S3212, Training Data Construction: Collect the text of users' answers to rule confirmation questions in historical dialogues, label their corresponding intent categories, and form a training dataset;
[0089] S3213, Classification Model Training and Inference: A fine-tuned language model (such as a BERT-based classifier) is used to semantically encode the user's response text. The intention category probability is output through the classification head, and the category with the highest probability is selected as the recognition result to determine whether the user's current response is used to confirm, supplement, or correct rule information.
[0090] S322, slot filling focuses on extracting key information from user responses, extracting specific parameters or elements required by the rules, and supplementing and improving the metadata. The specific implementation process includes:
[0091] S3221, Slot definition and labeling: Define the slot type to be extracted based on metadata fields of business rules (such as "judgment basis", "threshold parameter", "abnormal handling method" etc.);
[0092] S3222, Sequence Labeling Model Training: Using dialogue data (user response text + slot labels) labeled with slot boundaries and types, a sequence labeling model (such as BERT+CRF architecture) is trained. The model identifies text fragments belonging to the target slot through semantic analysis of the response text, such as key information like monetary values, time ranges, and conditional descriptions.
[0093] S3223, Context Fusion and Correction: Combines contextual information from multi-turn dialogues to verify and correct slot filling results, ensuring the accuracy and consistency of slot information.
[0094] In some preferred embodiments, the above-mentioned S4, which automatically generates a rule execution flowchart, may further include:
[0095] S411 Extract the core elements of rule execution from the confirmed structured metadata, including rule type, triggering conditions, judgment dimensions, threshold parameters, execution actions and exception handling logic, to provide basic data for flowchart construction;
[0096] S412, Define the basic nodes and logical relationships of the flowchart based on the extracted elements, including:
[0097] Starting node: The trigger condition for marking rule execution;
[0098] Decision node: Set branch conditions based on rule-based decision dimensions and threshold parameters;
[0099] Execution node: The action that corresponds to when the conditions are met;
[0100] End node: Outputs the result of rule execution;
[0101] Logical connection lines: These use symbols such as "yes / no" and "AND / OR" to represent dependencies between nodes, reflecting the logical relationships in the metadata.
[0102] S413, using visualization components to convert defined nodes and logical relationships into graphical flowcharts, including:
[0103] Standardized graphic symbols are used;
[0104] Nodes are arranged in the order of rule execution, and the flow is indicated by arrows;
[0105] Key parameters are annotated with text to ensure that the meaning of process nodes is clear and understandable.
[0106] In some preferred embodiments, the above-mentioned S4, which automatically generates a rule execution flowchart, may further include:
[0107] S414 associates automatically generated test cases with flowchart nodes and marks typical paths in the graph, allowing users to verify whether the flowchart accurately reflects business rules and logic. If users find deviations in the process logic, they can return to the interactive confirmation stage to modify the metadata, and the flowchart will be updated accordingly.
[0108] Through the above steps, the generated rule execution flowchart can intuitively display the complete execution logic of business rules, help business personnel verify the correctness of rule definitions, and provide a visual reference for subsequent symbolization conversion and automated execution.
[0109] In some preferred embodiments, the above-mentioned S4, automatically generating test cases, may further include:
[0110] S421, Based on the boundary conditions of the rules, generate critical value test cases to verify the accuracy of the rules in judging critical values;
[0111] S422 generates typical value test cases through equivalence class partitioning to cover typical scenarios within the scope of the rule's application;
[0112] S423, Considering abnormal situations, generate error handling test cases to verify the rule's ability to handle unexpected inputs or special scenarios.
[0113] It should be noted that in this step, each rule should generate at least 3 to 5 test cases covering different scenarios.
[0114] In some preferred embodiments, the above-mentioned S5, which converts the validated rules into corresponding symbolic representations using a template engine according to the target format, may further include:
[0115] S51, maintains code template libraries for various target formats;
[0116] S52, Establish the mapping relationship between metadata fields and template variables;
[0117] S53 uses a template engine to perform template variable replacement and conditional rendering to generate corresponding executable code.
[0118] S54 performs syntax checking and formatting on the generated code to obtain the corresponding symbolic representation.
[0119] In some preferred embodiments, the target format in step S51 above may further include:
[0120] The Drools rule engine uses a DSL format that includes rule definitions with a when-then structure.
[0121] Executable code for programming languages, including Python, Java, and JavaScript;
[0122] Structured configuration file formats include: JSON, YAML, and XML;
[0123] The format of an SQL stored procedure or database trigger definition.
[0124] In some preferred embodiments, the above-mentioned S6, which executes predefined rules on the input business data and outputs rule matching results and an execution report, may further include:
[0125] S61, the user selects multiple rules from the rule base to combine and execute them;
[0126] S62 performs matching judgments independently for each selected rule and does not pre-set the priority relationship between rules;
[0127] S63 records the matching result, judgment basis, and execution time for each rule;
[0128] S64 generates an execution report that includes a list of passed rules, a list of failed rules, and a reason analysis.
[0129] Based on the same inventive concept, an embodiment of the present invention also provides an automated business rule processing system based on natural language understanding.
[0130] Specifically, such as Figure 2 As shown, the business rule automation processing system based on natural language understanding provided in this embodiment may include:
[0131] The text content extraction module is used to extract the text content from the original document containing business rules and perform preprocessing.
[0132] The metadata extraction module utilizes a BERT-based metadata extraction model to extract structured metadata from preprocessed text content. The structured metadata includes rule types, triggering conditions, judgment logic, and threshold parameters. The module also verifies and refines the structured metadata.
[0133] The rule verification module automatically generates rule execution flowcharts and / or test cases based on the confirmed metadata to verify the correctness of the rule logic.
[0134] The rule symbolization module converts the validated rules into corresponding symbolic representations based on the target format using a template engine, thus obtaining the defined rules.
[0135] In some preferred embodiments, the above system may further include:
[0136] The rule reasoning module is used to execute defined rules on the input business data, outputting rule matching results and an execution report; and / or
[0137] The interactive interface module provides an operation interface, supports full-process visualization of automated business rule processing, and implements role-based permission management.
[0138] The following describes in detail, with reference to preferred embodiments, the specific implementation methods of each functional module constituting the system provided in the above embodiments of the present invention.
[0139] The automated business rule processing system based on natural language understanding provided in the above embodiments of the present invention includes: a text content extraction module, a metadata extraction module, a rule verification module, a rule symbolization module, and a rule reasoning module.
[0140] Furthermore:
[0141] The metadata extraction module employs a pre-trained language model based on the BERT architecture. Through supervised learning and fine-tuning on an annotated business rule dataset, it is used to automatically extract structured metadata from business rule documents in natural language form. The metadata includes rule type, triggering conditions, judgment logic, threshold parameters, and execution actions. It also includes an interactive question-answering engine to confirm the details of the structured metadata through multi-turn human-computer dialogue.
[0142] The rule verification module includes a rule flow generator and a test case verifier, which are used to generate visual flowcharts and / or test cases for user verification.
[0143] The rule symbolization module includes a symbolization converter for converting confirmed rules into symbolic representations such as Drools DSL, program code, or configuration files.
[0144] The rule reasoning module, including the rule base manager, data preprocessor, rule matching engine, and result aggregator, is used to manage defined business rules, perform rule matching judgments on input business data, and generate detailed execution reports.
[0145] The interactive interface module provides a web-based operation interface, supports full-process visual operation of rule definition, testing, and deployment, and implements role-based permission management.
[0146] In some preferred embodiments, the metadata extraction module constructs a training dataset containing more than 10,000 pairs of "business rule documents - structured metadata"; adds a multi-task learning head to the BERT-base model, and optimizes the rule classification and sequence labeling tasks; and performs 5 rounds of training with a learning rate of 2e-5 and a batch size of 32, so that the F1 score of metadata extraction reaches above 0.92 and the rule classification accuracy reaches above 0.95, realizing the fine-tuning process of the large model.
[0147] In some preferred embodiments, the metadata extraction module employs a dialogue management strategy based on a finite state machine in its interactive question-and-answer engine. This strategy includes: pre-setting more than 50 question templates to cover common rule types such as amount limits, time constraints, conditional judgments, and process control; understanding user answers through intent recognition and slot filling technologies; supporting context-dependent multi-turn dialogues and referential resolution; and dynamically adjusting the question order and expression method according to user roles and rule complexity.
[0148] In some preferred embodiments, the rule symbolization module described above supports the following output formats in its symbolization converter: the DSL format of the Drools rule engine, which includes rule definitions with a when-then structure; executable code in programming languages such as Python, Java, and JavaScript; structured configuration file formats such as JSON, YAML, and XML; and SQL stored procedures or database trigger definitions.
[0149] In some preferred embodiments, when the rule reasoning module performs rule matching, it supports users to select multiple rules from the rule base for combined execution; it performs matching judgment independently for each selected rule without pre-setting the priority relationship between rules; it records the matching result, judgment basis, and execution time of each rule; and it generates a detailed report including a list of passed rules, a list of failed rules, and reason analysis.
[0150] It should be noted that the steps in the method provided by the present invention can be implemented using the corresponding components in the system. Those skilled in the art can refer to the technical solution of the system to implement the steps of the method, and can also refer to the technical solution of the method to implement the composition of the system. That is, the embodiments in the system and the embodiments in the method can be understood as preferred examples of each other, which will not be elaborated here.
[0151] The automated business rule processing method and system based on natural language understanding provided in the above embodiments of the present invention automatically extracts structured metadata from business rule documents through a fine-tuned BERT model, guides users to improve rule definitions using an interactive question-and-answer mechanism, automatically generates visual flowcharts and / or test cases for verification, and converts confirmed rules into various symbolic representations such as Drools DSL and program code. The method and system provided in the above embodiments of the present invention achieve automatic conversion of business rules from natural language to executable form, enabling business personnel to define and maintain rules without programming, significantly improving rule processing efficiency, reducing comprehension bias, shortening rule definition time by more than 90%, and reducing the error rate by 80%.
[0152] The technical solutions provided by the above embodiments of the present invention will be further described in detail below with reference to specific application examples.
[0153] 1. In this specific application example, the system architecture of the business rule automation processing system based on natural language understanding is as follows: Figure 3 As shown, it includes:
[0154] (1) Metadata Extraction Module
[0155] Based on a pre-trained large language model, a specialized metadata extraction model is obtained through supervised learning fine-tuning; where:
[0156] Input: The original document of the business rules (text, PDF, Word, etc.);
[0157] Output: Structured metadata, including rule type, applicable conditions, judgment criteria, threshold parameters, business entities, etc.
[0158] Interactive question-answering engine: Confirm metadata details through multi-turn dialogue.
[0159] (2) Rule Validation Module
[0160] Rule flow generator: Generates execution flow diagrams based on metadata;
[0161] Test case validator: Generates test cases for users to verify.
[0162] (3) Rule symbolization module
[0163] Function: Core component that converts natural language rules into computer-executable symbolic representations;
[0164] Core components:
[0165] Symbol converter: Supports multiple output formats (Drools DSL, Python code, JSON configuration, etc.).
[0166] (4) Rule-based reasoning module
[0167] Rule base management: Stores and indexes defined business rules;
[0168] Data preprocessing: Extracting metadata from the input business data;
[0169] Rule matching engine: Executes rule matching results based on user selection;
[0170] Aggregator: Summarizes the execution results of each rule and generates a report.
[0171] (5) Interactive Interface Module
[0172] Web-based user interface: Supports the entire process of rule definition, testing, and deployment;
[0173] Visualization components: flowchart display, case demonstration, results report;
[0174] Access control: Differentiate between business personnel, reviewers, and system administrators.
[0175] In such Figure 3 The system architecture shown demonstrates that the automated business rule processing system adopts a layered architecture design, including a user layer, an interactive interface module, a business logic layer, a data storage layer, and an external system interface. The business logic layer contains four core modules: a metadata extraction module, a rule verification module, a rule symbolization module, and a rule reasoning module. The modules interact with each other through standard interfaces to ensure the system's scalability and maintainability.
[0176] 2. In this specific application example, the core workflow of the automated business rule processing method based on natural language understanding includes:
[0177] (1) Rule definition process, such as Figure 4 As shown, it includes:
[0178] Step S1: Document Upload and Parsing
[0179] Business personnel upload the original document containing the business rules;
[0180] The system automatically identifies document formats and extracts text content;
[0181] Long documents are intelligently segmented, with each segment containing no more than 512 tokens.
[0182] Step S2: Automatic Metadata Extraction
[0183] The fine-tuned BERT model is used to perform semantic analysis on the text.
[0184] Identify rule elements: triggering condition, judgment logic, execution action, and exception handling;
[0185] Extract numerical parameters: amount threshold, time limit, quantity range, etc.;
[0186] Construct a structured representation of the rules.
[0187] Step S3: Interactive rule confirmation
[0188] The system displays the extracted metadata, which users can modify and supplement.
[0189] Guide users to refine the rule details by using pre-set question templates:
[0190] "What are the triggering conditions for this rule?"
[0191] What are the criteria for passing the test?
[0192] What input data is required?
[0193] "How should we handle abnormal situations?"
[0194] The system updates metadata after the user answers.
[0195] Step S4: Rule Validation
[0196] Generate an execution flowchart based on the confirmed metadata;
[0197] Automatically generate 3-5 test cases, including normal and abnormal scenarios;
[0198] Verify the correctness of the user verification flowchart and examples;
[0199] If there are any problems, please return to S3 for further improvement.
[0200] Step S5: Symbolic Output
[0201] Users select the target format (Drools DSL, Python, Java, etc.);
[0202] The system generates corresponding symbolization rules based on the template;
[0203] Provides syntax checking and format validation;
[0204] Generate a deployment package for download or direct deployment.
[0205] like Figure 4 The rule definition process shown depicts the complete transformation from business rule documents to symbolic rules. The process comprises five main stages: document upload, metadata extraction, interactive confirmation, rule verification, and symbolic output. It employs an iterative design, allowing users to modify and refine the rules at any stage. Key process nodes include: 1. Document parsing: Supports multiple formats such as PDF, Word, and plain text; 2. Metadata extraction: Automatically extracts structured information using a fine-tuned BERT model; 3. Interactive Q&A: Refines rule details through multi-turn dialogues; 4. Rule verification: Generates flowcharts and test cases for user confirmation; 5. Multi-format output: Supports formats such as DroolsDSL, Python, Java, and JSON.
[0206] (2) Rule execution process, such as Figure 5 As shown, it includes:
[0207] Step E1: Business Data Input
[0208] Supports batch import of Excel and CSV format data;
[0209] The real-time API interface receives data in JSON format.
[0210] Data format validation and preprocessing.
[0211] Step E2: Rule Selection
[0212] Displays a list of available rules, supporting searching and filtering;
[0213] Users select the rules they want to follow;
[0214] It supports setting rule combinations and execution order.
[0215] Step E3: Rule Execution
[0216] Execute the selected rules in parallel;
[0217] Each rule is evaluated independently, and intermediate results are recorded.
[0218] Supports rule execution timeout control.
[0219] Step E4: Output Results
[0220] Generate a detailed execution report:
[0221] Rule execution statistics (passed / failed / abnormal);
[0222] Rule matching details for each data entry;
[0223] Analysis of reasons for failure;
[0224] Supports report export (PDF and Excel formats).
[0225] As Figure 5 The rule execution flow shown supports three data input methods: batch file import, real-time API access, and manual entry. Rule execution employs a parallel processing mechanism to improve efficiency. Key features of the execution flow include: 1. Flexible data input: Supports batch import of Excel / CSV files and real-time API access; 2. Autonomous rule selection: Users can select the set of rules to execute based on their needs; 3. Parallel execution: Multiple rules are executed simultaneously and judged independently; 4. Detailed results: Generates a complete report containing statistical information and matching details; 5. Convenient operation: Supports report export, re-execution, and other subsequent operations.
[0226] III. Implementation of Key Technologies
[0227] (1) Large model fine-tuning scheme, such as Figure 8 As shown, it includes:
[0228] a. Training data construction:
[0229] We have collected over 10,000 business rule documents in the fields of finance, auditing, and risk control.
[0230] A professional annotation team annotates metadata and establishes a "document-metadata" comparison dataset;
[0231] Data augmentation: The sample size was expanded to 50,000+ through synonym replacement and sentence transformation.
[0232] b. Model Architecture:
[0233] Base model: BERT-base-chinese (12 layers, 768 dimensions, 110M parameters);
[0234] Fine-tuning strategy:
[0235] Add a classification header and a sequence labeling header to the pre-trained model;
[0236] Multi-task learning is employed to optimize rule classification and feature extraction simultaneously;
[0237] Learning rate: 2e-5, batch size: 32, number of training rounds: 5;
[0238] Evaluation metrics: Metadata extraction score F1 > 0.92, rule classification accuracy > 0.95.
[0239] like Figure 8The diagram showing the large-scale model fine-tuning architecture demonstrates the complete process of fine-tuning a large language model based on BERT, employing a multi-task learning strategy to simultaneously optimize rule classification and entity recognition. Detailed annotations of training parameters and evaluation metrics are provided. Key technical points include: 1. Data scale: 10,000+ labeled samples, expanded to 50,000+ through data augmentation; 2. Model foundation: BERT-based-chinese, 12-layer Transformer architecture; 3. Multi-task learning: Parallel training of the rule classification head and sequence labeling head; 4. Training parameters: Learning rate 2e-5, batch size 32, 5 training epochs.
[0240] (2) Interactive question-and-answer mechanism, including:
[0241] a. Dialogue Management:
[0242] Design a dialogue process based on a finite state machine;
[0243] 50+ pre-set question templates cover common rule types;
[0244] It supports contextual understanding and multi-round clarification.
[0245] b. Natural Language Understanding:
[0246] Intent recognition: Determine the category of the user's intent in their response;
[0247] Slot filling: Extracting key information from answers;
[0248] Dereferential resolution: dealing with referential pronouns such as "it" and "this".
[0249] c. Dialogue strategies:
[0250] Prioritize asking for necessary information, and postpone requesting optional information;
[0251] Adjust the complexity of the question based on the user's role;
[0252] Provide examples to guide users in answering questions.
[0253] like Figure 6 The image shown is an example of an interactive question-and-answer interface. This example uses a three-column design with clear functional divisions: the left column displays the original rules and extracted metadata; the middle column is the interactive question-and-answer area, supporting real-time dialogue; and the right column displays test cases and verification results. This interface has the following advantages: 1. Intuitive information display: Original rules, metadata, and dialogue content are displayed separately; 2. User-friendly interaction: The chat-style interface lowers the barrier to entry; 3. Instant feedback: Test cases demonstrate the rule execution effect in real time; 4. Convenient operation: Provides quick operation buttons such as confirm, modify, and cancel.
[0254] (3) Symbolization conversion mechanism
[0255] a. Template System:
[0256] Define a code template for each output format;
[0257] Template variable mapping to metadata fields;
[0258] Supports conditional logic and loop structures.
[0259] b. Code generation:
[0260] Code generation based on AST (Abstract Syntax Tree);
[0261] Ensure the generated code is syntactically correct;
[0262] Automatically handles type conversions and exception handling.
[0263] c. Format support:
[0264] Drools DSL: Rule Engine Format;
[0265] Python / Java: Directly executable code;
[0266] JSON / YAML: Configuration file format;
[0267] SQL: Database stored procedures.
[0268] IV. Application Example 1: Financial Reimbursement Rules Processing
[0269] Scenario Description: A company needs to automate the reimbursement rules in its "Travel Expense Reimbursement Management Regulations." Original rule description: "Employee travel accommodation expense reimbursement standards: For ordinary employees, no more than 300 yuan per night for travel within the province and no more than 400 yuan per night for travel outside the province; for department managers, no more than 400 yuan per night for travel within the province and no more than 500 yuan per night for travel outside the province; for senior management personnel, no more than 600 yuan per night for travel within the province and no more than 800 yuan per night for travel outside the province."
[0270] Implementation steps:
[0271] 1. Document Upload: Finance personnel upload the "Travel Expense Reimbursement Management Regulations" PDF document;
[0272] 2. Metadata Extraction: The system automatically identifies and extracts the following metadata, which can be implemented using the following computer programming languages:
[0273] json
[0274] {
[0275] "Rule Type": "Amount Limit",
[0276] "Target Audience": ["General Employees", "Department Managers", "Senior Managers"],
[0277] "Judgment Dimensions": ["Employee Level", "Business Trip Location"],
[0278] "Limit Parameters":{
[0279] "Regular Employees":{"Within the Province":300,"Outside the Province":400},
[0280] Department Manager: {"Within the province": 400,"Outside the province": 500}
[0281] Senior Management: {"Within the province": 600, "Outside the province": 800}
[0282] }
[0283] }
[0284] 3. Interactive confirmation:
[0285] System: "Please confirm the criteria for determining employee levels?"
[0286] User: "Based on the job level field in the HR system"
[0287] System: "How do I determine whether a business trip location is within or outside the province?"
[0288] User: "Based on the destination city in the business trip application form"
[0289] 4. Rule Validation: The system generates test cases.
[0290] Case 1: Ordinary employee Zhang San applied for a reimbursement of 350 yuan for a business trip within the province → application rejected.
[0291] Case 2: Department Manager Li Sisheng applied for a reimbursement of 480 yuan for a business trip → Approved
[0292] User confirmed the case was correct.
[0293] 5. Symbolic Output: Generates Drools DSL rules. An example of the output computer language is shown below:
[0294] drools
[0295] Rule "Check travel and accommodation expense reimbursement limits"
[0296] when
[0297] $apply:ReimbursementApply(type=="Accommodation Fee")
[0298] $employee:Employee(id==$apply.employeeId)
[0299] then
[0300] int limit = 0;
[0301] if ($employee.level == "regular employee"){
[0302] limit=$apply.isProvincial? 300:400;
[0303] }else if($employee.level=="Department Manager"){
[0304] limit=$apply.isProvincial? 400:500;
[0305] } else if($employee.level=="Senior Manager"){
[0306] limit=$apply.isProvincial? 600:800;
[0307] }
[0308] if ($apply.amount>limit){
[0309] $apply.reject("Exceeding the travel and accommodation expense reimbursement limit");
[0310] }
[0311] end
[0312] V. Application Example 2: Audit Risk Rule Identification
[0313] Scenario Description: The audit department needs to automate the risk assessment rules in the "Internal Audit Risk Identification Guidelines." Original rule: "Entities with an inventory turnover rate below 2 for three consecutive months and accounts receivable turnover days exceeding 90 days should be marked as high-risk entities."
[0314] Implementation process:
[0315] 1. The metadata extraction results can be implemented using the following computer programming languages:
[0316] json
[0317] {
[0318] "Rule Type": "Combined Condition Judgment"
[0319] "Time window": "three consecutive months"
[0320] "Judgment condition":[
[0321] {"Indicator":"Inventory Turnover Ratio","Operator":"<","Threshold":2},
[0322] {"Indicator":"Accounts Receivable Turnover Days","Operator":">","Threshold":90}
[0323] ],
[0324] Logical relation: "AND"
[0325] Output action: "Mark as high risk"
[0326] }
[0327] }
[0328] 2. Symbolic output: Generate Python code: python. An example of the output computer language is shown below:
[0329] Python
[0330] def audit_risk_check(company_data):
[0331] """Audit Risk Rules Review"""
[0332] #Get data for the last three months
[0333] recent_months=company_data.get_recent_months(3)
[0334] #Check if the conditions have been met for three consecutive months.
[0335] high_risk = True
[0336] for month_data in recent_months:
[0337] inventory_turnover=month_data.get('inventory_turnover',0)
[0338] receivable_days=month_data.get('receivable_days',0)
[0339] if inventory_turnover>=2or receivable_days<=90:
[0340] high_risk = False
[0341] break
[0342] if high_risk:
[0343] return{
[0344] 'risk_level':'HIGH',
[0345] 'reason': 'Inventory turnover rate is below 2 for three consecutive months and accounts receivable turnover days exceed 90 days'
[0346] }
[0347] return {'risk_level':'NORMAL'}
[0348] like Figure 7 As shown, a visual example of a rule flow is provided. Taking a travel accommodation expense reimbursement rule as an example, this example demonstrates the complete logical flow of rule execution. The flowchart clearly shows the judgment conditions, branch logic, and execution results, using different colors to highlight key nodes and improve readability. The rule flow mainly includes: 1. Information extraction: Extracting employee level, reimbursement amount, and business trip location from the application data; 2. Multi-level judgment: Sequentially judging the reimbursement type, employee level, and business trip location; 3. Limit comparison: Applying corresponding reimbursement limits based on different conditions; 4. Result processing: Approving or rejecting, and recording detailed logs.
[0349] The above specific application examples demonstrate that this method enables the automatic conversion of business rules from natural language to executable form, allowing business personnel to define and maintain rules without programming. This significantly improves rule processing efficiency, reduces misunderstandings, shortens rule definition time by more than 90%, and reduces the error rate by 80%.
[0350] An embodiment of the present invention also provides a computer terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can be used to execute the method of any of the above embodiments of the present invention, or to run the system of any of the above embodiments of the present invention.
[0351] Optionally, the memory is used to store programs; the memory may include volatile memory, such as random-access memory (RAM), such as static random-access memory (SRAM), double data rate synchronous dynamic random-access memory (DDR SDRAM), etc.; the memory may also include non-volatile memory, such as flash memory. The memory is used to store computer programs (such as application programs, functional modules, etc. that implement the above methods), computer instructions, etc., and the aforementioned computer programs, computer instructions, etc., can be partitioned and stored in one or more memories. Furthermore, the aforementioned computer programs, computer instructions, data, etc., can be accessed by the processor.
[0352] A processor is used to execute computer programs stored in memory to implement the various steps of the methods or various modules of the systems involved in the above embodiments. For details, please refer to the relevant descriptions in the preceding method and system embodiments.
[0353] The processor and memory can be separate structures or integrated structures. When the processor and memory are separate structures, they can be coupled together via a bus.
[0354] An embodiment of the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can be used to perform the method of any of the above embodiments of the present invention, or to run the system of any of the above embodiments of the present invention.
[0355] Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of computer programs from one place to another. Storage media can be any available medium accessible to a general-purpose or special-purpose computer. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Alternatively, the ASIC can reside in a user device. Of course, the processor and storage medium can also exist as discrete components in a communication device.
[0356] The automated business rule processing method and system based on natural language understanding provided in the above embodiments of the present invention allow business personnel to define rules without programming knowledge, thereby improving the autonomy of business departments. Automated conversion reduces rule definition time from days to hours, improving work efficiency. An interactive confirmation mechanism ensures that the technical implementation aligns with business intent. Figure 1 This reduces the error rate. It supports multiple output formats and can be integrated into different technology stacks, offering strong adaptability. The accumulation of the rule base forms enterprise knowledge assets, supporting rule reuse and optimization. Automatic test case generation ensures thorough rule validation before deployment, reducing production environment issues.
[0357] Any matters not covered in the above embodiments of the present invention are well-known in the art.
[0358] The specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various modifications or variations within the scope of the claims, which do not affect the essence of the present invention.
Claims
1. A method for automating business rule processing based on natural language understanding, characterized in that, include: Extract the text content from the original document containing business rules and perform preprocessing; Using a BERT-based metadata extraction model, structured metadata is extracted from preprocessed text content; The structured metadata includes: rule type, triggering condition, judgment logic, and threshold parameters; The structured metadata was verified and improved. Based on the confirmed metadata, the rule execution flowchart and / or test cases are automatically generated to verify the correctness of the rule logic; Based on the target format, the validated rules are converted into corresponding symbolic representations using a template engine to obtain the defined rules.
2. The automated business rule processing method based on natural language understanding according to claim 1, characterized in that, The method of extracting structured metadata from preprocessed text content using a BERT-based metadata extraction model includes: Construct a training data set of business rule documents and structured metadata; A multi-task learning head is added to the BERT-base model, and the initial model is trained multiple times using the training data set. At the same time, the rule classification and sequence labeling tasks are optimized to obtain a BERT-based metadata extraction model. The preprocessed text content is input into the BERT-based metadata extraction model to obtain word vector representations containing contextual information; The word vectors are sequence-labeled using a conditional random field layer to identify the boundaries and types of regular elements in the word vectors; Use an attention mechanism to capture the dependencies between the rule elements; Output structured metadata in JSON format.
3. The automated business rule processing method based on natural language understanding according to claim 1, characterized in that, The process of confirming and improving the structured metadata includes: An interactive question-and-answer approach is used to guide users in answering questions regarding the confirmation and improvement of the structured metadata; Understanding user responses through intent recognition and slot filling technologies; in: The interactive question-and-answer method supports context-dependent multi-turn dialogues and referential resolution, and can dynamically adjust the question order and expression method according to user roles and rule complexity; The user's responses to confirmation and improvement requests regarding the structured metadata include: The detailed clarification stage is used to clarify ambiguous statements by guiding users to provide additional detailed information through pre-set questions. The consistency check phase is used to supplement missing information and verify the completeness and logical consistency of the rule definitions; The final confirmation stage is used to verify that the parameter values and all rule elements are correct.
4. The automated business rule processing method based on natural language understanding according to claim 1, characterized in that, The automatically generated test cases include: Based on the boundary conditions of the rules, critical value test cases are generated to verify the accuracy of the rules in judging critical values. By dividing the data into equivalence classes, typical value test cases are generated to cover typical scenarios within the scope of the rules. Considering exceptional circumstances, generate error handling test cases to test the rules' ability to handle unexpected inputs or special scenarios.
5. The automated business rule processing method based on natural language understanding according to claim 1, characterized in that, The step of converting the validated rules into corresponding symbolic representations using a template engine according to the target format includes: Maintain code template libraries for various target formats; Establish a mapping relationship between metadata fields and template variables; Use a template engine to perform template variable replacement and conditional rendering to generate corresponding executable code; The generated code undergoes syntax checking and formatting to obtain the corresponding symbolic representation.
6. The automated business rule processing method based on natural language understanding according to claim 5, characterized in that, The target format includes: The Drools rule engine uses a DSL format that includes rule definitions with a when-then structure. Executable code for programming languages, including Python, Java, and JavaScript; Structured configuration file formats include: JSON, YAML, and XML; The format of an SQL stored procedure or database trigger definition.
7. The automated processing method for business rules based on natural language understanding according to any one of claims 1-6, characterized in that, Also includes: The defined rules are executed on the input business data, and the rule matching results and execution report are output.
8. The automated business rule processing method based on natural language understanding according to claim 6, characterized in that, The process of executing the defined rules on the input business data and outputting the rule matching results and execution report includes: Users can select multiple rules from the rule base to combine and execute them; Each selected rule is matched and judged independently, and no priority relationship is preset between rules; Record the matching results, judgment criteria, and execution time for each rule; Generate an execution report that includes a list of passed rules, a list of failed rules, and an analysis of the reasons.
9. A business rule automated processing system based on natural language understanding, characterized in that, include: The text content extraction module is used to extract the text content from the original document containing business rules and perform preprocessing. The metadata extraction module uses a BERT-based metadata extraction model to extract structured metadata from preprocessed text content. The structured metadata includes: rule type, triggering condition, judgment logic, and threshold parameters; the structured metadata is then confirmed and improved. The rule verification module automatically generates rule execution flowcharts and / or test cases based on the confirmed metadata to verify the correctness of the rule logic. The rule symbolization module converts the validated rules into corresponding symbolic representations based on the target format using a template engine, thus obtaining the defined rules.
10. The automated business rule processing system based on natural language understanding according to claim 9, characterized in that, Also includes: The rule reasoning module is used to execute the defined rules on the input business data and output the rule matching results and execution report. and / or The interactive interface module provides an operation interface, supports full-process visualization of automated business rule processing, and implements role-based permission management.
Citation Information
Cited By
Business rule generation method and system, electronic equipment, medium and program product
CN121880423A
Intelligent user marking system based on natural language processing and control method thereof
CN121900729A
An intelligent user tagging system based on natural language processing and a control method thereof
CN121900729B
A large language model system prompt priority alignment benchmarking method
CN122432053A