Data generation method, device, electronic device and storage medium

By generating data pairs of target programming statements and demand expressions, the problem of insufficient training data for SQL statement generation in the existing technology is solved, automatic batch generation is realized, costs are reduced, and domain coverage capabilities are improved.

CN118246408BActive Publication Date: 2024-08-27ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410673403.6
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

Technical Problem

In the existing technology, there is less public training data for SQL statement generation based on tables, and the user table content involves diverse fields, resulting in high human labeling costs, and there is an urgent need for batch generation through reasonable methods.

Method used

By obtaining sample tables and a collection of programming statement components, target programming statements are generated and interpreted, and a target requirement statement is generated to form a data pair for training of large language models to achieve automatic batch generation.

Benefits of technology

It saves the cost of human annotation, improves the efficiency of SQL statement generation and the ability to cover different fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118246408B
    Figure CN118246408B
Patent Text Reader

Abstract

The present application relates to a data generation method, device, electronic device and storage medium, the method comprising: obtaining at least one example table and a set of programming statement components, the set of programming statement components comprising multiple components of programming statements; for any of the example tables, generating a target programming statement according to the example table and the set of programming statement components; interpreting the target programming statement to generate a target requirement statement, wherein the target programming statement and the target requirement statement form a data pair. In this way, the target programming statement is generated according to the example table and the set of programming statement components, and then the target programming statement is interpreted to generate a target requirement statement, so that the target programming statement and the target requirement statement can be automatically generated in batches, saving costs.
Need to check novelty before this filing date? Find Prior Art

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, in the question-and-answer business of tables, it is often necessary to add, delete, modify, and query tables, so it is necessary to write and develop programming statements corresponding to data operations, such as SQL (Structured Query Language) statements, Java statements, Python statements, etc. This method is inefficient, so NL2SQL (Natural Language to SQL, natural language conversion to executable SQL statements) came into being.

[0003] Among them, NL2SQL essentially introduces a large language model, where users can enter natural language demand expressions, and the large language model can convert natural language demand expressions into corresponding executable SQL statements. However, before this, the large language model needs to be trained, and the training data is usually natural language demand expressions and corresponding executable SQL statements.

[0004] In the related art, there is little public training data based on tables for SQL statement generation, that is, public demand expressions and corresponding executable SQL statements. In addition, the user's table content covers a wide variety of fields. If manual annotation is directly used (that is, based on example tables, manually writing demand expressions and corresponding executable SQL statements), the cost is high. Therefore, it is urgently needed to generate them in batches through reasonable methods. Summary of the invention

[0005] In order to solve the above-mentioned public training data for SQL statement generation based on the table, that is, there are few public demand expressions and corresponding executable SQL statements, and the user's table content involves a variety of fields. If manual annotation is directly used (that is, based on the example table, manual writing of demand expressions and corresponding executable SQL statements), 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 a set of programming statement components, wherein the set of programming statement components includes a plurality of components of a programming statement;

[0008] For any of the example tables, generating a target programming statement according to the example table and the set of programming statement components;

[0009] The target programming statement is interpreted to generate a target requirement statement, and a data pair is formed by the target programming statement and the target requirement statement.

[0010] In an optional implementation, generating a target programming statement according to the example table and the set of programming statement components includes:

[0011] Performing structural processing on the example table to obtain structural information of the example table;

[0012] Selecting a target number of components from the set of programming statement components, wherein the target number of components are different from each other;

[0013] A target programming statement is generated using the structured information and the components of the target quantity.

[0014] In an optional implementation, the structured information includes an example header of the example table;

[0015] The generating a target programming statement by using the structured information and the components of the target quantity includes:

[0016] For any of the target number of components, the following processing is performed to generate a target programming statement:

[0017] Header cells are filtered from the example headers, and the data filled in the header cells are embedded in the component.

[0018] In an optional implementation, the filtering of header cells from the example headers and embedding the data filled in the header cells into the component comprises:

[0019] In the case that the component is a first-category component, header cells are filtered from the example headers, and the data filled in the header cells are embedded into the component.

[0020] In an optional embodiment, the method further comprises:

[0021] In the case where the component is a second-category component, obtaining a preset data set corresponding to the component;

[0022] Preset data is filtered from the preset data set, and the preset data is embedded into the component.

[0023] In an optional implementation, the structured information further includes table data of the example table, and the method further includes:

[0024] In the case where the component is a third-category component, filtering header cells from the example headers;

[0025] Determine the target column where the table header cell is located, and select the target cell from the target column;

[0026] The data filled in the header cell and the table data are embedded in the component according to the data type of the table data filled in the target cell.

[0027] In an optional implementation, the interpreting the target programming statement to generate a target requirement statement includes:

[0028] First prompt information of constructing a pre-trained large language model using the target programming statement;

[0029] The first prompt information is input into the pre-trained large language model to obtain a programming interpretation of the target programming statement, and the programming interpretation is determined as a target requirement statement.

[0030] In an optional embodiment, before executing the method, the method further includes:

[0031] Obtaining a training data pair, the training data pair comprising a sample requirement statement and a corresponding sample programming statement;

[0032] Second prompt information for constructing a large language model using the sample requirement expression and the sample programming statement;

[0033] Providing the second prompt information to the large language model for learning to obtain a pre-trained large language model;

[0034] The large language model learns the correspondence between the sample requirement expressions and the sample programming statements;

[0035] Determining a temperature parameter in the pre-trained large language model, wherein the temperature parameter is used to control the randomness of an output of the pre-trained large language model;

[0036] A preset value is obtained, and the temperature parameter is set to the preset value, wherein the preset value is greater than a preset threshold.

[0037] In an optional implementation, the target programming statement and the target requirement statement form a data pair, including:

[0038] Inputting the target programming statement and the target requirement statement into a pre-trained data pair quality inspection model to obtain a matching degree between the target programming statement and the target requirement statement;

[0039] When the matching degree is greater than a preset matching degree threshold, the target programming statement and the target requirement statement form a data pair.

[0040] In an optional embodiment, before executing the method, the method further includes:

[0041] Obtaining a training data pair, the training data pair comprising a sample requirement statement and a corresponding sample programming statement;

[0042] According to the matching condition between the sample requirement statement and the sample programming statement, setting a sample label corresponding to the sample requirement statement and the sample programming statement;

[0043] Inputting the sample requirement statement and the sample programming statement into a data pair quality inspection model to obtain a predicted matching degree between the sample requirement statement and the sample programming statement;

[0044] Determine a loss value according to the predicted matching degree and the sample label, and perform supervised training on the data quality inspection model according to the loss value;

