Rule type conversion method, electronic equipment, storage medium and program product
The rule description file is converted into execution code through the first transformation model, and the second transformation model is converted into target rule information, which solves the problem of low efficiency in the prior art rule conversion, realizes automatic conversion, and improves efficiency.
Patent Information
- Application Number
- CN202411745891.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-21
AI Technical Summary
In the prior art, the corresponding rules types of each rule engine are different, resulting in manual rule conversion processing before inputting the rule description file into the rule engine, which is less efficient.
The rule description file is converted into the first execution code through the first conversion model, and the first execution code is converted into the target rule information through the second conversion model, so that the rule conversion without manual adaptation processing is realized.
It improves the efficiency of rule conversion, reduces manual intervention, and improves the degree of automation of the conversion process.
Smart Images

Figure CN119668619A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a rule type conversion method, electronic device, storage medium and program product. Background Art
[0002] A rule engine is a component in an application that accepts data input and makes business decisions based on business rules.
[0003] In the prior art, each rule engine corresponds to a different rule type. If a rule description file needs to be processed by a target rule engine, the rule description file needs to be manually converted before being input into the rule engine, resulting in low efficiency of rule conversion. Summary of the invention
[0004] The embodiments of the present application provide a rule type conversion method, an electronic device, a storage medium, and a program product to achieve the effect of improving the efficiency of rule conversion.
[0005] In a first aspect, an embodiment of the present application provides a method for converting a rule type, including:
[0006] receiving a rule conversion request, wherein the rule conversion request includes a rule description file, and the rule type of the rule description file is a first rule type;
[0007] Performing a first conversion process on the rule description file through a first conversion model to obtain a first execution code, wherein the code type of the first execution code is a first code type;
[0008] According to the second conversion model and the first execution code, target rule information is determined, and the rule type of the target rule information is a second rule type.
[0009] In a possible implementation, determining target rule information according to the second conversion model and the first execution code includes:
[0010] Determining whether a first code type of the first execution code and a second code type of an input of the second conversion model are the same;
[0011] If not, the first execution code is translated to obtain a second execution code, the code type of the second execution code is a second code type, and the second execution code is converted by the second conversion model to obtain the target rule information.
[0012] In a possible implementation manner, translating the first execution code to obtain a second execution code includes:
[0013] Determining a code translation model according to the first code type and the second code type;
[0014] The first execution code is translated by the code translation model to obtain the second execution code.
[0015] In a possible implementation, determining a code translation model according to the first code type and the second code type includes:
[0016] Acquire a plurality of training samples, wherein the training samples include a target input code and a target output code, wherein the target input code is of the first code type, and the target output code is of the second code type;
[0017] The preset model is trained using the multiple training samples to obtain the code translation model.
[0018] In a possible implementation, obtaining a plurality of training samples includes:
[0019] Get multiple test questions;
[0020] Processing the plurality of test questions through the first large model to obtain an initial input code corresponding to each test question, and processing the plurality of test questions through the second large model to obtain an initial output code corresponding to each test question;
[0021] Determining difference values corresponding to a plurality of initial input codes and a plurality of initial output codes;
[0022] If the difference value is less than or equal to a preset value, the initial input code and the initial output code corresponding to each test question are determined as the target input code and the target output code corresponding to each training sample.
[0023] In a possible implementation manner, the difference value includes a first difference value and a second difference value; and determining the difference value corresponding to each initial input code and each initial output code includes:
[0024] Determine the time complexity and space complexity of each initial input code, and the time complexity and space complexity of each initial output code;
[0025] Determine a first difference value between the time complexity of each of the initial input codes and the time complexity of each of the initial output codes;
[0026] A second difference value between the space complexity of each of the initial input codes and the space complexity of each of the initial output codes is determined.
[0027] In a possible implementation, performing a first conversion process on the rule description file through a first conversion model to obtain a first execution code includes:
[0028] Preprocessing the rule description file to obtain first rule information, wherein the preprocessing includes word segmentation processing and blank character removal processing;
[0029] According to the rule conversion request, obtaining the first conversion model, where the first conversion model is used to convert the rule into execution code;
[0030] The first conversion model is used to perform a first conversion process on the first rule information to obtain the first execution code.
[0031] In a possible implementation, the method further includes:
[0032] The target rule information is verified through the rule description file to obtain a comparison and analysis result.
[0033] According to the comparison and analysis results, the first conversion model is optimized to obtain an updated first conversion model, and the second conversion model is optimized to obtain an updated second conversion model.
[0034] In a possible implementation, the target rule information is verified by using the rule description file to obtain a comparison analysis result, including:
[0035] Determine the information to be verified corresponding to the rule description file;
[0036] Determine, according to the information to be verified, a first verification result corresponding to the rule description file and a second verification result corresponding to the target rule information;
[0037] The first verification result and the second verification result are compared and analyzed to obtain a comparison analysis result.
[0038] In a possible implementation manner, determining the information to be verified corresponding to the rule description file includes:
[0039] Determine parameter information according to the rule description file, where the parameter information includes multiple features and a parameter range corresponding to each feature;
[0040] The information to be verified is generated according to the parameter information.
[0041] In a possible implementation, determining, according to the information to be verified, a first verification result corresponding to the rule description file and a second verification result corresponding to the target rule information includes:
[0042] Deploy a source rule engine corresponding to the rule description file and a destination rule engine corresponding to the target rule information, wherein the source rule engine and the destination rule engine have the same rule logic;
[0043] Performing data processing on the information to be verified by the source rule engine to obtain the first verification result;
[0044] The purpose rule engine performs data processing on the information to be verified to obtain the second verification result.
[0045] In a second aspect, an embodiment of the present application provides a rule type conversion device, including a receiving module, a conversion module and a determination module:
[0046] The receiving module is used to receive a rule conversion request, wherein the rule conversion request includes a rule description file, and the rule type of the rule description file is a first rule type;
[0047] The conversion module is used to perform a first conversion process on the rule description file through a first conversion model to obtain a first execution code, wherein the code type of the first execution code is a first code type;
[0048] The determination module is used to determine target rule information according to the second conversion model and the first execution code, and the rule type of the target rule information is the second rule type.
[0049] In a possible implementation manner, the determining module is specifically configured to:
[0050] Determining whether a first code type of the first execution code and a second code type of an input of the second conversion model are the same;
[0051] If not, the first execution code is translated to obtain a second execution code, the code type of the second execution code is a second code type, and the second execution code is converted by the second conversion model to obtain the target rule information.
[0052] In a possible implementation manner, the determining module is specifically configured to:
[0053] Determining a code translation model according to the first code type and the second code type;
[0054] The first execution code is translated by the code translation model to obtain the second execution code.
[0055] In a possible implementation manner, the determining module is specifically configured to:
[0056] Acquire a plurality of training samples, wherein the training samples include a target input code and a target output code, wherein the target input code is of the first code type, and the target output code is of the second code type;
[0057] The preset model is trained using the multiple training samples to obtain the code translation model.
[0058] In a possible implementation manner, the determining module is specifically configured to:
[0059] Get multiple test questions;
[0060] Processing the plurality of test questions through the first large model to obtain an initial input code corresponding to each test question, and processing the plurality of test questions through the second large model to obtain an initial output code corresponding to each test question;
[0061] Determining difference values corresponding to a plurality of initial input codes and a plurality of initial output codes;
[0062] If the difference value is less than or equal to a preset value, the initial input code and the initial output code corresponding to each test question are determined as the target input code and the target output code corresponding to each training sample.
[0063] In a possible implementation manner, the difference value includes a first difference value and a second difference value; and the determination module is specifically configured to:
[0064] Determine the time complexity and space complexity of each initial input code, and the time complexity and space complexity of each initial output code;
[0065] Determine a first difference value between the time complexity of each of the initial input codes and the time complexity of each of the initial output codes;
[0066] A second difference value between the space complexity of each of the initial input codes and the space complexity of each of the initial output codes is determined.
[0067] In a possible implementation manner, the conversion processing module is specifically used to:
[0068] Preprocessing the rule description file to obtain first rule information, wherein the preprocessing includes word segmentation processing and blank character removal processing;
[0069] According to the rule conversion request, obtaining the first conversion model, where the first conversion model is used to convert the rule into execution code;
[0070] The first conversion model is used to perform a first conversion process on the first rule information to obtain the first execution code.
[0071] In a possible implementation, it also includes a verification processing module and an optimization processing module:
[0072] The verification processing module is used to verify the target rule information through the rule description file to obtain a comparison analysis result.
[0073] The optimization processing module is used to optimize the first conversion model according to the comparison and analysis results to obtain an updated first conversion model, and optimize the second conversion model to obtain an updated second conversion model.
[0074] In a possible implementation manner, the verification processing module is specifically used to:
[0075] Determine the information to be verified corresponding to the rule description file;
[0076] Determine, according to the information to be verified, a first verification result corresponding to the rule description file and a second verification result corresponding to the target rule information;
[0077] The first verification result and the second verification result are compared and analyzed to obtain a comparison analysis result.
[0078] In a possible implementation manner, the verification processing module is specifically used to:
[0079] Determine parameter information according to the rule description file, where the parameter information includes multiple features and a parameter range corresponding to each feature;
[0080] The information to be verified is generated according to the parameter information.
[0081] In a possible implementation manner, the verification processing module is specifically used to:
[0082] Deploy a source rule engine corresponding to the rule description file and a destination rule engine corresponding to the target rule information, wherein the source rule engine and the destination rule engine have the same rule logic;
[0083] Performing data processing on the information to be verified by the source rule engine to obtain the first verification result;
[0084] The purpose rule engine performs data processing on the information to be verified to obtain the second verification result.
[0085] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0086] The memory stores computer-executable instructions;
[0087] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0088] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.
[0089] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0090] The rule type conversion method, electronic device, storage medium and program product provided in the embodiments of the present application can convert the rule description file into a first execution program through a first conversion model, and convert the first execution program into target rule information through a second conversion model. There is no need for manual adaptation of the rule description file, which can improve the efficiency of rule conversion. BRIEF DESCRIPTION OF THE DRAWINGS
[0091] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0092] Figure 1 A schematic diagram of an application scenario provided for this application;
[0093] Figure 2 A flowchart of a rule type conversion method provided in this application;
[0094] Figure 3 A schematic diagram of the process of another rule type conversion method provided in this application;
[0095] Figure 4 A schematic diagram of a rule type conversion method provided in an embodiment of the present application;
[0096] Figure 5 A schematic diagram of a process for determining a code translation model provided in an embodiment of the present application;
[0097] Figure 6 A schematic diagram of the architecture of a rule type conversion method provided in an embodiment of the present application;
[0098] Figure 7A schematic diagram of a structure of a rule type conversion device is provided for an embodiment of the present application;
[0099] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0100] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0101] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0102] Figure 1 A schematic diagram of an application scenario provided for this application. Figure 1 , may include a user terminal 101 and a server 102.
[0103] A rule conversion system may be installed in the user terminal 101. The user may upload a rule description file in the rule conversion system through the user terminal 101 and generate a rule conversion request corresponding to the rule description file. The rule conversion request is used to convert the first rule type of the rule description file into the second rule type.
[0104] After receiving the rule conversion request, the server 102 can determine the first conversion model and the second conversion model. The first conversion model is used to convert the rule description file into a first execution code. The server 102 can determine the target rule information based on the second conversion model and the first execution code. The rule type of the target rule information is the second rule type.
[0105] In the prior art, each rule engine corresponds to a different rule type. If a rule description file needs to be processed by a target rule engine, the rule description file needs to be manually converted before being input into the rule engine, resulting in low efficiency of rule conversion.
[0106] The rule type conversion method provided in the present application can convert the rule description file into a first execution program through a first conversion model, and convert the first execution program into target rule information through a second conversion model. There is no need for manual adaptation of the rule description file, which can improve the efficiency of rule conversion.
[0107] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0108] Figure 2 A flowchart of a rule type conversion method provided for this application. Figure 1 , the method may include:
[0109] S201: Receive a rule conversion request.
[0110] The execution subject of the embodiment of the present application may be a server, or a rule type conversion device set in the server. The rule type conversion device may be implemented by software, or by a combination of software and hardware.
[0111] The rule conversion request may include a rule description file, and the rule type of the rule description file may be a first rule type.
[0112] The rule conversion request may be used to request conversion of a first rule type of a rule description file into a second rule type.
[0113] For example, the first rule type may be a text rule, and the second rule type may be a decision tree.
[0114] S202: Perform a first conversion process on the rule description file through a first conversion model to obtain a first execution code.
[0115] A first conversion model corresponding to the first rule type may be obtained, and the first conversion model may be used to convert the rule description file into execution code.
[0116] A plurality of historical rules and an execution code corresponding to each historical rule may be obtained, and a first preset model may be trained using the plurality of historical rules and the execution code corresponding to each historical rule to obtain a first conversion model.
[0117] Among them, the rule type of each historical rule is the first rule type, and the execution code corresponding to each historical rule has the same code type. For example, the agent type can be python type, matrix laboratory (matlab) type and Java (Java) type, etc.
[0118] The code type of the first execution code may be a first code type.
[0119] S203: Determine target rule information according to the second conversion model and the first execution code.
[0120] The rule type of the target rule information is the second rule type.
[0121] A plurality of historical execution codes and rule information corresponding to each historical execution code may be obtained, and the first preset model may be trained by the plurality of historical execution codes and the rule information corresponding to each historical execution code to obtain a second conversion model.
[0122] The proxy type of the multiple historical execution codes may be a first code type, and the rule type of the rule information corresponding to each historical execution code may be a second rule type.
[0123] If the first code type of the first execution code is the same as the second code type of the input of the second conversion model, the first execution code may be converted by the second conversion model to obtain target rule information.
[0124] If the first code type of the first execution code is different from the second code type of the input of the second conversion model, the first execution code is translated to obtain the second execution code, the second execution code is of the second code type, and the second execution code is converted through the second conversion model to obtain the target rule information.
[0125] The rule type conversion method provided in the embodiment of the present application can convert the rule description file into a first execution program through a first conversion model, and convert the first execution program into target rule information through a second conversion model. There is no need for manual adaptation of the rule description file, which can improve the efficiency of rule conversion.
[0126] Figure 3 This is a flowchart of another rule type conversion method provided for this application. Figure 3 In this embodiment, Figure 2 Based on the embodiment, a method for converting rule types is described in detail, and the method may include:
[0127] S301: Receive a rule conversion request.
[0128] The execution process of S301 can refer to the execution process of S201, which will not be repeated here.
[0129] S302: Preprocess the rule description file to obtain first rule information.
[0130] Preprocessing can include word segmentation and whitespace removal.
[0131] Keywords corresponding to the first rule type corresponding to the rule description file may be obtained. For example, the keywords may be if, then, or no.
[0132] The rule description file can be preliminarily segmented by keywords, and then further optimized by statistical methods to obtain the first rule information.
[0133] S303: Obtain a first conversion model according to the rule conversion request.
[0134] S304: Perform a first conversion process on the first rule information through a first conversion model to obtain a first execution code.
[0135] Sequence-to-Sequence (Seq2Seq) learning is performed based on Transformer to obtain a first conversion model. For example, the first rule information may be text, and the first execution code may be Python code.
[0136] S305: Determine whether the first code type of the first execution code and the second code type of the input of the second conversion model are the same.
[0137] S306: If not, determine a code translation model according to the first code type and the second code type.
[0138] If the code types of the first execution code corresponding to the first conversion model and the input code corresponding to the second conversion model are different, the code type translation needs to be performed through the code translation model.
[0139] For example, assume that the first conversion model processes the rule description file (including general rules, decision tables, and rule flows), and the first execution code obtained is a python code type, while the second conversion model can process the execution code corresponding to the Java code type to obtain the target rule information, so it is necessary to translate the python type execution code into the Java code type.
[0140] A code translation model corresponding to the first code type and the second code type may be obtained, and the code translation model may convert a first execution code of the first code type into a second execution code of the first code type.
[0141] S307: Using a code translation model, translate the first execution code to obtain a second execution code.
[0142] The first execution code may be input into a code translation model, and the output of the code translation model may be determined as the second execution code.
[0143] S308: Perform conversion processing on the second execution code through the second conversion model to obtain target rule information.
[0144] The input of the second conversion model is the second execution code, and the output is the target rule information, wherein the target rule information may be a natural language, for example, the target rule information may be “if the user is older than 18 years old, then the purchase of adult tickets is allowed”.
[0145] S309: Verify the target rule information through the rule description file to obtain a comparative analysis result.
[0146] The rule description file and the target rule information correspond to different rule types, but have the same processing logic. For example, it is assumed that the rule description file can be a decision table, and the target rule information can be a rule text.
[0147] The same information to be verified can be processed by the rule description file and the target rule information respectively to obtain a first verification result corresponding to the rule description file and a first verification result corresponding to the target rule information.
[0148] Parameter information can be determined based on the rule description file, and information to be verified can be generated based on the parameter information. Based on the information to be verified, a first verification result corresponding to the rule description file and a second verification result corresponding to the target rule information can be determined, and the first verification result and the second verification result can be compared and analyzed to obtain a comparative analysis result.
[0149] The parameter information may include multiple features and a parameter range corresponding to each feature.
[0150] The information to be verified may include a parameter corresponding to at least one feature, and the parameter is within the parameter range corresponding to the feature. The first verification result may include a first verification option corresponding to each feature, and the second verification result may include a second verification option corresponding to each feature.
[0151] The first verification result and the second verification result can be determined in the following manner: deploy a source rule engine corresponding to the rule description file and a destination rule engine corresponding to the target rule information; perform data processing on the information to be verified by the source rule engine to obtain the first verification result; perform data processing on the information to be verified by the destination rule engine to obtain the second verification result.
[0152] The source rule engine and the destination rule engine have the same rule logic.
[0153] The information to be verified can be input into the source rule engine to obtain a first verification result; the information to be verified can be input into the destination rule engine to obtain a second verification result.
[0154] S310: According to the comparison and analysis result, the first conversion model is optimized to obtain an updated first conversion model, and the second conversion model is optimized to obtain an updated second conversion model.
[0155] The first verification option and the second verification option corresponding to each feature may be compared and analyzed to obtain a comparison analysis result, and the comparison analysis result may include a comparison result corresponding to each feature.
[0156] If there are different comparison results in the comparison analysis results, the first conversion model and the second conversion model are optimized to obtain an updated first conversion model and an updated second conversion model.
[0157] If the comparison results in the comparative analysis results are the same, the first verification result is the same as the first verification result, then the accuracy of converting the rule description file into the target rule information is high, and there is no need to adjust the first conversion model and the second conversion model. The first conversion model and the second conversion model are directly used for the next rule type conversion.
[0158] For ease of understanding, Figure 4 A schematic diagram of a rule type conversion method provided in an embodiment of the present application. Figure 4 , including a first conversion model, a code translation model and a second conversion model. The first conversion model can convert a rule description file into a first execution code, the code translation model can translate the first execution code into a second execution code, and the second conversion model can convert the second execution code into target rule information. It can realize the conversion of a rule description file of a first rule type into target rule information of a second rule type.
[0159] The rule type conversion method provided in the embodiment of the present application can convert the rule description file into the first execution program through the first conversion model, and convert the first execution program into the target rule information through the second conversion model, without the need for manual adaptation processing of the rule description file, which can improve the efficiency of rule conversion. In addition, the comparative analysis results can be determined, and the conversion results can be verified according to the comparative analysis results to improve the accuracy of type conversion.
[0160] Figure 5 A flowchart of determining a code translation model provided in an embodiment of the present application. Figure 5 , the method may include:
[0161] S501. Obtain multiple test questions.
[0162] Multiple test questions can be randomly selected from the open source question bank.
[0163] S502. Process multiple test questions through the first large model to obtain an initial input code corresponding to each test question, and process multiple test questions through the second large model to obtain an initial output code corresponding to each test question.
[0164] If the code translation model is used to translate a first code type of a first execution code into a second execution code of a second code type, the initial input code is of the first code type, and the initial output code is of the second code type.
[0165] For any test question, a first prompt text corresponding to the test question can be determined, and the first prompt text is input into the first large model to obtain an initial input code.
[0166] For any test question, the second prompt text corresponding to the test question can be determined, and the second prompt text is input into the second largest model to obtain an initial output code.
[0167] For example, assuming that there are 20 test questions, namely test questions 1-20, then it can be determined that the initial input code and the initial output code corresponding to each test question can be as shown in Table 1.
[0168] Table 1
[0169] Test questions Initial input code Initial output code Test Question 1 Initial input code 1 Initial output code 1 Test Question 2 Initial input code 2 Initial output code 2 …… …… …… Test Question 20 Initial input code 20 Initial output code 20
[0170] S503: Determine difference values corresponding to a plurality of initial input codes and a plurality of initial output codes.
[0171] The time complexity and space complexity of each initial input code, as well as the time complexity and space complexity of each initial output code can be determined; a first difference value between the time complexity of each initial input code and the time complexity of each initial output code can be determined; and a second difference value between the space complexity of each initial input code and the space complexity of each initial output code can be determined.
[0172] The difference value may include a first difference value and a second difference value, the first difference value may be used to describe the mean difference in time complexity between multiple initial input codes and multiple initial input codes, and the second difference value may be used to describe the mean difference in space complexity between multiple initial input codes and multiple initial input codes.
[0173] Among them, space complexity can be used to refer to the size of the storage space temporarily occupied by the code during execution; time complexity can be determined by analyzing the relationship between the number of executions of basic operations in the code and the input size.
[0174] S504: If the difference value is less than or equal to the preset value, the initial input code and the initial output code corresponding to each test question are determined as the target input code and the target output code corresponding to each training sample.
[0175] The training sample may include a target input code and a target output code, the target input code may be a first code type, and the target output code may be a second code type.
[0176] If the difference value is greater than the preset value, the first prompt text and the second prompt text corresponding to each test question can be adjusted, and the initial input code and the initial output code corresponding to each test question can be re-determined until the difference value is less than or equal to the preset value, so as to improve the accuracy of multiple training samples and thereby improve the effectiveness of the code translation model translation.
[0177] If the difference value includes a first difference value and a second difference value, the difference value being less than or equal to the preset value may mean that the first difference value is less than or equal to the first preset value, and the second difference value is less than or equal to the second preset value.
[0178] S505: training the preset model through multiple training samples to obtain a code translation model.
[0179] The rule type conversion method provided in the embodiment of the present application can determine the difference between the initial input code and the initial output code corresponding to each test question, determine multiple training samples, and obtain a code translation model through multiple training samples, which can improve the effectiveness of the code translation model translation and thereby improve the accuracy of rule conversion.
[0180] Figure 6 This is a schematic diagram of the architecture of a rule type conversion method provided in an embodiment of the present application. Figure 6 , a rule conversion request may be received, the rule conversion request may include a rule description file, the rule description file may be preprocessed to obtain first rule information, a first conversion model may be determined, and the first rule information may be subjected to a first conversion process by the first conversion model to obtain a first execution code. A second conversion model may be obtained, and it may be determined whether a first code type of the first execution code is the same as a second code type corresponding to the second conversion model. If so, a second conversion process is performed on the first execution code by the second conversion model to obtain target rule information.
[0181] If not, a code translation model is determined according to the first code type and the second code type, and the first execution code can be translated into a second execution code through the code translation model, and the code type of the second execution code is the second code type. The second execution code is converted by the second conversion model to obtain target rule information.
[0182] Figure 7 The present invention provides a schematic diagram of a structure of a rule type conversion device. Figure 7The rule type conversion device 10 may include a receiving module 11, a conversion module 12 and a determination module 13:
[0183] The receiving module 11 is used to receive a rule conversion request, the rule conversion request includes a rule description file, and the rule type of the rule description file is a first rule type;
[0184] The conversion module 12 is used to perform a first conversion process on the rule description file through a first conversion model to obtain a first execution code, and the code type of the first execution code is a first code type;
[0185] The determination module 13 is used to determine target rule information according to the second conversion model and the first execution code, and the rule type of the target rule information is the second rule type.
[0186] The rule type conversion provided in this embodiment can execute the method provided in the above method embodiment, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.
[0187] In a possible implementation manner, the determination module 13 is specifically configured to:
[0188] Determine whether a first code type of the first execution code and a second code type of the input of the second conversion model are the same;
[0189] If not, the first execution code is translated to obtain a second execution code, the code type of the second execution code is a second code type, and the second execution code is converted through a second conversion model to obtain target rule information.
[0190] In a possible implementation manner, the determination module 13 is specifically configured to:
[0191] Determining a code translation model according to the first code type and the second code type;
[0192] The first execution code is translated through a code translation model to obtain a second execution code.
[0193] In a possible implementation manner, the determination module 13 is specifically configured to:
[0194] Acquire multiple training samples, the training samples include a target input code and a target output code, the target input code is a first code type, and the target output code is a second code type;
[0195] The preset model is trained through multiple training samples to obtain a code translation model.
[0196] In a possible implementation manner, the determination module 13 is specifically configured to:
[0197] Get multiple test questions;
[0198] Processing multiple test questions through the first large model to obtain an initial input code corresponding to each test question, and processing multiple test questions through the second large model to obtain an initial output code corresponding to each test question;
[0199] Determining difference values corresponding to a plurality of initial input codes and a plurality of initial output codes;
[0200] If the difference value is less than or equal to the preset value, the initial input code and initial output code corresponding to each test question are determined as the target input code and target output code corresponding to each training sample.
[0201] In a possible implementation manner, the difference value includes a first difference value and a second difference value; and the determination module 13 is specifically configured to:
[0202] Determine the time complexity and space complexity of each initial input code, and the time complexity and space complexity of each initial output code;
[0203] Determining a first difference value between the time complexity of each initial input code and the time complexity of each initial output code;
[0204] A second difference value between the space complexity of each initial input code and the space complexity of each initial output code is determined.
[0205] In a possible implementation manner, the conversion processing module 12 is specifically configured to:
[0206] Preprocessing the rule description file to obtain first rule information, the preprocessing including word segmentation and blank character removal;
[0207] According to the rule conversion request, a first conversion model is obtained, where the first conversion model is used to convert the rule into an execution code;
[0208] The first rule information is subjected to a first conversion process through a first conversion model to obtain a first execution code.
[0209] In a possible implementation, it further includes a verification processing module 14 and an optimization processing module 15:
[0210] The verification processing module 14 is used to verify the target rule information through the rule description file to obtain a comparison analysis result.
[0211] The optimization processing module 15 is used to optimize the first conversion model according to the comparison and analysis results to obtain an updated first conversion model, and optimize the second conversion model to obtain an updated second conversion model.
[0212] In a possible implementation, the verification processing module 14 is specifically used to:
[0213] Determine the information to be verified corresponding to the rule description file;
[0214] Determine, according to the information to be verified, a first verification result corresponding to the rule description file and a second verification result corresponding to the target rule information;
[0215] The first verification result and the second verification result are compared and analyzed to obtain a comparison analysis result.
[0216] In a possible implementation, the verification processing module 14 is specifically used to:
[0217] Determine parameter information according to the rule description file, where the parameter information includes multiple features and a parameter range corresponding to each feature;
[0218] Generate the information to be verified based on the parameter information.
[0219] In a possible implementation, the verification processing module 14 is specifically used to:
[0220] Deploy the source rule engine corresponding to the rule description file and the destination rule engine corresponding to the target rule information, where the source rule engine and the destination rule engine have the same rule logic;
[0221] Performing data processing on the information to be verified by a source rule engine to obtain a first verification result;
[0222] The target rule engine performs data processing on the information to be verified to obtain a second verification result.
[0223] The rule type conversion provided in this embodiment can execute the method provided in the above method embodiment, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.
[0224] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 The electronic device 20 may include a processor 21 and a memory 22. Exemplarily, the processor 21 and the memory 22 are interconnected via a bus 23.
[0225] The memory 22 stores computer executable instructions;
[0226] The processor 21 executes the computer-executable instructions stored in the memory 22, so that the processor 21 executes the rule type conversion method shown in the above method embodiment.
[0227] Accordingly, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the rule type conversion method of the above method embodiment.
[0228] Accordingly, an embodiment of the present application may also provide a computer program product, including a computer program, which, when executed by a processor, may implement the rule type conversion method shown in the above method embodiment.
[0229] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0230] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0231] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0232] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0233] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0234] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0235] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0236] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0237] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A rule type conversion method, characterized in that: include: receiving a rule conversion request, wherein the rule conversion request includes a rule description file, and the rule type of the rule description file is a first rule type; Performing a first conversion process on the rule description file through a first conversion model to obtain a first execution code, wherein the code type of the first execution code is a first code type; According to the second conversion model and the first execution code, target rule information is determined, and the rule type of the target rule information is a second rule type.
2. The method according to claim 1, characterized in that Determining target rule information according to the second conversion model and the first execution code includes: Determining whether a first code type of the first execution code and a second code type of an input of the second conversion model are the same; If not, the first execution code is translated to obtain a second execution code, the code type of the second execution code is a second code type, and the second execution code is converted by the second conversion model to obtain the target rule information.
3. The method according to claim 2, characterized in that Translating the first execution code to obtain a second execution code includes: Determining a code translation model according to the first code type and the second code type; The first execution code is translated by the code translation model to obtain the second execution code.
4. The method according to claim 3, characterized in that Determining a code translation model according to the first code type and the second code type includes: Acquire a plurality of training samples, wherein the training samples include a target input code and a target output code, wherein the target input code is of the first code type, and the target output code is of the second code type; The preset model is trained using the multiple training samples to obtain the code translation model.
5. The method according to claim 4, characterized in that Get multiple training samples, including: Get multiple test questions; Processing the plurality of test questions through the first large model to obtain an initial input code corresponding to each test question, and processing the plurality of test questions through the second large model to obtain an initial output code corresponding to each test question; Determining difference values corresponding to a plurality of initial input codes and a plurality of initial output codes; If the difference value is less than or equal to a preset value, the initial input code and the initial output code corresponding to each test question are determined as the target input code and the target output code corresponding to each training sample.
6. The method according to claim 5, characterized in that The difference value includes a first difference value and a second difference value; Determine the difference value corresponding to each initial input code and each initial output code, including: Determine the time complexity and space complexity of each initial input code, and the time complexity and space complexity of each initial output code; Determine a first difference value between the time complexity of each of the initial input codes and the time complexity of each of the initial output codes; A second difference value between the space complexity of each of the initial input codes and the space complexity of each of the initial output codes is determined.
7. The method according to any one of claims 1 to 6, characterized in that: The rule description file is subjected to a first conversion process by using a first conversion model to obtain a first execution code, including: Preprocessing the rule description file to obtain first rule information, wherein the preprocessing includes word segmentation processing and blank character removal processing; According to the rule conversion request, obtaining the first conversion model, where the first conversion model is used to convert the rule into execution code; The first conversion model is used to perform a first conversion process on the first rule information to obtain the first execution code.
8. The method according to any one of claims 1 to 7, characterized in that: Also includes: Verifying the target rule information through the rule description file to obtain a comparative analysis result; According to the comparison and analysis results, the first conversion model is optimized to obtain an updated first conversion model, and the second conversion model is optimized to obtain an updated second conversion model.
9. The method according to claim 8, characterized in that The target rule information is verified through the rule description file to obtain comparative analysis results, including: Determine the information to be verified corresponding to the rule description file; Determine, according to the information to be verified, a first verification result corresponding to the rule description file and a second verification result corresponding to the target rule information; The first verification result and the second verification result are compared and analyzed to obtain a comparison analysis result.
10. The method according to claim 9, characterized in that Determining the information to be verified corresponding to the rule description file includes: Determine parameter information according to the rule description file, where the parameter information includes multiple features and a parameter range corresponding to each feature; The information to be verified is generated according to the parameter information.
11. The method according to claim 9, characterized in that Determining, according to the information to be verified, a first verification result corresponding to the rule description file and a second verification result corresponding to the target rule information, including: Deploy a source rule engine corresponding to the rule description file and a destination rule engine corresponding to the target rule information, wherein the source rule engine and the destination rule engine have the same rule logic; Performing data processing on the information to be verified by the source rule engine to obtain the first verification result; The purpose rule engine performs data processing on the information to be verified to obtain the second verification result.
12. A rule type conversion device, characterized in that: Including receiving module, conversion module and determination module: The receiving module is used to receive a rule conversion request, wherein the rule conversion request includes a rule description file, and the rule type of the rule description file is a first rule type; The conversion module is used to perform a first conversion process on the rule description file through a first conversion model to obtain a first execution code, wherein the code type of the first execution code is a first code type; The determination module is used to determine target rule information according to the second conversion model and the first execution code, and the rule type of the target rule information is the second rule type.
13. An electronic device, characterized in that: include: Memory and processor, The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the rule type conversion method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the rule type conversion method described in any one of claims 1 to 11.
15. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the rule type conversion method according to any one of claims 1 to 11 is implemented.