Data generation method, device, electronic device and storage medium
Through multi-step processing from the sample table to the target table, table formulas and demand expressions are generated, which solves the problems of scarcity and high cost of training data in the existing technology, realizes efficient batch generation of table formulas and demand expressions, and is suitable for large languages Model training.
Patent Information
- Application Number
- CN202410673407.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-05-28
AI Technical Summary
In the existing technology, there is less public training data for table formula generation, and there are many types of demand expressions and corresponding table formulas, resulting in high human annotation costs, and there is an urgent need for batch generation through reasonable methods.
By obtaining the sample table, determine the sample function, generate the sample table formula and demand expression, perform abstract processing, generate the abstract table formula and demand expression, and finally perform nesting processing based on the target table to generate target table formulas and demand expressions in batches.
It reduces the cost of human annotation, improves the efficiency of batch generation of table formulas and demand expressions, saves resources, and is suitable for the generation of training data for large language models.
Smart Images

Figure CN118261120B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data generation method, device, electronic device and storage medium. Background Art
[0002] At present, spreadsheet software (Excel) is gradually being used by people due to its powerful data visualization and analysis capabilities. Among them, table formulas are very powerful tools in spreadsheet software, which can be used to solve various mathematical, statistical, logical, text, date and time problems, and can help users better process and analyze data.
[0003] However, as a very powerful tool in spreadsheet software, table formulas have a certain usage threshold for many users. For this reason, the big language model is introduced, and users can enter the demand expression in natural language, and the natural language demand expression can be converted into the corresponding table formula. But before this, the big language model needs to be trained.
[0004] In the related art, there is little public training data for generating table formulas, that is, public demand statements and corresponding table formulas, and the demand statements and corresponding table formulas are diverse. If they are directly labeled manually (that is, based on example tables, manually writing demand statements and corresponding table formulas), the cost will be high. Therefore, there is an urgent need for batch generation through reasonable methods. Summary of the invention
[0005] In order to solve the above-mentioned public training data for table formula generation based on tables, that is, there are few public demand statements and corresponding table formulas, and the demand statements and corresponding table formulas are diverse. If manual annotation is directly used (that is, based on the example table, the demand statements and corresponding table formulas are manually written), the cost is high, so it is urgent to use a reasonable method to generate batches of technical problems. The embodiment of the present application provides a data generation method, device, electronic device and storage medium. The specific technical solution is as follows:
[0006] In a first aspect of an embodiment of the present application, a data generation method is first provided, the method comprising:
[0007] Obtain at least one example table, and for any of the example tables, determine an example function corresponding to the example table;
[0008] Generate an example table formula according to the example table and the example function, and determine an example requirement statement according to the example table formula;
[0009] Performing a first process on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement;
[0010] According to the target table, the abstract table formula and the abstract requirement statement are subjected to a second process to generate a target table formula and a target requirement statement.
[0011] In an optional implementation, for any of the example tables, determining an example function corresponding to the example table includes:
[0012] For any of the example tables, determine the example scenario corresponding to the example table, and obtain a corresponding relationship between a preset scenario and a function;
[0013] According to the corresponding relationship, a function corresponding to the example scenario is determined, and the function is determined as an example function corresponding to the example table.
[0014] In an optional implementation, generating an example table formula according to the example table and the example function includes:
[0015] Constructing a function application expression of the example function, and performing structural processing on the example table to obtain structural information of the example table;
[0016] A first prompt for constructing a pre-trained large language model using the function application representation and the structured information;
[0017] The first prompt is input into the pre-trained large language model to obtain an example table formula.
[0018] In an optional implementation, determining the example requirement statement according to the example table formula includes:
[0019] Performing structural processing on the example table to obtain structural information of the example table;
[0020] A second prompt for constructing a pre-trained large language model using the example table formula and the structured information;
[0021] The second prompt is input into the pre-trained large language model to obtain a formula interpretation of the example table formula, and the formula interpretation is determined as an example requirement statement.
[0022] In an optional implementation, the first processing of the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement includes:
[0023] Extracting example parameters in an example function of the example table formula;
[0024] According to the example parameters, a first processing is performed on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement.
[0025] In an optional implementation, the first processing of the example table formula and the example requirement statement according to the example parameters to generate an abstract table formula and an abstract requirement statement includes:
[0026] According to the example parameters, the following first processing is performed on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement:
[0027] Determine, from the example parameters, a first example parameter representing an address of a cell in the example table, and search for a first abstract parameter corresponding to the first example parameter;
[0028] Determine a first entity in the example requirement statement, replace the first example parameter with the first abstract parameter, and replace the first entity with the first abstract parameter;
[0029] Determine, from the example parameters, a second example parameter that does not represent an address of a cell in the example table, and search for a second abstract parameter corresponding to the second example parameter;
[0030] Determine a second entity in the example requirement statement, replace the second example parameter with the second abstract parameter, and replace the second entity with the second abstract parameter;
[0031] Determine the example table formula after replacing the first example parameter and the second example parameter as an abstract table formula;
[0032] The example requirement statement after replacing the first entity and the second entity is determined as an abstract requirement statement.
[0033] In an optional implementation, determining the first entity in the example requirement statement includes:
[0034] Determine an example column corresponding to the address of the cell, and obtain an example column title of the example column;
[0035] From the example requirement statement, find a first entity that matches the example column heading.
[0036] In an optional implementation, the determining the second entity in the example requirement statement includes:
[0037] A second entity matching the second example parameter is searched from the example requirement expression.
[0038] In an optional embodiment, the method further comprises:
[0039] Acquire an example column type of the example column, and establish a first correspondence between the first abstract parameter, the first entity, and the example column type;
[0040] A second corresponding relationship between the second abstract parameter and the second entity is established, and a parameter list is constructed by the first corresponding relationship and the second corresponding relationship.
[0041] In an optional implementation, the second processing of the abstract table formula and the abstract requirement expression according to the target table to generate the target table formula and the target requirement expression includes:
[0042] From the target table, determine a target column whose column type is consistent with the example column type, and obtain a target address of a target cell in the target column;
[0043] Generate a third entity, replace the first abstract parameter in the abstract table formula with the target address, replace the second abstract parameter in the abstract table formula with the third entity, and generate a target table formula;
[0044] The target column title of the target column is obtained, the first abstract parameter in the abstract requirement statement is replaced with the target column title, the second abstract parameter in the abstract requirement statement is replaced with the third entity, and a target requirement statement is generated.
[0045] In an optional embodiment, the method further comprises:
[0046] Determine the semantic fluency of the target requirement expression, and determine whether the difference between the semantic fluency and a preset value is less than a preset difference threshold;
[0047] When the target table executes the target table formula, detecting whether the execution result of the target table formula is normal;
[0048] Determine the target function in the target table formula, the target parameter corresponding to the target function, and the template function matching the target function;
[0049] Determine a third corresponding relationship between the target function and the target parameter, and a fourth corresponding relationship between the template function and the template parameter in the template function, and detect whether the third corresponding relationship is consistent with the fourth corresponding relationship;
[0050] When the difference between the semantic fluency and the preset value is less than the preset difference threshold, the execution result of the target table formula is normal, and the third correspondence is consistent with the fourth correspondence, the data pair consisting of the target table formula and the target demand statement is retained.
[0051] In an optional embodiment, the method further comprises:
[0052] Detecting whether there is a fourth entity representing time from the entities expressed by the target requirement;
[0053] In the case where the fourth entity exists, the fourth entity is enhanced according to a time-based enhancement method to obtain an enhanced target demand expression;
[0054] A new data pair is composed of the target table formula and the enhanced target requirement expression.
[0055] In an optional embodiment, the method further comprises:
[0056] Determine a synonym for the fifth entity in the target requirement statement, replace the fifth entity with the synonym, and obtain an enhanced target requirement statement;
[0057] A new data pair is composed of the target table formula and the enhanced target requirement expression.
[0058] In an optional embodiment, the method further comprises:
[0059] Determine a homophone of a sixth entity in the target demand statement, and replace the sixth entity with the homophone to obtain an enhanced target demand statement;
[0060] A new data pair is composed of the target table formula and the enhanced target requirement expression.
[0061] In a second aspect of the embodiments of the present application, a data generating device is further provided, the device comprising:
[0062] An example table acquisition module, used to acquire at least one example table;
[0063] An example function determination module, used for determining, for any of the example tables, an example function corresponding to the example table;
[0064] A table formula generating module, used for generating an example table formula according to the example table and the example function;
[0065] A table formula interpretation module, used to determine an example requirement statement according to the example table formula;
[0066] A formula and requirement first processing module, used for performing a first processing on the example table formula and the example requirement expression to generate an abstract table formula and an abstract requirement expression;
[0067] The formula and requirement second processing module is used to perform a second processing on the abstract table formula and the abstract requirement statement according to the target table to generate the target table formula and the target requirement statement.
[0068] In an optional implementation, the example function determination module is specifically used to:
[0069] For any of the example tables, determine the example scenario corresponding to the example table, and obtain a corresponding relationship between a preset scenario and a function;
[0070] According to the corresponding relationship, a function corresponding to the example scenario is determined, and the function is determined as an example function corresponding to the example table.
[0071] In an optional implementation, the table formula generation module is specifically used to:
[0072] Constructing a function application expression of the example function, and performing structural processing on the example table to obtain structural information of the example table;
[0073] A first prompt for constructing a pre-trained large language model using the function application representation and the structured information;
[0074] The first prompt is input into the pre-trained large language model to obtain an example table formula.
[0075] In an optional implementation, the table formula interpretation module is specifically used for:
[0076] Performing structural processing on the example table to obtain structural information of the example table;
[0077] A second prompt for constructing a pre-trained large language model using the example table formula and the structured information;
[0078] The second prompt is input into the pre-trained large language model to obtain a formula interpretation of the example table formula, and the formula interpretation is determined as an example requirement statement.
[0079] In an optional implementation, the formula and the first processing module specifically include:
[0080] A parameter extraction submodule, used for extracting example parameters in the example function of the example table formula;
[0081] The formula and requirement first processing submodule is used to perform a first processing on the example table formula and the example requirement statement according to the example parameters to generate an abstract table formula and an abstract requirement statement.
[0082] In an optional implementation, the formula and requirement first processing submodule specifically include:
[0083] A first processing unit is configured to perform the following first processing on the example table formula and the example requirement statement according to the example parameters to generate an abstract table formula and an abstract requirement statement:
[0084] A first parameter searching unit, configured to determine, from the example parameters, a first example parameter representing an address of a cell in the example table, and to search for a first abstract parameter corresponding to the first example parameter;
[0085] A first entity determining unit, configured to determine a first entity in the example requirement statement;
[0086] A first parameter replacing unit, configured to replace the first example parameter with the first abstract parameter, and replace the first entity with the first abstract parameter;
[0087] A second parameter searching unit, configured to determine, from the example parameters, a second example parameter that does not represent an address of a cell in the example table, and to search for a second abstract parameter corresponding to the second example parameter;
[0088] A second entity determining unit, configured to determine a second entity in the example requirement statement;
[0089] A second parameter replacing unit, configured to replace the second example parameter with the second abstract parameter, and replace the second entity with the second abstract parameter;
[0090] A formula determination unit, configured to determine the example table formula after replacing the first example parameter and the second example parameter as an abstract table formula;
[0091] The expression determination unit is used to determine the example requirement expression after replacing the first entity and the second entity as an abstract requirement expression.
[0092] In an optional implementation, the first entity determination unit is specifically configured to:
[0093] Determine an example column corresponding to the address of the cell, and obtain an example column title of the example column;
[0094] From the example requirement statement, find a first entity that matches the example column heading.
[0095] In an optional implementation manner, the second entity determination unit is specifically configured to:
[0096] A second entity matching the second example parameter is searched from the example requirement expression.
[0097] In an optional embodiment, the device further comprises:
[0098] A parameter list building module, used for obtaining an example column type of the example column, and establishing a first corresponding relationship between the first abstract parameter, the first entity, and the example column type;
[0099] A second corresponding relationship between the second abstract parameter and the second entity is established, and a parameter list is constructed by the first corresponding relationship and the second corresponding relationship.
[0100] In an optional implementation, the formula and the second processing module are specifically used to:
[0101] From the target table, determine a target column whose column type is consistent with the example column type, and obtain a target address of a target cell in the target column;
[0102] Generate a third entity according to the second entity, replace the first abstract parameter in the abstract table formula with the target address, and replace the second abstract parameter in the abstract table formula with the third entity to generate a target table formula;
[0103] The target column title of the target column is obtained, the first abstract parameter in the abstract requirement statement is replaced with the target column title, the second abstract parameter in the abstract requirement statement is replaced with the third entity, and a target requirement statement is generated.
[0104] In an optional embodiment, the device further comprises:
[0105] A formula and requirement quality inspection module, used to determine the semantic fluency of the target requirement expression, and to determine whether the difference between the semantic fluency and a preset value is less than a preset difference threshold;
[0106] When the target table executes the target table formula, detecting whether the execution result of the target table formula is normal;
[0107] Determine the target function in the target table formula, the target parameter corresponding to the target function, and the template function matching the target function;
[0108] Determine a third corresponding relationship between the target function and the target parameter, and a fourth corresponding relationship between the template function and the template parameter in the template function, and detect whether the third corresponding relationship is consistent with the fourth corresponding relationship;
[0109] When the difference between the semantic fluency and the preset value is less than the preset difference threshold, the execution result of the target table formula is normal, and the third correspondence is consistent with the fourth correspondence, the data pair consisting of the target table formula and the target demand statement is retained.
[0110] In an optional embodiment, the device further comprises:
[0111] A time enhancement module, used to detect whether there is a fourth entity representing time from the entities expressed by the target demand;
[0112] In the case where the fourth entity exists, the fourth entity is enhanced according to a time-based enhancement method to obtain an enhanced target demand expression;
[0113] A new data pair is composed of the target table formula and the enhanced target requirement expression.
[0114] In an optional embodiment, the device further comprises:
[0115] a synonym enhancement module, used to determine a synonym of the fifth entity in the target demand expression, and replace the fifth entity with the synonym to obtain an enhanced target demand expression;
[0116] A new data pair is composed of the target table formula and the enhanced target requirement expression.
[0117] In an optional embodiment, the device further comprises:
[0118] A homophone enhancement module, used to determine a homophone of a sixth entity in the target demand expression, and replace the sixth entity with the homophone to obtain an enhanced target demand expression;
[0119] A new data pair is composed of the target table formula and the enhanced target requirement expression.
[0120] In a third aspect of the embodiments of the present application, there is further provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0121] Memory, used to store computer programs;
[0122] The processor is used to implement any data generation method described in the first aspect when executing the program stored in the memory.
[0123] In a fourth aspect of the embodiments of the present application, a storage medium is further provided, wherein instructions are stored in the storage medium, and when the storage medium is run on a computer, the computer executes any of the data generation methods described in the first aspect above.
[0124] In a fifth aspect of the embodiments of the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the data generation methods described above.
[0125] The technical solution provided by the embodiment of the present application obtains at least one example table, and for any example table, determines the example function corresponding to the example table, generates an example table formula based on the example table and the example function, and determines an example requirement statement based on the example table formula, performs a first processing on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement, and performs a second processing on the abstract table formula and the abstract requirement statement based on the target table to generate a target table formula and a target requirement statement.
[0126] By determining the example function corresponding to the example table, generating an example table formula according to the example table and the example function, and determining an example requirement statement according to the example table formula, performing a first processing on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement, performing a second processing on the abstract table formula and the abstract requirement statement to generate a target table formula and a target requirement statement, the abstract table formula and the abstract requirement statement are first generated, and then the abstract table formula and the abstract requirement statement are subjected to a second processing, so that the target table formula and the target requirement statement can be generated in batches, thereby saving costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0127] 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.
[0128] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0129] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0130] Figure 1A schematic diagram of an implementation flow of a data generation method shown in an embodiment of the present application;
[0131] Figure 2 This is a schematic diagram of an implementation flow of another data generation method shown in an embodiment of the present application;
[0132] Figure 3 It is a schematic diagram of an implementation flow of a first data processing method shown in an embodiment of the present application;
[0133] Figure 4 It is a structural schematic diagram of a data generating device shown in an embodiment of the present application;
[0134] Figure 5 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0135] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0136] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0137] It should be noted that the table formulas involved in the embodiments of the present application actually refer to the function formulas in the table, such as the SUM function, the AVERAGE function, the VLOOKUP function, etc., which are different from the specific calculation formulas. For example, the calculation formula may be y=ax+b, and the table formula is different from this type of calculation formula.
[0138] like Figure 1 FIG. 1 is a schematic diagram of an implementation flow of a data generation method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0139] S101, obtaining at least one example table, and for any example table, determining an example function corresponding to the example table.
[0140] In an embodiment of the present application, different functions may be used for tables in different scenarios. For example, tables in financial scenarios and tables in educational scenarios may use different functions. In order to solve the scenario coverage problem, it is necessary to collect example tables for each scenario to form at least one example table for different scenarios.
[0141] Based on this, at least one example table of the above different scenarios can be obtained, each example table corresponds to a scenario, and each example table corresponds to a different scenario. And for any example table in at least one example table, it is necessary to determine the function corresponding to the example table, for example, determine the IF function corresponding to the example table. There can be multiple example functions.
[0142] S102, generating an example table formula according to the example table and the example function, and determining an example requirement statement according to the example table formula.
[0143] In an embodiment of the present application, for an example table and an example function corresponding to the example table, an example table formula can be generated based on the example table and the example function, which means that an example table formula using the example function is generated with reference to the example table.
[0144] In addition, for the example table formula, the example requirement statement can be determined according to the example table formula. In particular, the example table can be referenced and the example requirement statement can be determined according to the example table formula.
[0145] For example, the example table is a student performance table, and the example function is the IF function, thereby generating an example table formula "=IF(L2≥650, "Study Star", "")" using the IF function, and referring to the example table, determining the example requirement statement "Those with a total score of 650 or above are Study Stars" based on the example table formula.
[0146] S103, performing a first process on the example table formula and the example requirement expression to generate an abstract table formula and an abstract requirement expression.
[0147] In the embodiment of the present application, for the example table formula and the example requirement expression, the example table formula and the example requirement expression can be first processed to generate an abstract table formula and an abstract requirement expression.
[0148] It should be noted that the first processing is abstract processing, which means that the example parameters in the example table formula are replaced with abstract parameters, and the entities in the example requirement statement are replaced with abstract parameters. For example, if the abstract parameter is column_1, it means that the example parameter (L2) in the example table formula (=IF(L2≥650, "Learning Star", "")) is replaced with column_1, and the entity (total score) in the example requirement statement (the total score of 650 points or above is the Learning Star) is replaced with column_1. In this way, the example table formula and the example requirement statement are abstractly processed, the example parameters in the example table formula are replaced with abstract parameters, and the entities in the example requirement statement are replaced with abstract parameters, so that abstract table formulas and abstract requirement statements can be obtained. The abstract table formula and abstract requirement statement can be understood as template table formulas and template requirement statements, which is convenient for the subsequent second processing, that is, nested processing, to batch generate target table formulas and target requirement statements, saving costs.
[0149] Among them, the example parameters in the example table formula and the entities in the example requirement statement represent the same content to a certain extent. For example, the example parameters (L2, 650, Learning Star) in the example table formula (=IF(L2≥650, "Learning Star", "")) and the entity (Total Score, 650, Learning Star) in the example requirement statement (Study Star is a total score of 650 or above). It can be known that the example parameter (L2) refers to the cell address of the total score column in the student score table, which refers to the total score and represents the same content as the entity (Total Score). The same is true for the example parameter (650, Learning Star) and the entity (650, Learning Star).
[0150] After the above processing, for any example table in at least one example table, there is a corresponding abstract table formula and an abstract requirement expression, and the abstract table formula and the abstract requirement expression constitute a data pair, and the number of the data pairs can be multiple.
[0151] S104, performing a second process on the abstract table formula and the abstract requirement statement according to the target table to generate a target table formula and a target requirement statement.
[0152] In an embodiment of the present application, a target table can be obtained, the scenario of the target table is consistent with the scenario of the example table, so that the abstract table formula and the abstract requirement statement corresponding to the example table can be subjected to a second processing according to the target table to generate a target table formula and a target requirement statement, and the target table formula and the target requirement statement constitute a data pair, and the number of the data pairs can be multiple.
[0153] It should be noted that the second processing is nested processing. The so-called nested processing refers to replacing the abstract parameters in the abstract table formula with specific parameters, and replacing the abstract parameters in the abstract requirement statement with specific entities. For example, the abstract parameter is column_1, which means replacing column_1 in the abstract table formula with the specific parameter F2, and replacing column_1 in the abstract requirement statement with the specific entity total score. The abstract table formula and the abstract requirement statement share the same abstract parameters, which means that the abstract parameters in the abstract table formula and the abstract requirement statement are consistent.
[0154] Among them, for the example parameters, corresponding abstract parameters are generally set, so that the abstract parameters can be used to replace the corresponding example parameters in the example table formula to obtain the abstract table formula. Subsequently, for the specific parameters, they are similar to the example parameters and have similarities. You can refer to the correspondence between the example parameters and the abstract parameters, and use the specific parameters to replace the corresponding abstract parameters in the abstract table formula to obtain the target table formula.
[0155] For example, for the example parameter (L2), the corresponding abstract parameter (column_1) is set, so that the abstract parameter (column_1) can be used to replace the corresponding example parameter (L2) in the example table formula to obtain the abstract table formula. Subsequently, for the specific parameter F2, it is similar to the example parameter (L2). The example parameter (L2) refers to the cell address of the total score column in the student score table, and the specific parameter F2 refers to the cell address of the total score column in the student score table. Both refer to the total score (or total score). Referring to the correspondence between the example parameter (L2) and the abstract parameter (column_1), the specific parameter F2 is used to replace the corresponding abstract parameter (column_1) in the abstract table formula to obtain the target table formula.
[0156] Through the above description of the technical solution provided in the embodiment of the present application, at least one example table is obtained, and for any example table, an example function corresponding to the example table is determined, an example table formula is generated based on the example table and the example function, and an example requirement statement is determined based on the example table formula, a first processing is performed on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement, and a second processing is performed on the abstract table formula and the abstract requirement statement based on the target table to generate a target table formula and a target requirement statement.
[0157] By determining the example function corresponding to the example table, generating an example table formula according to the example table and the example function, and determining an example requirement statement according to the example table formula, performing a first processing on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement, performing a second processing on the abstract table formula and the abstract requirement statement to generate a target table formula and a target requirement statement, the abstract table formula and the abstract requirement statement are first generated, and then the abstract table formula and the abstract requirement statement are subjected to a second processing, so that the target table formula and the target requirement statement can be generated in batches, thereby saving costs.
[0158] The generated target table formula and target demand expression can be used as training data for the large language model, that is, the structured information of the target table and the target demand expression are used as the key, and the target table formula is used as the value, which is provided to the large language model for learning, that is, learning the key-value correspondence to achieve the training of the large language model. Later, in the spreadsheet software, the user can start the large language model, enter the demand expression of the natural demand, and input the structured information of the table currently displayed in the spreadsheet software and the demand expression of the natural demand into the large language model, and the large language model outputs the table formula and provides it to the user.
[0159] like Figure 2 FIG. 1 is a schematic diagram of an implementation flow of another data generation method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0160] S201, obtaining at least one example table, and for any example table, determining an example scenario corresponding to the example table, and obtaining a correspondence between a preset scenario and a function.
[0161] S202: Determine a function corresponding to the example scenario according to the corresponding relationship, and determine the function as an example function corresponding to the example table.
[0162] In an embodiment of the present application, different functions may be used for tables in different scenarios. For example, different functions may be used for tables in financial scenarios and tables in educational scenarios. In order to solve the scenario coverage problem, it is necessary to collect example tables for each scenario to form at least one example table for different scenarios, and the correspondence between scenarios and functions is pre-set.
[0163] Based on this, at least one example table of the above-mentioned different scenarios can be obtained. For any example table in at least one example table, the example scenario corresponding to the example table can be determined, and the correspondence between the preset scenario and the function can be obtained. According to the correspondence, the function corresponding to the example scenario can be determined, and the function can be determined as the example function corresponding to the example table.
[0164] For example, the correspondence between the scenarios and the functions is preset as shown in Table 1. For any example table in at least one example table, the example scenario corresponding to the example table can be determined: education. According to the correspondence between the scenarios and the functions shown in Table 1, the functions corresponding to the example scenario (education) can be determined: IF function, SUM function, AVERAGE function, and the IF function, SUM function, AVERAGE function, etc. are determined as example functions corresponding to the example table.
[0165]
[0166] Table 1
[0167] S203, constructing a function application expression of the example function, and performing structured processing on the example table to obtain structured information of the example table.
[0168] S204, the first prompt of constructing a pre-trained large language model using function application representation and structured information.
[0169] S205: Input the first prompt into the pre-trained large language model to obtain an example table formula.
[0170] In an embodiment of the present application, for an example table and an example function corresponding to the example table, a pre-trained large language model (which can be any current large language model) can generate a corresponding example table formula based on the example table and the example function.
[0171] To this end, a function application expression of the example function is constructed, and the example table is structured to obtain the structured information of the example table. The function application expression and the structured information are used to construct the first prompt of the pre-trained large language model, and the first prompt is input into the pre-trained large language model to obtain the example table formula.
[0172] The structured information of the example table generally refers to the title of the example table, the header of the example table, the content of the example table, etc. Structuring the example table is essentially to enable the pre-trained large language model to better understand the example table.
[0173] For example, construct a function application expression of an example function (IF function): based on the student score table (the title of the example table), use the IF function to generate a table formula, structure the example table, and obtain structured information such as the title, header, and content of the example table. Use the function application expression and structured information to construct the first prompt (prompt) of the pre-trained large language model, input the first prompt into the pre-trained large language model, and obtain the example table formula = IF (L2 ≥ 650, "Learning Star", "").
[0174] S206, a second prompt for constructing a pre-trained large language model using the example table formula and structured information.
[0175] S207, input the second prompt into the pre-trained large language model to obtain a formula interpretation of the example table formula, and determine the formula interpretation as an example requirement expression.
[0176] In an embodiment of the present application, for an example table formula, a pre-trained large language model can be used to interpret the example table formula based on the structured information of the example table, thereby generating an example requirement statement.
[0177] To this end, the second prompt of the pre-trained large language model is constructed using the example table formula and the structured information of the example table, the second prompt is input into the pre-trained large language model, the formula interpretation of the example table formula is obtained, and the formula interpretation is determined as the example requirement expression.
[0178] For example, the example table formula is =IF(L2≥650, "Learning Star", ""), and the second prompt of the pre-trained large language model is constructed using the example table formula and structured information such as the title, header, and content of the example table. The second prompt is input into the pre-trained large language model to obtain the formula interpretation of the example table formula: those with a total score of 650 or above are learning stars, and the formula interpretation is determined as the example requirement statement.
[0179] In addition, when a certain number of example table formulas and example requirement statements have accumulated, a translation model based on the example table formula to the example requirement statement can be trained, such as seq2seq (end-to-end neural network model), so that the example table formula and the structured information of the example table can be directly input into the translation model to obtain the example requirement statement.
[0180] S208, performing a first processing on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement.
[0181] In the embodiment of the present application, for the example table formula and the example requirement expression, the example table formula and the example requirement expression can be first processed to generate an abstract table formula and an abstract requirement expression.
[0182] Among them, example parameters in the example function of the example table formula can be extracted, and the example table formula and the example requirement statement are first processed according to the example parameters to generate an abstract table formula and an abstract requirement statement.
[0183] It should be noted that the example parameters in the example function of the example table formula can be extracted by means of a table formula parsing class, such as openpyxl.formula.tokenizer. The specific application of the table formula parsing class can refer to the prior art, and the embodiments of the present application will not be described one by one here.
[0184] The first process is abstract processing. The so-called abstract processing means that the example parameters in the example table formula are replaced with abstract parameters, and the entities in the example requirement statement are replaced with abstract parameters. To this end, the example table formula and the example requirement statement are abstracted according to the example parameters. The abstract processing process can be referred to Figure 3 As shown in the method. Figure 3 FIG. 1 is a schematic diagram of an implementation flow of a first data processing method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0185] S301, performing the following first processing on the example table formula and the example requirement statement according to the example parameters to generate an abstract table formula and an abstract requirement statement.
[0186] In an embodiment of the present application, for the example table formula and the example requirement statement, the first processing of the following steps S302 to S307 is performed according to the example parameters to obtain the final abstract table formula and the abstract requirement statement, that is, the template table formula and the template requirement statement.
[0187] S302: Determine a first example parameter representing an address of a cell in an example table from the example parameters, and search for a first abstract parameter corresponding to the first example parameter.
[0188] In an embodiment of the present application, for an example table formula, example parameters in an example function of the example table formula are extracted, and a first example parameter representing an address of a cell in the example table is determined from the extracted example parameters.
[0189] It should be noted that, for the example parameters, which include a first example parameter representing the address of a cell in the example table, and a second example parameter not representing the address of a cell in the example table, the address of the cell may be, for example, L2, which is not limited in the embodiment of the present application.
[0190] For example, the example table formula is =IF(L2≥650, "Learning Star", ""), and the example requirement is that those with a total score of 650 or above are Learning Stars. The example parameters in the example function of the example table formula are extracted through openpyxl.formula.tokenizer. These example parameters are specifically L2, 650, and Learning Star. And among these example parameters, the first example parameter L2 representing the address of the cell in the example table is determined. L2 is the address of the cell, which represents the cell in the Lth column and the second row in the example table.
[0191] In addition, in the embodiment of the present application, for the first example parameter, the first abstract parameter corresponding to the first example parameter can be searched. For example, the first example parameter is L2, which represents the address L2 of the cell in the example table, and the first abstract parameter column_1 corresponding to the first example parameter can be searched.
[0192] It should be noted that, for the example parameters, corresponding abstract parameters are defined according to the parameter type of the example parameters (for example, percentage, number, year, etc.). Therefore, for the first example parameter, the parameter type corresponding to the first example parameter can be determined, the abstract parameter corresponding to the parameter type can be found, and the abstract parameter can be determined as the first abstract parameter corresponding to the first example parameter.
[0193] S303, determine the first entity in the example requirement statement, replace the first example parameter with the first abstract parameter, and replace the first entity with the first abstract parameter.
[0194] In the embodiment of the present application, for the example requirement statement, the first entity in the example requirement statement can be determined, so that for the first entity in the example requirement statement, the first entity can be replaced by the first abstract parameter. In addition, for the first example parameter representing the address of the cell in the example table in the example table formula, the first example parameter can be replaced by the first abstract parameter.
[0195] Among them, for the example parameters, the first example parameter representing the address of the cell in the example table is included. The example column corresponding to the address of the cell is thereby determined, and the example column title of the example column is obtained. For the example requirement statement, the entity in the example requirement statement can be identified, so that the first entity matching the above example column title can be found in the example requirement statement, where the meaning of matching refers to the first entity consistent with the above example column title.
[0196] It should be noted that the example table is usually arranged vertically, so the above descriptions are all based on "columns", such as example columns and example column headers. Correspondingly, if the example table is arranged horizontally, the above "columns" can be replaced with "rows", such as example rows and example row headers, and the embodiments of the present application do not limit this.
[0197] For example, the first example parameter is L2, which represents the address L2 of the cell in the example table. The first abstract parameter column_1 corresponding to the first example parameter can be searched, and the example column corresponding to the cell address L2, that is, column L, can be determined, and the example column title of the example column, that is, the total score, can be obtained.
[0198] The example requirement statement is that the total score of 650 points and above is the Learning Star. Identify the entities in the example requirement statement, specifically the total score, 650, Learning Star, etc. From the example requirement statement, find the first entity that matches the above example column title (that is, the total score), that is, the total score.
[0199] The example table formula is =IF(L2≥650, "Learning Star", ""), in which the first example parameter (L2) representing the address of the cell in the example table is replaced with the first abstract parameter (column_1), and after the replacement it becomes =IF({ column_1}≥650, "Learning Star", "").
[0200] The example requirement is expressed as: Those with a total score of 650 or above are learning stars. The first entity (total score) is replaced with the first abstract parameter (column_1). After the replacement, it becomes {column_1}: Those with a total score of 650 or above are learning stars.
[0201] S304: Determine, from the example parameters, a second example parameter that does not represent an address of a cell in the example table, and search for a second abstract parameter corresponding to the second example parameter.
[0202] In an embodiment of the present application, for example parameters in an example function of an example table formula, a second example parameter that does not represent the address of a cell in the example table is determined from these example parameters, and a second abstract parameter corresponding to the second example parameter is searched.
[0203] For example, the example table formula is =IF(L2≥650, "Learning Star", ""), the example parameters in the example function of the example table formula are specifically L2, 650, Learning Star, determine the second example parameter that does not represent the address of the cell in the example table: 650, Learning Star, find the second abstract parameter corresponding to the second example parameter: value_1, change_name_1, 650 corresponds to value_1, and Learning Star corresponds to change_name_1.
[0204] It should be noted that, for the example parameters, corresponding abstract parameters are defined according to the parameter type of the example parameters (for example, percentage, number, year, etc.). Therefore, for the second actual parameter, the parameter type corresponding to the second example parameter can be determined, the abstract parameter corresponding to the parameter type can be found, and the abstract parameter can be determined as the second abstract parameter corresponding to the second example parameter.
[0205] S305, determining a second entity in the example requirement statement, replacing a second example parameter with a second abstract parameter, and replacing a second entity with the second abstract parameter.
[0206] In the embodiment of the present application, for the example requirement statement, the second entity in the example requirement statement is determined, so that for the second entity in the example requirement statement, the second example parameter can be replaced with the second abstract parameter. In addition, for the second example parameter in the example table formula that does not represent the address of the cell in the example table, the second example parameter can be replaced with the second abstract parameter.
[0207] Among them, a second entity matching the second example parameter is searched from the example requirement statement. Specifically, for the example requirement statement, an entity in the example requirement statement can be identified, so that a second entity matching the second example parameter can be searched in the example requirement statement, where matching means a second entity consistent with the second example parameter.
[0208] For example, the example requirement statement is that the total score of 650 points and above is the Learning Star. Identify the entities in the example requirement statement, specifically the total score, 650, Learning Star, etc., and find the second entity (650, Learning Star) that matches the above second example parameter (650, Learning Star) from the example requirement statement.
[0209] The example table formula is =IF(L2≥650, "Learning Star", ""), in which the second example parameter (650, Learning Star) that does not represent the address of a cell in the example table is replaced with the second abstract parameter (value_1, change_name_1), and after the replacement it becomes =IF(L2≥{ value_1}, "{change_name_1}", "").
[0210] The example requirement is expressed as: Those with a total score of 650 or above are learning stars. The second entity (650, learning star) is replaced with the second abstract parameter (value_1, change_name_1). After the replacement, those with a total score of {value_1} or above are {change_name_1}.
[0211] In addition, for the example table formula, the first example parameter (L2) representing the address of the cell in the example table is replaced with the first abstract parameter (column_1), and after the replacement, it becomes =IF({column_1}≥{value_1},"{change_name_1}",""). For the example requirement statement, the first entity (total score) is replaced with the first abstract parameter (column_1), and after the replacement, it becomes {column_1} with a score of {value_1} or above is {change_name_1}.
[0212] S306: Determine the example table formula after replacing the first example parameter and the second example parameter as an abstract table formula.
[0213] S307: Determine the example requirement statement after replacing the first entity and the second entity as an abstract requirement statement.
[0214] In an embodiment of the present application, for the example table formula, after the above-mentioned first processing, the first example parameter and the second example parameter therein can be replaced, so that the example table formula after replacing the first example parameter and the second example parameter can be determined as an abstract table formula.
[0215] Similarly, for the example requirement statement, after uploading the first processing, the first entity and the second entity therein can be replaced, so that the example requirement statement after replacing the first entity and the second entity can be determined as an abstract requirement statement.
[0216] In addition, after the example table formula and the example requirement statement are first processed to generate the abstract table formula and the abstract requirement statement, a parameter list can be constructed according to the example table, abstract parameters and entities in the example requirement statement, which can be used as middleware to perform a second processing on the abstract table formula and the abstract requirement statement.
[0217] Based on this, the example column type of the example column in the example table is obtained, and a first correspondence between the first abstract parameter and the first entity and the example column type is established. A second correspondence between the second abstract parameter and the second entity is established, and a parameter list is constructed by the first correspondence and the second correspondence. In addition, the column index, column sequence number, etc. of the example column in the example table can also be obtained to participate in the establishment of the first correspondence.
[0218] For example, obtain the example column type data of the example column in the example table, the column index L of the example column in the example table, and the column sequence number 5, thereby establishing a first correspondence between the first abstract parameter column_1 and the first entity total score, the example column type data, the column index L, and the column sequence number 5, as shown below:
[0219] "column_1":{"name":"Total score","type":"data","col_index":"L","col_num":"5"}.
[0220] The corresponding relationship between the second abstract parameter (value_1, change_name_1) and the second entity (650, learning star) is established as follows:
[0221] "change_name_1": "Learning Star".
[0222] "value_1": "650".
[0223] The parameter list is constructed by the first correspondence and the second correspondence, as shown below:
[0224] "column_1":{"name":"Total score","type":"data","col_index":"L","col_num":"5"};
[0225] "change_name_1": "Learning Star";
[0226] "value_1": "650".
[0227] S209: performing a second process on the abstract table formula and the abstract requirement statement according to the target table to generate a target table formula and a target requirement statement.
[0228] In an embodiment of the present application, a target table can be obtained, the scenario of the target table is consistent with the scenario of the example table, and the above-mentioned parameter list can be used as middleware. According to the target table, the abstract table formula and abstract requirement statement corresponding to the example table can be subjected to a second processing to generate the target table formula and target requirement statement.
[0229] Based on this, from the target table, determine the target column whose column type is consistent with the example column type recorded in the above parameter list, and obtain the target address of the target cell in the target column; generate the third entity according to the second entity recorded in the above parameter list, replace the first abstract parameter in the abstract table formula with the target address, replace the second abstract parameter in the abstract table formula with the third entity, and generate the target table formula; obtain the target column title of the target column, replace the first abstract parameter in the abstract requirement statement with the target column title, replace the second abstract parameter in the abstract requirement statement with the third entity, and generate the target requirement statement.
[0230] It should be noted that the target address of the target cell in the target column can be randomly obtained. In addition, according to the second entity recorded in the above parameter list, a third entity is randomly generated, wherein a third entity similar to the second entity can be randomly generated. For example, the second entity recorded in the above parameter list is a learning star, and a third entity similar to the second entity, i.e., a learning model, can be randomly generated, which is not limited in the embodiments of the present application.
[0231] For example, from the target table, determine the target column whose column type is consistent with the example column type (data) recorded in the above parameter list, randomly obtain the target address (F2) of the target cell in the target column, and randomly generate the third entity (550, Learning Model) according to the second entity (650, Learning Star) recorded in the above parameter list, replace the first abstract parameter (column_1) in the abstract table formula with the target address (F2), replace the second abstract parameter (value_1, change_name_1) in the abstract table formula with the third entity (550, Learning Model), and generate the target table formula, that is, =IF (F2≥550, "Learning Model", ""), obtain the target column title (total score) of the target column, replace the first abstract parameter (column_1) in the abstract requirement statement with the target column title (total score), replace the second abstract parameter (value_1, change_name_1) in the abstract requirement statement with the third entity (550, Learning Model), and generate the target requirement statement, that is, the total score of 550 points or above is the Learning Model.
[0232] In this way, the abstract table formula and the abstract demand expression are first generated, and then the abstract table formula and the abstract demand expression are subjected to a second processing, so that the target table formula and the target demand expression can be generated in batches, thereby saving costs.
[0233] In addition, the generated target table formula and target requirement expression need to be quality checked. Only after passing the quality check can they be used as training data for the large language model. To this end, it is necessary to pay attention to the semantic fluency of the target requirement expression and the grammatical legality of the target table formula.
[0234] Based on this, the semantic fluency of the target demand expression is determined, and it is judged whether the difference between the semantic fluency and a preset value (for example, 0) is less than a preset difference threshold. When the target table executes the target table formula, it is detected whether the execution result of the target table formula is normal, the target function in the target table formula, the target parameter corresponding to the target function, and the template function matching the target function are determined, the third correspondence between the target function and the target parameter, and the fourth correspondence between the template function and the template parameter in the template function are determined, and the third correspondence is detected to see whether it is consistent with the fourth correspondence. When the difference between the semantic fluency and the preset value is less than the preset difference threshold, the execution result of the target table formula is normal, and the third correspondence is consistent with the fourth correspondence, the data pair consisting of the target table formula and the target demand expression is retained, which can be used as training data for the large language model, that is, the structured information of the target table and the target demand expression are used as keys, and the target table formula is used as value, which are provided to the large language model for learning, that is, learning this key-value correspondence to achieve training of the large language model.
[0235] Among them, the semantic fluency of the target demand expression is evaluated by the semantic fluency evaluation model. Specifically, the target demand expression is input into the semantic fluency evaluation model to obtain a score, and the score is determined as the semantic fluency of the target demand expression. It should be noted that for the semantic fluency evaluation model, for example, it can be ngrams, masked BERT or KENLM, etc., its input is the sentence of the target demand expression, and the output is the score. Among them, there are two scoring functions, namely score and perplexity. For the score function, its value is negative. The larger the value, the higher the generation quality of the target demand expression. For the perplexity function, its value is positive. The smaller the value, the higher the generation quality of the target demand expression, which means that no matter which scoring function is used, the score approaches 0, which means that the generation quality of the target demand expression is higher and the target demand expression is available. Therefore, it is necessary to judge whether the difference between the semantic fluency and the preset value (for example, 0) is less than the preset difference threshold.
[0236] The quality inspection of the syntax legality of the target table formula usually involves executing the target table formula in the target table and checking whether the execution result of the target table formula is normal. If the execution result is normal, it means that the syntax of the target table formula is legal. For example, executing the target table formula =sum(1) and =sum() in the target table can get two different execution results. The former can be executed correctly, while the latter will report a corresponding error.
[0237] Another quality check for the grammatical legality of the target table formula is usually to check the correspondence between functions and parameters, which is essentially to check the correspondence between the types of functions and parameters. Since functions are exhaustive, a fourth correspondence between the types of template functions and template parameters in the template functions can be constructed. The table formula parsing class, such as openpyxl.formula.tokenizer, is used to parse the target table formula, output the target function and the target parameter corresponding to the target function, and check whether the third correspondence between the types of the target function and the target parameter falls into the fourth correspondence between the types of the template function and the template parameter in the template function constructed in advance. If so, it means that the syntax of the target table formula is legal.
[0238] In addition, in order to achieve the generalization of natural language, natural language enhancement processing is added to the automation process, including time enhancement, synonym enhancement, homophone enhancement, etc. To this end, the above enhancement processing can be performed on the target demand expression.
[0239] Among them, for time data, there are many formats, and it is necessary to use the conversion between formats for enhancement processing, generalize one type of time data to all supported time ranges; for time type comparative data, it can be generalized to the expression before or after a certain day or multiple time periods according to which day. To this end, from the entities of the target demand expression, detect whether there is a fourth entity representing time; if there is a fourth entity, enhance the fourth entity according to the time-based enhancement method to obtain the enhanced target demand expression; a new data pair is formed by the target table formula and the enhanced target demand expression. For example, "the number of orders before January 2023" can be enhanced to "the number of orders after January 2023" according to the time-based enhancement method.
[0240] For a sentence, multiple entities can be identified. Each entity usually has multiple synonyms. Replacing an entity in a sentence with a synonym can achieve generalization of the sentence without changing the meaning of the sentence. For example, "Extract the leftmost value of cell F4", replacing the entity "extract" with the synonym "take out" can change the sentence to "take out the leftmost value of cell F4", thus generalizing the expression without changing the meaning of the sentence. To this end, the synonym of the fifth entity in the target demand expression is determined, and the fifth entity is replaced with a synonym to obtain the enhanced target demand expression; a new data pair is composed of the target table formula and the enhanced target demand expression.
[0241] When users input the demand expression in natural language, some entities may be output in the same pronunciation but not what they want due to habit. In the case of no such occurrence, the table formula generation can also output correctly. This is inseparable from the homophone enhancement processing. When processing this task, some commonly used wrong homophones will be replaced as training data. In actual processing, the input information that users want can be correctly identified, and then the table formula can be correctly generated. To this end, the homophone of the sixth entity in the target demand expression is determined, and the sixth entity is replaced with a homophone to obtain the enhanced target demand expression; the target table formula and the enhanced target demand expression form a new data pair.
[0242] In addition, the target table formula and the enhanced target requirement expression are also subject to quality inspection. Only after passing the quality inspection can they be used as training data, that is, training data for training large language models. To this end, it is necessary to pay attention to the semantic fluency of the enhanced target requirement expression and the grammatical legality of the target table formula.
[0243] Based on this, the semantic fluency of the enhanced target demand expression is determined, and it is judged whether the difference between the semantic fluency and a preset value (for example, 0) is less than a preset difference threshold, the target table formula is executed in the target table, and it is detected whether the execution result of the target table formula is normal, the target function in the target table formula, the target parameter corresponding to the target function, and the template function matching the target function are determined, and the third correspondence between the target function and the target parameter is detected to see whether it is consistent with the fourth correspondence between the template function and the template parameter in the template function. When the difference between the semantic fluency and the preset value is less than the preset difference threshold, and the execution result of the target table formula is normal, and the third correspondence is consistent with the fourth correspondence, the data pair consisting of the target table formula and the enhanced target demand expression is retained, which can be used as training data for the large language model, that is, the structured information of the target table and the enhanced target demand expression are used as key, and the target table formula is used as value, which are provided to the large language model for learning, that is, learning this key-value correspondence to achieve training of the large language model.
[0244] Corresponding to the above method embodiment, the present application embodiment also provides a data generating device, such as Figure 4 As shown, the device may include: an example table acquisition module 410, an example function determination module 420, a table formula generation module 430, a table formula interpretation module 440, a formula and requirement first processing module 450, and a formula and requirement second processing module 460.
[0245] An example table acquisition module 410 is used to acquire at least one example table;
[0246] An example function determination module 420 is used to determine, for any of the example tables, an example function corresponding to the example table;
[0247] A table formula generating module 430, configured to generate an example table formula according to the example table and the example function;
[0248] A table formula interpretation module 440 is used to determine an example requirement statement according to the example table formula;
[0249] A formula and requirement first processing module 450 is used to perform a first processing on the example table formula and the example requirement expression to generate an abstract table formula and an abstract requirement expression;
[0250] The formula and requirement second processing module 460 is used to perform a second processing on the abstract table formula and the abstract requirement expression according to the target table to generate a target table formula and a target requirement expression.
[0251] In an optional implementation, the example function determination module is specifically used to:
[0252] For any of the example tables, determine the example scenario corresponding to the example table, and obtain a corresponding relationship between a preset scenario and a function;
[0253] According to the corresponding relationship, a function corresponding to the example scenario is determined, and the function is determined as an example function corresponding to the example table.
[0254] In an optional implementation, the table formula generation module is specifically used to:
[0255] Constructing a function application expression of the example function, and performing structural processing on the example table to obtain structural information of the example table;
[0256] A first prompt for constructing a pre-trained large language model using the function application representation and the structured information;
[0257] The first prompt is input into the pre-trained large language model to obtain an example table formula.
[0258] In an optional implementation, the table formula interpretation module is specifically used for:
[0259] Performing structural processing on the example table to obtain structural information of the example table;
[0260] A second prompt for constructing a pre-trained large language model using the example table formula and the structured information;
[0261] The second prompt is input into the pre-trained large language model to obtain a formula interpretation of the example table formula, and the formula interpretation is determined as an example requirement statement.
[0262] In an optional implementation, the formula and the first processing module specifically include:
[0263] A parameter extraction submodule, used for extracting example parameters in the example function of the example table formula;
[0264] The formula and requirement first processing submodule is used to perform a first processing on the example table formula and the example requirement statement according to the example parameters to generate an abstract table formula and an abstract requirement statement.
[0265] In an optional implementation, the formula and requirement first processing submodule specifically include:
[0266] A first processing unit is configured to perform the following first processing on the example table formula and the example requirement statement according to the example parameters to generate an abstract table formula and an abstract requirement statement:
[0267] A first parameter searching unit, configured to determine, from the example parameters, a first example parameter representing an address of a cell in the example table, and to search for a first abstract parameter corresponding to the first example parameter;
[0268] A first entity determining unit, configured to determine a first entity in the example requirement statement;
[0269] A first parameter replacing unit, configured to replace the first example parameter with the first abstract parameter, and replace the first entity with the first abstract parameter;
[0270] A second parameter searching unit, configured to determine, from the example parameters, a second example parameter that does not represent an address of a cell in the example table, and to search for a second abstract parameter corresponding to the second example parameter;
[0271] A second entity determining unit, configured to determine a second entity in the example requirement statement;
[0272] A second parameter replacing unit, configured to replace the second example parameter with the second abstract parameter, and replace the second entity with the second abstract parameter;
[0273] A formula determination unit, configured to determine the example table formula after replacing the first example parameter and the second example parameter as an abstract table formula;
[0274] The expression determination unit is used to determine the example requirement expression after replacing the first entity and the second entity as an abstract requirement expression.
[0275] In an optional implementation, the first entity determination unit is specifically configured to:
[0276] Determine an example column corresponding to the address of the cell, and obtain an example column title of the example column;
[0277] From the example requirement statement, find a first entity that matches the example column heading.
[0278] In an optional implementation manner, the second entity determination unit is specifically configured to:
[0279] A second entity matching the second example parameter is searched from the example requirement expression.
[0280] In an optional embodiment, the device further comprises:
[0281] A parameter list building module, used for obtaining an example column type of the example column, and establishing a first corresponding relationship between the first abstract parameter, the first entity, and the example column type;
[0282] A second corresponding relationship between the second abstract parameter and the second entity is established, and a parameter list is constructed by the first corresponding relationship and the second corresponding relationship.
[0283] In an optional implementation, the formula and the second processing module are specifically used to:
[0284] From the target table, determine a target column whose column type is consistent with the example column type, and obtain a target address of a target cell in the target column;
[0285] Generate a third entity according to the second entity, replace the first abstract parameter in the abstract table formula with the target address, and replace the second abstract parameter in the abstract table formula with the third entity to generate a target table formula;
[0286] The target column title of the target column is obtained, the first abstract parameter in the abstract requirement statement is replaced with the target column title, the second abstract parameter in the abstract requirement statement is replaced with the third entity, and a target requirement statement is generated.
[0287] In an optional embodiment, the device further comprises:
[0288] A formula and requirement quality inspection module, used to determine the semantic fluency of the target requirement expression, and to determine whether the difference between the semantic fluency and a preset value is less than a preset difference threshold;
[0289] When the target table executes the target table formula, detecting whether the execution result of the target table formula is normal;
[0290] Determine the target function in the target table formula, the target parameter corresponding to the target function, and the template function matching the target function;
[0291] Determine a third corresponding relationship between the target function and the target parameter, and a fourth corresponding relationship between the template function and the template parameter in the template function, and detect whether the third corresponding relationship is consistent with the fourth corresponding relationship;
[0292] When the difference between the semantic fluency and the preset value is less than the preset difference threshold, the execution result of the target table formula is normal, and the third correspondence is consistent with the fourth correspondence, the data pair consisting of the target table formula and the target demand statement is retained.
[0293] In an optional embodiment, the device further comprises:
[0294] A time enhancement module, used to detect whether there is a fourth entity representing time from the entities expressed by the target demand;
[0295] In the case where the fourth entity exists, the fourth entity is enhanced according to a time-based enhancement method to obtain an enhanced target demand expression;
[0296] A new data pair is composed of the target table formula and the enhanced target requirement expression.
[0297] In an optional embodiment, the device further comprises:
[0298] a synonym enhancement module, used to determine a synonym of the fifth entity in the target demand expression, and replace the fifth entity with the synonym to obtain an enhanced target demand expression;
[0299] A new data pair is composed of the target table formula and the enhanced target requirement expression.
[0300] In an optional embodiment, the device further comprises:
[0301] A homophone enhancement module, used to determine a homophone of a sixth entity in the target demand expression, and replace the sixth entity with the homophone to obtain an enhanced target demand expression;
[0302] A new data pair is composed of the target table formula and the enhanced target requirement expression.
[0303] The present application also provides an electronic device, such as Figure 5 As shown, it includes a processor 51, a communication interface 52, a memory 53 and a communication bus 54, wherein the processor 51, the communication interface 52, and the memory 53 communicate with each other through the communication bus 54.
[0304] A memory 53, for storing computer programs;
[0305] The processor 51 is used to execute the program stored in the memory 53 to implement the following steps:
[0306] Obtain at least one example table, and for any of the example tables, determine an example function corresponding to the example table; generate an example table formula based on the example table and the example function, and determine an example requirement statement based on the example table formula; perform a first processing on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement; perform a second processing on the abstract table formula and the abstract requirement statement based on the target table to generate a target table formula and a target requirement statement.
[0307] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0308] The communication interface is used for communication between the above electronic device and other devices.
[0309] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0310] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0311] In another embodiment provided in the present application, a storage medium is also provided, in which instructions are stored. When the storage medium is run on a computer, the computer executes the data generation method described in any of the above embodiments.
[0312] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the data generation method described in any one of the above embodiments.
[0313] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a storage medium or transmitted from one storage medium to another storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0314] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0315] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0316] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A data generation method, characterized in that: The method comprises: Obtain at least one example table, and for any of the example tables, determine an example function corresponding to the example table; Generate an example table formula according to the example table and the example function, and determine an example requirement statement according to the example table formula; the table formula is a function formula in the table; Performing a first process on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement; According to the target table, performing a second processing on the abstract table formula and the abstract requirement expression to generate a target table formula and a target requirement expression; The first processing of the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement includes: Extracting example parameters in an example function of the example table formula; The example parameters in the example table formula are replaced with abstract parameters, and the entities in the example requirement statement are replaced with abstract parameters to obtain an abstract table formula and an abstract requirement statement.
2. The method according to claim 1, characterized in that The step of determining, for any of the example tables, an example function corresponding to the example table includes: For any of the example tables, determine the example scenario corresponding to the example table, and obtain a corresponding relationship between a preset scenario and a function; According to the corresponding relationship, a function corresponding to the example scenario is determined, and the function is determined as an example function corresponding to the example table.
3. The method according to claim 1, characterized in that The step of generating an example table formula according to the example table and the example function includes: Constructing a function application expression of the example function, and performing structural processing on the example table to obtain structural information of the example table; A first prompt for constructing a pre-trained large language model using the function application representation and the structured information; The first prompt is input into the pre-trained large language model to obtain an example table formula.
4. The method according to claim 1, characterized in that: The step of determining the example requirement statement according to the example table formula includes: Performing structural processing on the example table to obtain structural information of the example table; A second prompt for constructing a pre-trained large language model using the example table formula and the structured information; The second prompt is input into the pre-trained large language model to obtain a formula interpretation of the example table formula, and the formula interpretation is determined as an example requirement statement.
5. The method according to claim 1, characterized in that The step of replacing the example parameters in the example table formula with abstract parameters and replacing the entities in the example requirement expression with abstract parameters to obtain an abstract table formula and an abstract requirement expression includes: According to the example parameters, the following first processing is performed on the example table formula and the example requirement statement to generate an abstract table formula and an abstract requirement statement: Determine, from the example parameters, a first example parameter representing an address of a cell in the example table, and search for a first abstract parameter corresponding to the first example parameter; Determine a first entity in the example requirement statement, replace the first example parameter with the first abstract parameter, and replace the first entity with the first abstract parameter; Determine, from the example parameters, a second example parameter that does not represent an address of a cell in the example table, and search for a second abstract parameter corresponding to the second example parameter; Determine a second entity in the example requirement statement, replace the second example parameter with the second abstract parameter, and replace the second entity with the second abstract parameter; Determine the example table formula after replacing the first example parameter and the second example parameter as an abstract table formula; The example requirement statement after replacing the first entity and the second entity is determined as an abstract requirement statement.
6. The method according to claim 5, characterized in that The determining a first entity in the example requirement statement includes: Determine an example column corresponding to the address of the cell, and obtain an example column title of the example column; From the example requirement statement, find a first entity that matches the example column heading.
7. The method according to claim 5, characterized in that The determining the second entity in the example requirement statement includes: A second entity matching the second example parameter is searched from the example requirement expression.
8. The method according to claim 6, characterized in that The method further comprises: Acquire an example column type of the example column, and establish a first correspondence between the first abstract parameter, the first entity, and the example column type; A second corresponding relationship between the second abstract parameter and the second entity is established, and a parameter list is constructed by the first corresponding relationship and the second corresponding relationship.
9. The method according to claim 8, characterized in that The step of performing a second processing on the abstract table formula and the abstract requirement expression according to the target table to generate a target table formula and a target requirement expression includes: From the target table, determine a target column whose column type is consistent with the example column type, and obtain a target address of a target cell in the target column; Generate a third entity according to the second entity, replace the first abstract parameter in the abstract table formula with the target address, and replace the second abstract parameter in the abstract table formula with the third entity to generate a target table formula; The target column title of the target column is obtained, the first abstract parameter in the abstract requirement statement is replaced with the target column title, the second abstract parameter in the abstract requirement statement is replaced with the third entity, and a target requirement statement is generated.
10. The method according to claim 1, characterized in that The method further comprises: Determine the semantic fluency of the target requirement expression, and determine whether the difference between the semantic fluency and a preset value is less than a preset difference threshold; When the target table executes the target table formula, detecting whether the execution result of the target table formula is normal; Determine the target function in the target table formula, the target parameter corresponding to the target function, and the template function matching the target function; Determine a third corresponding relationship between the target function and the target parameter, and a fourth corresponding relationship between the template function and the template parameter in the template function, and detect whether the third corresponding relationship is consistent with the fourth corresponding relationship; When the difference between the semantic fluency and the preset value is less than the preset difference threshold, the execution result of the target table formula is normal, and the third correspondence is consistent with the fourth correspondence, the data pair consisting of the target table formula and the target demand statement is retained.
11. The method according to claim 1, characterized in that: The method further comprises: Detecting whether there is a fourth entity representing time from the entities expressed by the target requirement; In the case where the fourth entity exists, the fourth entity is enhanced according to a time-based enhancement method to obtain an enhanced target demand expression; A new data pair is composed of the target table formula and the enhanced target requirement expression.
12. The method according to claim 1, characterized in that The method further comprises: Determine a synonym for the fifth entity in the target requirement statement, replace the fifth entity with the synonym, and obtain an enhanced target requirement statement; A new data pair is composed of the target table formula and the enhanced target requirement expression.
13. The method according to claim 1, characterized in that The method further comprises: Determine a homophone of a sixth entity in the target demand statement, and replace the sixth entity with the homophone to obtain an enhanced target demand statement; A new data pair is composed of the target table formula and the enhanced target requirement expression.
14. A data generating device, characterized in that: The device comprises: An example table acquisition module, used to acquire at least one example table; An example function determination module, used for determining, for any of the example tables, an example function corresponding to the example table; A table formula generating module, used to generate an example table formula according to the example table and the example function; the table formula is a function formula in the table; A table formula interpretation module, used to determine an example requirement statement according to the example table formula; A formula and requirement first processing module, used for performing a first processing on the example table formula and the example requirement expression to generate an abstract table formula and an abstract requirement expression; The formula and requirement first processing module specifically includes: a parameter extraction submodule, which is used to extract example parameters in the example function of the example table formula; a formula and requirement first processing submodule, which is used to replace the example parameters in the example table formula with abstract parameters, and replace the entities in the example requirement statement with abstract parameters, so as to obtain an abstract table formula and an abstract requirement statement; The formula and requirement second processing module is used to perform a second processing on the abstract table formula and the abstract requirement statement according to the target table to generate the target table formula and the target requirement statement.
15. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-13 when executing a program stored in a memory.
16. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 13 is implemented.