[0045] When the loss value is less than the preset loss value threshold, the model training is stopped to obtain the pre-trained data pair quality inspection model.

[0046] In an optional implementation, when the matching degree is greater than a preset matching degree threshold, the target programming statement and the target requirement expression form a data pair, including:

[0047] In a case where the degree of match is greater than a preset degree of match threshold, determining a target component of the target programming statement;

[0048] Finding a first entity corresponding to the target component from the target requirement statement;

[0049] determining a similarity between the target component and the first entity;

[0050] When the similarity is greater than a preset similarity threshold, the target programming statement and the target requirement statement form a data pair.

[0051] In an optional embodiment, the method further comprises:

[0052] From the entities expressed by the target requirement, detecting whether there is a second entity representing time;

[0053] In the case where the second entity exists, the second 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 programming statement and the enhanced target requirement statement.

[0055] In an optional embodiment, the method further comprises:

[0056] Determine a synonym for a third entity in the target requirement expression, and replace the third entity with the synonym to obtain an enhanced target requirement expression;

[0057] A new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0058] In an optional embodiment, the method further comprises:

[0059] Determine a homophone of a fourth entity in the target demand statement, and replace the fourth entity with the homophone to obtain an enhanced target demand statement;

[0060] A new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0061] In an optional embodiment, the method further comprises:

[0062] From the entities expressed in the target requirement, detecting whether there is a fifth entity representing an ascending and descending order;

[0063] In the case where the fifth entity exists, the fifth entity is enhanced according to the enhancement method of ascending and descending order to obtain the enhanced target demand expression;

[0064] A new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0065] In a second aspect of the embodiments of the present application, a data generating device is further provided, the device comprising:

[0066] A table and set acquisition module, used to acquire at least one example table and a programming statement component set, wherein the programming statement component set includes multiple components of the programming statement;

[0067] A statement generation module, for generating a target programming statement for any of the example tables according to the example table and the set of programming statement components;

[0068] A statement generation module, used for interpreting the target programming statement to generate a target requirement statement;

[0069] The data pair composition module is used to compose a data pair from the target programming statement and the target requirement expression.

[0070] In an optional implementation, the statement generation module specifically includes:

[0071] A table structuring processing submodule, used for performing structuring processing on the example table to obtain structured information of the example table;

[0072] A component selection submodule, used to select a target number of components from the programming statement component set, wherein the target number of components are different from each other;

[0073] The statement generation submodule is used to generate a target programming statement through the structured information and the components of the target quantity.

[0074] In an optional implementation, the structured information includes an example header of the example table; and the statement generation submodule specifically includes:

[0075] The component processing unit is used to perform the following processing on any component of the target number of components to generate a target programming statement:

[0076] The data embedding unit is used to filter the header cells from the example headers and embed the data filled in the header cells into the component.

[0077] In an optional implementation, the data embedding unit is specifically used for:

[0078] In the case that the component is a first-category component, header cells are filtered from the example headers, and the data filled in the header cells are embedded into the component.

[0079] In an optional implementation, the statement generation submodule is further used to:

[0080] In the case where the component is a second-category component, obtaining a preset data set corresponding to the component;

[0081] Preset data is filtered from the preset data set, and the preset data is embedded into the component.

[0082] In an optional implementation, the statement generation submodule is further used to:

[0083] In the case where the component is a third-category component, filtering header cells from the example headers;

[0084] Determine the target column where the table header cell is located, and select the target cell from the target column;

[0085] The data filled in the header cell and the table data are embedded in the component according to the data type of the table data filled in the target cell.

[0086] In an optional implementation, the expression generation module is specifically used to:

[0087] First prompt information of constructing a pre-trained large language model using the target programming statement;

[0088] The first prompt information is input into the pre-trained large language model to obtain a programming interpretation of the target programming statement, and the programming interpretation is determined as a target requirement statement.

[0089] In an optional embodiment, the device further includes a large language model training module, and the large language model training module is specifically used to:

[0090] Obtaining a training data pair, the training data pair comprising a sample requirement statement and a corresponding sample programming statement;

[0091] Second prompt information for constructing a large language model using the sample requirement expression and the sample programming statement;

[0092] Providing the second prompt information to the large language model for learning to obtain a pre-trained large language model;

[0093] The large language model learns the correspondence between the sample requirement expressions and the sample programming statements;

[0094] Determining a temperature parameter in the pre-trained large language model, wherein the temperature parameter is used to control the randomness of an output of the pre-trained large language model;

[0095] A preset value is obtained, and the temperature parameter is set to the preset value, wherein the preset value is greater than a preset threshold.

[0096] In an optional implementation, the data pair composition module specifically includes:

[0097] A matching degree determination module, used for inputting the target programming statement and the target requirement statement into a pre-trained data pair quality inspection model to obtain a matching degree between the target programming statement and the target requirement statement;

[0098] The data pair composition submodule is used to form a data pair from the target programming statement and the target requirement expression when the matching degree is greater than a preset matching degree threshold.

[0099] In an optional embodiment, the device further includes a data pair quality inspection model training module, and the data pair quality inspection model training module is specifically used to:

[0100] Obtaining a training data pair, the training data pair comprising a sample requirement statement and a corresponding sample programming statement;

[0101] According to the matching condition between the sample requirement statement and the sample programming statement, setting a sample label corresponding to the sample requirement statement and the sample programming statement;

[0102] Inputting the sample requirement statement and the sample programming statement into a data pair quality inspection model to obtain a predicted matching degree between the sample requirement statement and the sample programming statement;

[0103] Determine a loss value according to the predicted matching degree and the sample label, and perform supervised training on the data quality inspection model according to the loss value;

[0104] When the loss value is less than the preset loss value threshold, the model training is stopped to obtain the pre-trained data pair quality inspection model.

[0105] In an optional implementation, the data pair composition submodule is specifically used for:

[0106] In a case where the degree of match is greater than a preset degree of match threshold, determining a target component of the target programming statement;

[0107] Finding a first entity corresponding to the target component from the target requirement statement;

[0108] determining a similarity between the target component and the first entity;

[0109] When the similarity is greater than a preset similarity threshold, the target programming statement and the target requirement statement form a data pair.

[0110] In an optional implementation, the device further includes a first expression enhancement module, and the first expression enhancement module is specifically configured to:

[0111] From the entities expressed by the target requirement, detecting whether there is a second entity representing time;

[0112] In the case where the second entity exists, the second 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 programming statement and the enhanced target requirement statement.

[0114] In an optional implementation, the device further includes a second expression enhancement module, and the second expression enhancement module is specifically configured to:

[0115] Determine a synonym for a third entity in the target requirement expression, and replace the third entity with the synonym to obtain an enhanced target requirement expression;

[0116] A new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0117] In an optional implementation, the device further includes a third expression enhancement module, and the third expression enhancement module is specifically configured to:

[0118] Determine a homophone of a fourth entity in the target demand statement, and replace the fourth entity with the homophone to obtain an enhanced target demand statement;

[0119] A new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0120] In an optional implementation, the device further includes a fourth expression enhancement module, and the fourth expression enhancement module is specifically configured to:

[0121] From the entities expressed in the target requirement, detecting whether there is a fifth entity representing an ascending and descending order;

[0122] In the case where the fifth entity exists, the fifth entity is enhanced according to the enhancement method of ascending and descending order to obtain the enhanced target demand expression;

[0123] A new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0124] In a third aspect of the embodiments of the present application, there is further provided an electronic device, comprising 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;

[0125] Memory, used to store computer programs;

[0126] The processor is used to implement any data generation method described in the first aspect when executing a program stored in the memory.

[0127] 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.

[0128] 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.

[0129] The technical solution provided by the embodiment of the present application obtains at least one example table and a set of programming statement components, the set of programming statement components includes multiple components of the programming statement, for any example table, generates a target programming statement according to the example table and the set of programming statement components, interprets the target programming statement, generates a target requirement statement, and the target programming statement and the target requirement statement constitute a data pair.

[0130] By obtaining at least one example table and a set of programming statement components, generating a target programming statement based on the example table and the set of programming statement components, and interpreting the target programming statement to generate a target requirement statement, thereby forming a data pair. In this way, a target programming statement is generated based on the example table and the set of programming statement components, and then the target programming statement is interpreted to generate a target requirement statement. In this way, target programming statements and target requirement statements can be automatically generated in batches, saving costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0131] 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.

[0132] 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.

[0133] 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.

[0134] Figure 1 A schematic diagram of an implementation flow of a data generation method shown in an embodiment of the present application;

[0135] Figure 2 A schematic diagram of a SQL statement style shown in an embodiment of the present application;

[0136] Figure 3 This is a schematic diagram of an implementation flow of another data generation method shown in an embodiment of the present application;

[0137] Figure 4 It is a structural schematic diagram of a data generating device shown in an embodiment of the present application;

[0138] Figure 5 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0139] 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.

[0140] 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.

[0141] Currently, for tables, users can enable the big language model and input natural language demand expressions. The big language model can convert the natural language demand expressions into corresponding executable SQL statements, for example. Here, the table is similar to the database table structure. The table can be converted into a database table, so that SQL statements can be executed on the database table, or the SQL statement can be converted into the corresponding table formula, and then the table formula is executed on the table.

[0142] However, before this, the large language model needs to be trained, and the training data is usually a natural language requirement expression and a corresponding executable SQL statement. To this end, the embodiment of the present application provides a data generation method, which can generate a target programming statement (such as an SQL statement) and a target requirement expression. The generated target programming statement and target requirement expression can be used as training data for the large language model, that is, the target requirement expression is used as a key, and the target programming statement is used as a value, which is provided to the large language model for learning, that is, learning the corresponding relationship between key and value to realize the training of the large language model.

[0143] 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:

[0144] S101, obtaining at least one example table and a programming statement component set, where the programming statement component set includes multiple components of a programming statement.

[0145] In the embodiment of the present application, in order to solve the problem of scenario coverage, it is necessary to collect example tables of various scenarios to form at least one example table of different scenarios. For example, example tables under financial scenarios and example tables under educational scenarios are collected to form at least one example table of different scenarios. In this way, at least one example table of different scenarios can be obtained, each example table corresponds to a scenario, and each example table corresponds to a different scenario.

[0146] In addition to obtaining at least one example table for different scenarios, it is also necessary to obtain a set of programming statement components, wherein the set of programming statement components includes multiple components of the programming statement. For example, for an SQL statement, its style diagram is as follows: Figure 2 As shown, the format of the SQL statement is fixed and can be roughly divided into five components, namely, the SELECT component, the WHERE component, the GROUP BY component, the ORDER BY component and the LIMIT component.

[0147] It should be noted that for the SELECT component, it supports multi-column queries, aggregate column queries and multi-column joint queries; for the WHERE component, it supports single-condition, multi-condition and multi-column joint queries; for the GROUP BY component, it supports single grouping and multi-column joint grouping; for the ORDER BY component, it supports single-column ascending and descending processing and multi-column joint ascending and descending processing; for the LIMIT component, it supports 1~20 limit processing, that is, it is used to limit the number of query results returned, such as LIMIT 2, which limits the number of query results returned to 2.

[0148] In addition, the programming statements may be other types of programming statements besides the above-mentioned SQL statements, which is not limited in the embodiments of the present application.

[0149] S102 : For any example table, generate a target programming statement according to the example table and a set of programming statement components.

[0150] In an embodiment of the present application, at least one example table is obtained. For any example table, the example table corresponds to a scenario, and a target programming statement is generated according to the example table and a set of programming statement components.

[0151] Among them, several components of the programming statement can be selected from the programming statement component set, and then these components can be embedded using the example table to generate the target programming statement.

[0152] For example, a SELECT component of an SQL statement is selected from a set of SQL statement components, and the selected SELECT component is embedded using a sample table to generate a target SQL statement.

[0153] It should be noted that step S102 may be executed multiple times to enumerate the target programming statements that can be generated according to the example table, and the generated target programming statements do not have duplication, which is not limited in the embodiment of the present application.

[0154] S103, interpreting the target programming statement to generate a target requirement statement, wherein the target programming statement and the target requirement statement constitute a data pair.

[0155] In the embodiment of the present application, for a target programming statement, the target programming statement can be interpreted to generate a target requirement statement, that is, a requirement statement in natural language. Among them, the target programming statement can be interpreted with the help of a large language model, so that the target requirement statement corresponding to the target programming statement can be obtained.

[0156] For the target programming statements and the target requirement expressions, the target programming statements and the target requirement expressions can be composed of data pairs, the number of which can be multiple, which can be used to train a large language model later. The large language model is used to convert the natural language requirement expressions into corresponding programming statements.

[0157] Through the above description of the technical solution provided by the embodiment of the present application, at least one example table and a set of programming statement components are obtained, the set of programming statement components includes multiple components of the programming statement, for any example table, a target programming statement is generated according to the example table and the set of programming statement components, the target programming statement is interpreted and processed, and a target requirement statement is generated, and a data pair is composed of the target programming statement and the target requirement statement.

[0158] By obtaining at least one example table and a set of programming statement components, generating a target programming statement based on the example table and the set of programming statement components, and interpreting the target programming statement to generate a target requirement statement, thereby forming a data pair. In this way, a target programming statement is generated based on the example table and the set of programming statement components, and then the target programming statement is interpreted to generate a target requirement statement. In this way, target programming statements and target requirement statements can be automatically generated in batches, saving costs.

[0159] like Figure 3 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] S301, obtaining at least one example table and a programming statement component set, where the programming statement component set includes multiple components of a programming statement.

[0161] In the embodiment of the present application, this step is similar to the above-mentioned step S101, and the embodiment of the present application will not be described one by one here.

[0162] S302: for any example table, perform structural processing on the example table to obtain structural information of the example table.

[0163] In an embodiment of the present application, at least one example table is obtained, and for any example table, the example table is structured to obtain structured information of the example table, wherein the structured information of the example table generally refers to information such as the title of the example table, the example table header, and the example data in the example table.

[0164] S303, selecting a target number of components from a set of programming statement components, wherein the target number of components are different from each other.

[0165] In an embodiment of the present application, for a programming statement component set, a target number of components are selected from the programming statement component set, the target number of components are different, and the target number here is not a fixed value, it can change.

[0166] For example, for a SQL statement component set including a SELECT component, a WHERE component, a GROUP BY component, an ORDER BY component, and a LIMIT component, the SELECT component may be selected at this time.

[0167] It should be noted that, for a set of programming statement components, a target number of components can be randomly selected therefrom to generate a target programming statement, which is not limited in this regard in the embodiments of the present application.

[0168] S304, generating a target programming statement through the structured information and components of the target quantity.

[0169] In the embodiment of the present application, for the structured information of the example table and the selected target number of components, a target programming statement can be generated through the structured information and the target number of components.

[0170] The structured information of the example table includes the example header of the example table. For the target number of components, the following processing is performed for any component to generate a target programming statement: select header cells from the example header, and embed the data filled in the header cells into the component. The header cells can be randomly selected from the example header, and the number of header cells can be multiple.

[0171] It should be noted that the generated target programming statement contains fixed fields, such as Figure 2 The "FROMTABLE" shown here, where "TABLE" refers to the title of the sample table (i.e., the table name), belongs to the structured information of the sample table, which means that the "TABLE" in the above fixed field is replaced with the title of the sample table, and then together with any of the components processed above, it constitutes the target programming statement.

[0172] For example, for a set of SQL statement components, including a SELECT component, a WHERE component, a GROUP BY component, an ORDER BY component, and a LIMIT component, you can select the SELECT component, filter the header cell "B1" from the sample header, and embed the data "Name" filled in the header cell into the SELECT component, that is, SELECT Name. In addition, replace "TABLE" in the fixed field with the title of the sample table "Student Score Table", that is, FROM Student Score Table, thereby forming the target SQL statement: SELECT Name FROM Student Score Table.

[0173] In addition, for the components of programming statements, due to their different composition structures, the required components are different, and they can be divided into different categories of components, so as to facilitate targeted execution of different processing on the components of programming statements. For example, for the LIMIT component, 1~20 limit processing is supported, and its composition structure is generally LIMIT+preset value, then the required component content is generally the preset value, such as LIMIT 2, the number of query results returned is limited to 2, then the required component content is generally the preset value 2, then the LIMIT component is the second category, and the processing of the LIMIT component is to embed the preset value therein.

[0174] As for the WHERE component, single condition, multiple conditions and multi-column joint query are supported. The condition needs to embed the sample data in the sample table, so its composition structure is generally WHERE+column+operator+value, where column and value are the sample data in the sample table, and the required components are generally column, operator (for example, =, >), value. The WHERE component is the third category, and the processing of the WHERE component is the sample data embedded in the sample table. The remaining SELECT components, GROUP BY components, and ORDER BY components have similar composition structures, and their required components are similar, all of which are the first category, and the corresponding processing is also similar.

[0175] To this end, for the target number of components, for any component, the following processing is performed, and the field representing the title in the fixed field of the programming statement is replaced with the title of the example table, and the two together constitute the target programming statement: when the component is a first-category component, the header cells are filtered from the example header, and the data filled in the header cells are embedded in the component; when the component is a second-category component, the preset data set corresponding to the component is obtained, the preset data is filtered from the preset data set, and the preset data is embedded in the component; when the component is a third-category component, the header cells are filtered from the example header, the target column where the header cells are located is determined, the target cells are filtered from the target column, and the data filled in the header cells and the table data are embedded in the component through the data type of the table data filled in the target cells (in order to distinguish the data filled in the header cells, the data filled in the cells other than the header cells are referred to as table data here).

[0176] It should be noted that the data type, for example, may be a time type, a numerical type, a percentage type, or a string type, which is not limited in the embodiments of the present application. The data type of the table data filled in the above-mentioned target cell essentially limits the logical relationship between the data filled in the header cell and the table data filled in the target cell, which means that the data filled in the header cell and the table data are embedded in the component with a certain logical relationship. Among them, when the data type is a time type, a numerical type, or a percentage type, the logical relationship may be greater than, less than, equal to, or not equal to; when the data type is a string type, the logical relationship may be equal to or not equal to; which is not limited in the embodiments of the present application.

[0177] For example, for the target number of components, for any component, perform the following processing and replace "TABLE" in the fixed field of the SQL statement with the title of the sample table "Student Score Table". The two together constitute the target SQL statement:

[0178] Assuming that the component is a SELECT component, which belongs to the first type of component, the header cell "B1" is selected from the example header, and the data "Name" filled in the header cell is embedded into the SELECT component, that is, SELECT Name.

[0179] Assuming that the component is a LIMIT component, which belongs to the second category of components, obtain its corresponding preset data set, 1~20, filter the preset data, 3, 5, from the preset data set, and embed the preset data into the LIMIT component, that is, LIMIT 3, 5.

[0180] Assume that the component is a WHERE component, which belongs to the third type of component. Filter the header cell C1 from the example header, determine the target column C where the header cell is located, filter the target cell C3 from the target column, and the data type of the table data 80 filled in the target cell is a numeric type. Then the logical relationship between the table data 80 filled in the target cell and the data language filled in the header cell can be greater than, thereby embedding the data language filled in the header cell and the table data 80 into the WHERE component with a greater than logical relationship, that is, WHERE language>80.

[0181] It should be noted that the target programming statements generated above can be divided into simple programming statements, medium programming statements and complex programming statements according to the selected target number of components. For example, selecting 1 component and generating the target SQL statement based on it is a simple SQL statement, selecting 3 components and generating the target SQL statement based on it is a medium SQL statement, and selecting 5 components and generating the target SQL statement based on it is a complex SQL statement.

[0182] S305, using the target programming statement to construct the first prompt information of the pre-trained large language model.

[0183] S306, input the first prompt information into a pre-trained large language model to obtain a programming interpretation of the target programming statement, and determine the programming interpretation as a target requirement statement.

[0184] In the embodiment of the present application, the generated target programming statement can be translated to obtain the corresponding target requirement expression, which means that the target requirement expression can be regarded as an explanation of the meaning of the target programming statement, that is, the meaning of the target programming statement is expressed in natural language. Among them, the generated target programming statement can be translated with the help of a large language model.

[0185] Based on this, the first prompt information of the pre-trained large language model is constructed using the target programming statement, and the first prompt information is input into the pre-trained large language model to obtain the programming interpretation of the target programming statement, and the programming interpretation is determined as the target requirement expression. Among them, the programming interpretation can be understood as an explanation of the meaning of the target programming statement, that is, the meaning of the target programming statement is expressed in natural language.

[0186] Among them, the first prompt information (i.e. prompt) usually includes two parts, input and output, and these two parts are expressed in the form of key-value. For example, "input" is the key of input, and the input value is the input content provided to the pre-trained large language model, which usually refers to the SQL statement and the corresponding structured information of the table. "output" is the key of output, and the output value is usually left blank (i.e., nothing is set) in the model inference stage, which means that the pre-trained large language model outputs value.

[0187] In this way, the above-mentioned target programming statement (for example, the target SQL statement) is combined with the structured information of the example table to obtain the input value of the input, and the output value of the output is set to blank, thereby combining the input and the output to obtain the first prompt information of the pre-trained large language model, and then inputting the first prompt information into the pre-trained large language model to obtain the output result of the large language model, which is the programming interpretation of the target programming statement, and the programming interpretation is determined as the target demand expression.

[0188] For example, the example table is a score table, in which the data filled in the table cells of the table header are class, Chinese score, math score and English score, etc., and the generated target SQL statement is select avg('Chinese') from Tablewhere'class'="Class 1"and'English'>110. Then the target SQL statement and the structured information of the example table are combined to obtain the input value of the input, and the output value of the output is set to empty. The input and the output are combined to obtain the first prompt information of the pre-trained large language model. The first prompt information is input into the pre-trained large language model to obtain the SQL explanation of the target SQL statement. The SQL explanation is what is the average score of Chinese when the class is Class 1 and the score is greater than 110. It can be seen that the SQL explanation is also the target demand expression, which means that the target demand expression is also what is the average score of Chinese when the class is Class 1 and the score is greater than 110.

[0189] Among them, the pre-trained large language model includes two parts, an encoder and a decoder. The encoder is a multi-layer Transformer encoder, which is used to encode the input value input in the first prompt information. The decoder is also a multi-layer Transformer decoder, which is used to convert the representation output by the encoder into a target natural language text. The target natural language text is the above-mentioned programming explanation.

[0190] It should be noted that the pre-trained large language model can be a T5 (Transfer Text-to-Text Transformer) model, which is essentially a seq2seq model based on the transformer model and serves as a data producer in this data generation process.

[0191] Among them, for the large language model, after training, a pre-trained large language model can be obtained, so that the above-generated target programming statements can be translated into corresponding target demand expressions through the pre-trained large language model.

[0192] Based on this, a training data pair is obtained, the training data pair includes a sample requirement statement and a corresponding sample programming statement, and the sample requirement statement and the sample programming statement are used to construct the second prompt information of the large language model; the second prompt information is provided to the large language model for learning to obtain a pre-trained large language model; wherein the large language model learns the correspondence between the sample requirement statement and the sample programming statement.

[0193] Among them, the second prompt information (i.e. prompt) usually includes two parts: sample input and sample output, and these two parts are expressed in the form of key-value. For example, "input" is the key of sample input, and the value of sample input is the input content provided to the large language model, usually referring to the sample SQL statement. "output" is the key of sample output, and the value of sample output is usually set to the sample requirement statement during the model training stage.

[0194] In this way, the above-mentioned sample programming statements (such as sample SQL statements) are used as the input value of the sample input, and the sample demand statement is used as the output value of the sample output, thereby combining the sample input and the sample output to obtain the second prompt information of the large language model, and the second prompt information is provided to the large language model for learning to obtain a pre-trained large language model. Specifically, the second prompt information is input into the large language model to obtain the prediction result of the large language model, which is the predicted programming interpretation of the sample programming statement, and the loss value between the predicted programming interpretation and the output value of the sample output in the second prompt information (i.e., the sample demand statement) is determined. The large language model is trained according to the loss value, and when the loss value converges, the pre-trained large language model is obtained. At this time, it is considered that the large language model has learned the correspondence between the sample demand statement and the sample programming statement.

[0195] For example, a sample SQL statement is select avg('Chinese') from Table where 'Class'="Class 1" and 'English'>110, and a sample demand statement is what is the average score of Chinese when the class is Class 1 and the score is greater than 110. The sample SQL statement is used as the input value of the sample input, and the sample demand statement is used as the output value of the sample output. The sample input and the sample output are combined to obtain second prompt information of the large language model. The second prompt information is input into the large language model to obtain a prediction result of the large language model, which is the predicted SQL interpretation of the sample SQL statement. A loss value between the predicted SQL interpretation and the output value of the sample output in the second prompt information (i.e., the sample demand statement) is determined, and the large language model is trained according to the loss value. When the loss value is less than a preset threshold, a pre-trained large language model is obtained. At this time, it is considered that the large language model has learned the corresponding relationship between the sample demand statement and the sample SQL statement.

[0196] In addition, in order to increase the diversity of target demand expressions, a higher temperature parameter is used in the pre-trained large language model to translate the generated target programming statements. For the pre-trained large language model, the size of the temperature parameter setting determines the randomness of the output of the pre-trained large language model. If it is set to 0, for the same programming statement, the same output will always be maintained during the translation of the programming statement by the pre-trained large language model. In order to obtain the diversity of target demand expressions, the temperature parameter is set larger here to increase the randomness of the output of the pre-trained large language model.

[0197] To this end, for the above-mentioned pre-trained large language model, determine the temperature parameter in the pre-trained large language model, the temperature parameter is used to control the randomness of the output of the pre-trained large language model; obtain a preset value, and set the temperature parameter to the preset value, wherein the preset value is greater than a preset threshold.

[0198] S307, a target programming statement and a target requirement statement form a data pair.

[0199] In an embodiment of the present application, the target programming statements and target requirement statements generated above need to be quality checked, that is, whether the target programming statements and the target requirement statements match. If the target programming statements and the target requirement statements match, the target programming statements and the target requirement statements constitute a data pair.

[0200] To this end, the target programming statement and the target requirement statement are input into the pre-trained data pair quality inspection model to obtain the matching degree between the target programming statement and the target requirement statement. When the matching degree is greater than the preset matching degree threshold, the target programming statement and the target requirement statement constitute a data pair.

[0201] It should be noted that for the pre-trained data pair quality inspection model, such as the Bert model, its input can be the target programming statement + target requirement statement, and the output is whether the two match. For the model, it does not directly output 0 and 1, but a continuous value between 0 and 1, that is, the probability of the two matching. In order to obtain higher quality data pairs, a higher threshold is selected for restriction.

[0202] Among them, the target programming statement and the target requirement expression can be encoded separately. The so-called encoding processing is to convert the target programming statement into a first embedding vector, and convert the target requirement expression into a second embedding vector. The first embedding vector and the second embedding vector are input into the pre-trained data pair quality inspection model to obtain the matching degree of the target programming statement and the target requirement expression.

[0203] In addition, in addition to satisfying the condition that the matching degree between the target programming statement and the target requirement expression is greater than the threshold matching degree threshold, the corresponding parts of the target programming statement and the target requirement expression need to be consistent, that is, the similarity must be greater than the preset similarity threshold. For example, the WHERE component in the target SQL statement restricts the conditions, and similarly, the corresponding conditions are also restricted in the target requirement expression, and the two conditions should be consistent.

[0204] To this end, when the matching degree is greater than a preset matching degree threshold, the target component of the target programming statement is determined; the first entity corresponding to the target component is found from the target requirement statement; the similarity between the target component and the first entity is determined; when the similarity is greater than a preset similarity threshold, the target programming statement and the target requirement statement form a data pair.

[0205] Prior to this, it is necessary to train the data pair quality inspection model. To this end, training data pairs are obtained, and the training data pairs include sample requirement statements and corresponding sample programming statements. According to the matching of the sample requirement statements and the sample programming statements, sample labels corresponding to the sample requirement statements and the sample programming statements are set. The sample requirement statements and the sample programming statements are input into the data pair quality inspection model to obtain the predicted matching degree of the sample requirement statements and the sample programming statements. According to the predicted matching degree and the sample labels, the loss value is determined. According to the loss value, supervised training is performed on the data pair quality inspection model. When the loss value is less than the preset loss value threshold, the model training is stopped to obtain the pre-trained data pair quality inspection model.

[0206] Among them, the sample labels corresponding to the sample requirement statements and the sample programming statements are set according to the matching situation of the sample requirement statements and the sample programming statements. Specifically, if the sample requirement statement matches the sample programming statement, its sample label can be set to, for example, 1; if the sample requirement statement does not match the sample programming statement, its sample label can be set to, for example, 0. The embodiments of the present application are not limited to this.

[0207] In addition, the sample requirement expression and the sample programming statement can be encoded separately. The so-called encoding processing is to convert the sample requirement expression into a third embedding vector, and convert the sample programming statement into a fourth embedding vector. The third embedding vector and the fourth embedding vector are input into the data pair quality inspection model to obtain the predicted matching degree of the sample requirement expression and the sample programming statement.

[0208] It should be noted that for the sample programming statements and the above target programming statements, special fields have special meanings and need special encoding processing. The so-called special encoding processing is to add special fields to ensure that the special fields are not split and thus converted into embedded vectors. The special fields are: select, sum(, min(, max(, avg(, count(, >=, ==, <=, !=, group by, order by, limit, asc, desc, etc.

[0209] By acquiring at least one example table and a set of programming statement components, generating a target programming statement through the structured information of the example table and the target number of components in the programming statement component set, translating the target programming statement through a pre-trained large language model to generate a target requirement statement, thereby forming a data pair. In this way, the target programming statement is generated through the structured information of the example table and the target number of components in the programming statement, and then the target programming statement is translated to generate a target requirement statement. In this way, the target programming statements and target requirement statements can be automatically generated in batches, saving costs.

[0210] 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, and ascending and descending sequence enhancement. The above enhancement processing can be performed according to the target demand expression.

[0211] Among them, for time data, there are many formats, and it is necessary to use conversion between formats for enhanced processing to generalize data of one time type to all supported time ranges; for comparative data of time types, it can be generalized to the expression before or after a certain day or multiple time periods based on which day it is.

[0212] To this end, from the entity of the target demand expression, it is detected whether there is a second entity representing time; if there is a second entity, the second entity is enhanced according to the time-based enhancement method to obtain an enhanced target demand expression; a new data pair is formed by the target programming statement 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.

[0213] For a sentence, multiple entities can be identified. Each entity usually has multiple synonyms. Replacing a certain entity in a sentence with a synonym can achieve the 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 "get out" can change the sentence to "get out the leftmost value of cell F4", thus generalizing the statement without changing the meaning of the sentence. To this end, determine the synonym of the third entity in the target requirement statement, replace the third entity with a synonym, and obtain the enhanced target requirement statement; a new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0214] When users input natural language demand expressions, some entities may be output in the same pronunciation but not what they want due to habit. In the case of no discovery, programming statements can also be correctly output. This is inseparable from 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 programming statements can be correctly generated. To this end, the homophone of the fourth entity in the target demand expression is determined, and the fourth entity is replaced with a homophone to obtain an enhanced target demand expression; a new data pair is composed of the target programming statement and the enhanced target demand expression.

[0215] When users input natural language demand expressions, sorting is often involved, that is, ascending and descending processing, for example, from small to large, it can be generalized to from large to small. To this end, from the entities of the target demand expression, it is detected whether there is a fifth entity representing the ascending and descending order; if there is a fifth entity, the fifth entity is enhanced according to the enhancement method of the ascending and descending order class to obtain the enhanced target demand expression; a new data pair is formed by the target programming statement and the enhanced target demand expression.

[0216] In addition, the target programming statements and the enhanced target requirement statements are also quality checked, and only after passing the quality check can they be used as training data. The quality check process for the target programming statements and the enhanced target requirement statements is similar to the above quality check process, and the embodiments of the present application will not be described one by one here.

[0217] 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: a table, a set acquisition module 410 , a sentence generation module 420 , a statement generation module 430 , and a data pair composition module 440 .

[0218] A table and set acquisition module 410, used to acquire at least one example table and a programming statement component set, wherein the programming statement component set includes multiple components of a programming statement;

[0219] A statement generating module 420, for generating a target programming statement for any of the example tables according to the example table and the set of programming statement components;

[0220] A statement generation module 430 is used to interpret the target programming statement and generate a target requirement statement;

[0221] The data pair composition module 440 is used to compose a data pair from the target programming statement and the target requirement expression.

[0222] In an optional implementation, the statement generation module specifically includes:

[0223] A table structuring processing submodule, used for performing structuring processing on the example table to obtain structured information of the example table;

[0224] A component selection submodule, used to select a target number of components from the programming statement component set, wherein the target number of components are different from each other;

[0225] The statement generation submodule is used to generate a target programming statement through the structured information and the components of the target quantity.

[0226] In an optional implementation, the structured information includes an example header of the example table; and the statement generation submodule specifically includes:

[0227] The component processing unit is used to perform the following processing on any component of the target number of components to generate a target programming statement:

[0228] The data embedding unit is used to filter the header cells from the example headers and embed the data filled in the header cells into the component.

[0229] In an optional implementation, the data embedding unit is specifically used for:

[0230] In the case that the component is a first-category component, header cells are filtered from the example headers, and the data filled in the header cells are embedded into the component.

[0231] In an optional implementation, the statement generation submodule is further used to:

[0232] In the case where the component is a second-category component, obtaining a preset data set corresponding to the component;

[0233] Preset data is filtered from the preset data set, and the preset data is embedded into the component.

[0234] In an optional implementation, the statement generation submodule is further used to:

[0235] In the case where the component is a third-category component, filtering header cells from the example headers;

[0236] Determine the target column where the table header cell is located, and select the target cell from the target column;

[0237] The data filled in the header cell and the table data are embedded in the component according to the data type of the table data filled in the target cell.

[0238] In an optional implementation, the expression generation module is specifically used to:

[0239] First prompt information of constructing a pre-trained large language model using the target programming statement;

[0240] The first prompt information is input into the pre-trained large language model to obtain a programming interpretation of the target programming statement, and the programming interpretation is determined as a target requirement statement.

[0241] In an optional embodiment, the device further includes a large language model training module, and the large language model training module is specifically used to:

[0242] Obtaining a training data pair, the training data pair comprising a sample requirement statement and a corresponding sample programming statement;

[0243] Second prompt information for constructing a large language model using the sample requirement expression and the sample programming statement;

[0244] Providing the second prompt information to the large language model for learning to obtain a pre-trained large language model;

[0245] The large language model learns the correspondence between the sample requirement expressions and the sample programming statements;

[0246] Determining a temperature parameter in the pre-trained large language model, wherein the temperature parameter is used to control the randomness of an output of the pre-trained large language model;

[0247] A preset value is obtained, and the temperature parameter is set to the preset value, wherein the preset value is greater than a preset threshold.

[0248] In an optional implementation, the data pair composition module specifically includes:

[0249] A matching degree determination module, used for inputting the target programming statement and the target requirement statement into a pre-trained data pair quality inspection model to obtain a matching degree between the target programming statement and the target requirement statement;

[0250] The data pair composition submodule is used to form a data pair from the target programming statement and the target requirement expression when the matching degree is greater than a preset matching degree threshold.

[0251] In an optional embodiment, the device further includes a data pair quality inspection model training module, and the data pair quality inspection model training module is specifically used to:

[0252] Obtaining a training data pair, the training data pair comprising a sample requirement statement and a corresponding sample programming statement;

[0253] According to the matching condition between the sample requirement statement and the sample programming statement, setting a sample label corresponding to the sample requirement statement and the sample programming statement;

[0254] Inputting the sample requirement statement and the sample programming statement into a data pair quality inspection model to obtain a predicted matching degree between the sample requirement statement and the sample programming statement;

[0255] Determine a loss value according to the predicted matching degree and the sample label, and perform supervised training on the data quality inspection model according to the loss value;

[0256] When the loss value is less than the preset loss value threshold, the model training is stopped to obtain the pre-trained data pair quality inspection model.

[0257] In an optional implementation, the data pair composition submodule is specifically used for:

[0258] In a case where the degree of match is greater than a preset degree of match threshold, determining a target component of the target programming statement;

[0259] Finding a first entity corresponding to the target component from the target requirement statement;

[0260] determining a similarity between the target component and the first entity;

[0261] When the similarity is greater than a preset similarity threshold, the target programming statement and the target requirement statement form a data pair.

[0262] In an optional implementation, the device further includes a first expression enhancement module, and the first expression enhancement module is specifically configured to:

[0263] From the entities expressed by the target requirement, detecting whether there is a second entity representing time;

[0264] In the case where the second entity exists, the second entity is enhanced according to a time-based enhancement method to obtain an enhanced target demand expression;

[0265] A new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0266] In an optional implementation, the device further includes a second expression enhancement module, and the second expression enhancement module is specifically configured to:

[0267] Determine a synonym for a third entity in the target requirement expression, and replace the third entity with the synonym to obtain an enhanced target requirement expression;

[0268] A new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0269] In an optional implementation, the device further includes a third expression enhancement module, and the third expression enhancement module is specifically configured to:

[0270] Determine a homophone of a fourth entity in the target demand statement, and replace the fourth entity with the homophone to obtain an enhanced target demand statement;

[0271] A new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0272] In an optional implementation, the device further includes a fourth expression enhancement module, and the fourth expression enhancement module is specifically configured to:

[0273] From the entities expressed in the target requirement, detecting whether there is a fifth entity representing an ascending and descending order;

[0274] In the case where the fifth entity exists, the fifth entity is enhanced according to the enhancement method of ascending and descending order to obtain the enhanced target demand expression;

[0275] A new data pair is composed of the target programming statement and the enhanced target requirement statement.

[0276] 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.

[0277] A memory 53, for storing computer programs;

[0278] The processor 51 is used to execute the program stored in the memory 53 to implement the following steps:

[0279] Acquire at least one example table and a set of programming statement components, wherein the set of programming statement components includes multiple components of a programming statement; for any of the example tables, generate a target programming statement based on the example table and the set of programming statement components; interpret the target programming statement to generate a target requirement statement, wherein the target programming statement and the target requirement statement constitute a data pair.

[0280] 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.

[0281] The communication interface is used for communication between the above electronic device and other devices.

[0282] 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.

[0283] 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.

[0284] 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.

[0285] 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.

[0286] 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.

[0287] 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 presence of other identical elements in the process, method, article or device including the elements.

[0288] 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.

[0289] 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 a set of programming statement components, wherein the set of programming statement components includes a plurality of components of a programming statement; For any of the example tables, generating a target programming statement according to the example table and the set of programming statement components; The target programming statement is interpreted to generate a target requirement statement, wherein the target programming statement and the target requirement statement form a data pair, and the data pair is determined according to a pre-trained data pair quality inspection model; The data pair quality inspection model is obtained in the following way: Acquire a training data pair, wherein the training data pair includes a sample requirement statement and a corresponding sample programming statement; set a sample label corresponding to the sample requirement statement and the sample programming statement according to a match between the sample requirement statement and the sample programming statement; input the sample requirement statement and the sample programming statement into a data pair quality inspection model to obtain a predicted matching degree between the sample requirement statement and the sample programming statement; determine a loss value according to the predicted matching degree and the sample label, and perform supervised training on the data pair quality inspection model according to the loss value; when the loss value is less than a preset loss value threshold, stop model training to obtain a pre-trained data pair quality inspection model.

2. The method according to claim 1, characterized in that The step of generating a target programming statement according to the example table and the set of programming statement components includes: Performing structural processing on the example table to obtain structural information of the example table; Selecting a target number of components from the set of programming statement components, wherein the target number of components are different from each other; A target programming statement is generated using the structured information and the components of the target quantity.

3. The method according to claim 2, characterized in that The structured information includes an example header of the example table; The generating a target programming statement by using the structured information and the components of the target quantity includes: For any of the target number of components, the following processing is performed to generate a target programming statement: Header cells are filtered from the example headers, and the data filled in the header cells are embedded in the component.

4. The method according to claim 3, characterized in that The step of filtering header cells from the example header and embedding the data filled in the header cells into the component comprises: In the case that the component is a first-category component, header cells are filtered from the example headers, and the data filled in the header cells are embedded into the component.

5. The method according to claim 4, characterized in that The method further comprises: In the case where the component is a second-category component, obtaining a preset data set corresponding to the component; Preset data is filtered from the preset data set, and the preset data is embedded into the component.

6. The method according to claim 4, characterized in that The structured information also includes table data of the example table, and the method further includes: In the case where the component is a third-category component, filtering header cells from the example headers; Determine the target column where the table header cell is located, and select the target cell from the target column; The data filled in the header cell and the table data are embedded in the component according to the data type of the table data filled in the target cell.

7. The method according to claim 1, characterized in that The interpreting and processing the target programming statement to generate a target requirement statement includes: First prompt information of constructing a pre-trained large language model using the target programming statement; The first prompt information is input into the pre-trained large language model to obtain a programming interpretation of the target programming statement, and the programming interpretation is determined as a target requirement statement.

8. The method according to claim 7, characterized in that Before executing the method, the method further includes: Obtaining a training data pair, the training data pair comprising a sample requirement statement and a corresponding sample programming statement; Second prompt information for constructing a large language model using the sample requirement expression and the sample programming statement; Providing the second prompt information to the large language model for learning to obtain a pre-trained large language model; The large language model learns the correspondence between the sample requirement expressions and the sample programming statements; Determining a temperature parameter in the pre-trained large language model, wherein the temperature parameter is used to control the randomness of an output of the pre-trained large language model; A preset value is obtained, and the temperature parameter is set to the preset value, wherein the preset value is greater than a preset threshold.

9. The method according to claim 1, characterized in that: The target programming statement and the target requirement statement form a data pair, including: Inputting the target programming statement and the target requirement statement into a pre-trained data pair quality inspection model to obtain a matching degree between the target programming statement and the target requirement statement; When the matching degree is greater than a preset matching degree threshold, the target programming statement and the target requirement statement form a data pair.

10. The method according to claim 9, characterized in that When the matching degree is greater than a preset matching degree threshold, the target programming statement and the target requirement expression form a data pair, including: In a case where the degree of match is greater than a preset degree of match threshold, determining a target component of the target programming statement; Finding a first entity corresponding to the target component from the target requirement statement; determining a similarity between the target component and the first entity; When the similarity is greater than a preset similarity threshold, the target programming statement and the target requirement statement form a data pair.

11. The method according to claim 1, characterized in that: The method further comprises: From the entities expressed by the target requirement, detecting whether there is a second entity representing time; In the case where the second entity exists, the second 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 programming statement and the enhanced target requirement statement.

12. The method according to claim 1, characterized in that The method further comprises: Determine a synonym for a third entity in the target requirement expression, and replace the third entity with the synonym to obtain an enhanced target requirement expression; A new data pair is composed of the target programming statement and the enhanced target requirement statement.

13. The method according to claim 1, characterized in that The method further comprises: Determine a homophone of a fourth entity in the target demand statement, and replace the fourth entity with the homophone to obtain an enhanced target demand statement; A new data pair is composed of the target programming statement and the enhanced target requirement statement.

14. The method according to claim 1, characterized in that The method further comprises: From the entities expressed in the target requirement, detecting whether there is a fifth entity representing an ascending and descending order; In the case where the fifth entity exists, the fifth entity is enhanced according to the enhancement method of ascending and descending order to obtain the enhanced target demand expression; A new data pair is composed of the target programming statement and the enhanced target requirement statement.

15. A data generating device, characterized in that: The device comprises: A table and set acquisition module, used to acquire at least one example table and a programming statement component set, wherein the programming statement component set includes multiple components of the programming statement; A statement generation module, for generating a target programming statement for any of the example tables according to the example table and the set of programming statement components; A statement generation module, used for interpreting the target programming statement to generate a target requirement statement; A data pair composition module, used to form a data pair from the target programming statement and the target requirement expression, wherein the data pair is determined according to a pre-trained data pair quality inspection model; The data pair quality inspection model is obtained in the following way: Acquire a training data pair, wherein the training data pair includes a sample requirement statement and a corresponding sample programming statement; set a sample label corresponding to the sample requirement statement and the sample programming statement according to a match between the sample requirement statement and the sample programming statement; input the sample requirement statement and the sample programming statement into a data pair quality inspection model to obtain a predicted matching degree between the sample requirement statement and the sample programming statement; determine a loss value according to the predicted matching degree and the sample label, and perform supervised training on the data pair quality inspection model according to the loss value; when the loss value is less than a preset loss value threshold, stop model training to obtain a pre-trained data pair quality inspection model.

16. 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-14 when executing a program stored in a memory.

17. 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 14 is implemented.