Training data generation method and device, readable medium and electronic equipment

Through the method of automatically generating training data, the problems of low efficiency and high cost of manual writing in the prior art are solved, and efficient and low-cost model training is achieved.

CN119537929APending Publication Date: 2025-02-28BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311030154.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-15
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In the prior art, training language models requires high-quality boot text and result text, which usually rely on manual writing, are inefficient and costly.

Method used

By obtaining sample data, determining the data generation template, generating question data and answer data, and combining them into training data, we realize automated generation of training data.

Benefits of technology

No manual writing is required, which improves model training efficiency, reduces cost, and reduces data noise caused by manual writing, further improving the efficiency of model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537929A_ABST
    Figure CN119537929A_ABST
Patent Text Reader

Abstract

The invention relates to a training data generation method and device, a readable medium and electronic equipment, and aims to automatically generate training data of a model, improve the model training efficiency and reduce the cost. The method comprises the following steps: acquiring sample data; determining a data generation template according to the sample data; generating question data according to first data in the sample data and the data generation template, and determining answer data according to second data except the first data in the sample data; and combining the question data and the answer data into training data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of data processing, and specifically, to a method, apparatus, readable medium, and electronic device for generating training data. Background Art

[0002] The Prompt paradigm is a technique that guides a language model to generate content expected by a user through natural language descriptions. It has currently been widely applied in the field of natural language processing (NLP). For example, for a generative model, the quality of the content obtained through Prompt has been greatly improved, or when guiding a large language model to generate text content that conforms to human intentions based on Prompt, the effect is remarkable. Therefore, when training a model, the quality of the designed Prompt will affect the quality of the final output content.

[0003] In the related art, high-quality guiding text and result text <Prompt, Answer> are required as a training set during the model training process. Usually, these training sets are generated by manual writing, which is inefficient and costly. Summary of the Invention

[0004] This Summary of the Invention section is provided to introduce concepts in a brief form, which will be described in detail in the subsequent Detailed Description section. This Summary of the Invention section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0005] In a first aspect, the present disclosure provides a method for generating training data, the method comprising:

[0006] Obtaining sample data;

[0007] Determining a data generation template according to the sample data;

[0008] Generating question data according to the first data in the sample data and the data generation template, and determining answer data according to the second data in the sample data except the first data;

[0009] Combining the question data and the answer data into training data.

[0010] In a second aspect, the present disclosure provides a training data generation apparatus, the apparatus comprising:

[0011] An obtaining module, configured to obtain sample data;

[0012] A template determination module, used to determine a data generation template according to the sample data;

[0013] A data determination module, configured to generate question data based on first data in the sample data and the data generation template, and determine answer data based on second data in the sample data except the first data;

[0014] A combining module is used to combine the question data and the answer data into training data.

[0015] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of any one of the methods described in the first aspect.

[0016] In a fourth aspect, the present disclosure provides an electronic device, including:

[0017] a storage device having a computer program stored thereon;

[0018] A processing device is used to execute the computer program in the storage device to implement the steps of any one of the methods in the first aspect.

[0019] Through the above technical solution, sample data is first obtained, and a data generation template is determined based on the sample data, and then question data is generated based on the first data in the sample data and the data generation template, and answer data is determined based on the second data in the sample data other than the first data, and finally the question data and answer data are combined into training data. With this method, a data generation template can be determined based on sample data, and then training data including question data and answer data can be automatically generated. The implementation is simple, and no manual writing is required, which improves the efficiency of model training and reduces costs. In addition, data noise caused by manual writing will not be introduced into the training data, which reduces interference with model training and further improves the efficiency of model training.

[0020] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:

[0022] Figure 1 is a schematic diagram of generating a picture based on Prompt according to an exemplary embodiment;

[0023] Figure 2is a schematic diagram of generating text based on Prompt according to an exemplary embodiment;

[0024] Figure 3 is a flowchart of a training data generation method provided according to an exemplary embodiment;

[0025] Figure 4 is a schematic diagram of sample data provided according to an exemplary embodiment;

[0026] Figure 5 is a block diagram of a training data generating apparatus provided according to an exemplary embodiment;

[0027] Figure 6 is a block diagram of an electronic device provided according to an exemplary embodiment. DETAILED DESCRIPTION

[0028] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0029] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0030] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0031] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0032] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0034] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0035] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0036] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0037] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0038] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.

[0039] As mentioned in the background technology, when training the model, the quality of the designed prompt will affect the quality of the final output content. Figure 1 By designing different prompts and using AI (Artificial Intelligence) painting generation tools to generate images based on the text content of the prompts, the results are significantly different. The images generated by simple prompts are often rough, but the content generated by more detailed prompts is of higher quality, not only containing a lot of details, but also clearer.

[0040] In addition, for the training corpus of the text generation model, refer to Figure 2, when we ask the model how to make a bowl of rice noodles with beef and coriander, the generated content needs to include these two ingredients, otherwise the generated content does not meet the user's intention. Usually, in order to make the model generate higher quality content (including text, pictures, audio, etc.), the prompt needs to be carefully adjusted and delicately designed. This design process is called prompt engineering.

[0041] With the development of computer technology, a large amount of relevant content in different vertical fields has been accumulated, including content in different formats such as documents and tables. In related technologies, annotators are usually required to read and understand the content in the vertical field first, and then manually design and generate prompts and write content. Finally, these manually written content are used to train the content generation model to obtain content generation models in different vertical fields. This is not only inefficient, but also costly.

[0042] In view of this, the present disclosure provides a training data generating method, device, readable medium and electronic device to solve the above problems.

[0043] The embodiments of the present disclosure are further explained below with reference to the accompanying drawings.

[0044] Figure 3 FIG. 1 is a flowchart of a method for generating training data according to an exemplary embodiment of the present disclosure. Figure 3 , the method comprising:

[0045] S301: Obtain sample data.

[0046] The sample data is the knowledge data of the target knowledge domain (vertical domain), which may include table data or text data, such as Figure 4 The document for making rice noodles is shown. The generated training data is used to train a general text generation model to obtain a target text generation model under the target knowledge domain.

[0047] S302: Determine a data generation template based on the sample data.

[0048] S303: Generate question data based on the first data in the sample data and a data generation template, and determine answer data based on the second data in the sample data except the first data.

[0049] S304: Combine the question data and the answer data into training data.

[0050] By adopting the above method, a data generation template can be determined based on sample data, and then training data including question data and answer data can be automatically generated. The implementation is simple and no manual writing is required, which improves the efficiency of model training and reduces costs. In addition, data noise caused by manual writing will not be introduced into the training data, which reduces interference with model training and further improves the efficiency of model training.

[0051] It is worth mentioning that the prompt design required for the training set needs to follow some basic principles: the description of concepts or steps needs to be specific to the corresponding knowledge blocks and as detailed as possible (concrete); the explanation of concepts or the elaboration of steps should be as clear as possible (clarity); a prompt should only involve one question as much as possible, and try not to involve open or broad instructions or questions (focus); the prompt definition and the answer content need to describe the same topic and cannot be mixed up (relevance).

[0052] Therefore, based on the above principles and Figure 4 The sample data shown can extract some questions and match the corresponding answers, so that based on these questions and answers, the model can learn knowledge in a certain vertical field. Usually including:

[0053] 1. What: Generally refers to the explanation and definition of concepts;

[0054] 2. How: Generally, it is the explanation and steps for the operation;

[0055] 3. Where: Generally refers to questions about a certain region;

[0056] 4. When: Questions about time or date;

[0057] 5. Why: Questions about reasons.

[0058] Generally speaking, the answer to How in the content of a vertical field will include the answer to Why, so you can focus on either How or Why, and configure it according to your needs. This disclosure does not impose any restrictions on this.

[0059] In a possible manner, determining the data generation template according to the sample data may include: when the sample data includes table data, determining the data generation template according to the arrangement information of the data in the table data. When the sample data includes text data, determining the data generation template by at least one of the following means: performing semantic recognition on the sample data to obtain a semantic recognition result, and determining the data generation template according to the semantic recognition result; performing entity recognition on the sample data by using a preset entity recognition model to obtain an entity recognition result, and determining the data generation template according to the entity recognition result.

[0060] For example, refer to Figure 4 The sample data may include text data or table data. For table data, the data generation template may be determined based on the arrangement information of the data in the table data. For text data, semantic recognition or entity recognition may be performed on the sample data, and the data generation template may be determined based on the semantic recognition result or the entity recognition result, so that the data generation template may be determined based on sample data of different formats, thereby improving the processing capability of converting sample data into training data.

[0061] In a possible manner, determining a data generation template according to a semantic recognition result may include: searching a preset template library for at least one data generation template carrying a first template identifier according to the semantic recognition result, wherein the preset template library pre-stores a plurality of data generation templates, and the first template identifier is a preset template identifier that matches the semantic recognition result. Determining a data generation template according to an entity recognition result may include: searching a preset template library for at least one data generation template carrying a second template identifier according to the entity recognition result, wherein the second template identifier is a preset template identifier that matches the entity recognition result.

[0062] By way of example, the preset template library may include multiple data generation templates, including data generation templates corresponding to the above-mentioned What, How, Where, When and Why, which may be "What is {recognition result 1}? / whatis{recognition result 1}?", "How to do {recognition result 2}? / How to{recognition result 2}?", etc. The corresponding template identifiers may be time, place, noun explanation, steps, etc. Generally speaking, the template identifier representing a noun can match the template for noun explanation (What), and the template identifier representing a verb can match the template for step description (How). The specific settings can be made according to needs, and the present disclosure does not impose any restrictions on this.

[0063] For example, text data includes "The starting point of the Great Wall is Shanhaiguan, the end point is Jiayuguan, from east to west through A, B, C..., with a total length of XX kilometers", and the semantic recognition results may include "The starting point of the Great Wall is Shanhaiguan", "The end point of the Great Wall is Jiayuguan", etc., and templates related to the location can be matched according to the location identifier. For example, the question is "Where is the starting point of the Great Wall? / whereis the starting point of the Great Wall?", and the answer is "The starting point of the Great Wall is in Shanhaiguan", etc., and the present disclosure does not impose any restrictions on this.

[0064] For another example, the text data includes "rose is a plant of the Rosaceae family". Based on the entity recognition model, the entity "rose" is recognized, and a template related to the term explanation can be matched according to the term explanation identifier. For example, the question is "What is a rose? / what is rose?", and the answer is "rose is a plant of the Rosaceae family", etc. The present disclosure does not impose any restrictions on this.

[0065] Therefore, the data generation template can be determined according to the semantics or entities of the sample data, thereby improving the processing capability of converting sample data into training data. In addition, the above-mentioned semantic recognition and entity recognition can be implemented through corresponding tools or models, and the present disclosure does not limit the specific implementation method thereof, as long as the function of semantic recognition or entity recognition can be implemented.

[0066] In a possible manner, determining a data generation template based on arrangement information of data in the table data may include: determining a question template used to obtain concept explanation content as a data generation template for any of the following data in the table data: table name, first row data, first column data; determining a conditional question template as a data generation template for non-first row data other than the table name or non-first column data other than the table name in the table data.

[0067] For example, continue to refer to Figure 4 , table data has certain characteristics. The table name, column name (or first column data), and row name (or first row data) are equivalent to questions, and the corresponding table content, the content of the same row except the first column, or the content of the same column except the first row, are equivalent to answers. For example, the table name can be directly used as the prompt, and the answer is the content in the table. Or the first row or the first column of the table can be asked using What, Which, etc., and the answer is the content below the first row or the content after the first column. For example, the question template is "What is {table name}? / What is {table name}?", if the prompt is "What are the ingredients for making hot and sour rice noodles? / What is the ingredients for making hot and sour rice noodles?", the answer is the data in the first row of the table except the ingredient column. Therefore, the characteristics of table data can be used to determine the data generation template and improve the processing ability of converting sample data into training data.

[0068] For example, for non-first row or non-first column data in a table, you can use conditional questioning, such as Prompt is "When {first column name} is {first column content} and {second column name} is {second column content}, what is {third column name}? / what is {column3} when {column1_name} is {xxx} and {column2_name} is {xxx}?", and the Answer is the content of column3 (third column). Thus, a large amount of question and answer data can be generated by changing the conditions.

[0069] In a possible manner, determining a data generation template based on the sample data may include: when the first data in the sample data is a title, determining a first data generation template, wherein the first data generation template is a question template for obtaining the explanation content of the first data. Determining answer data based on second data other than the first data in the sample data may include: using the directory content corresponding to the sample data or the summary content located after the first data in the sample data as the answer data.

[0070] For example, refer to Figure 4 First, we can focus on the document title and document subtitles (Sections). For the document title (such as the first-level title), we can extract the document overview (Abstract) or document structure (Outline) to construct<Prompt,Answer> Yes, if the Prompt is "What is rice noodles?", the Answer is "Rice noodles are a kind of xxx..., including hot and sour rice noodles, beef rice noodles and other flavors."

[0071] Alternatively, for purely noun subheadings, you can use "What is" to ask questions, which are generally conceptual questions. For example, the Prompt template can be designed as "What is {subheading 1}? / What is {subheading 1}?", or "What is {subheading 1}? / What is the definition of {subheading 1}?", etc., and the present disclosure does not limit this. Accordingly, the Answer is the content under the subheading, for example, the Prompt is a secondary title, and the Answer is the body of the secondary title.

[0072] For example, for titles beginning with a verb, you can use How to to ask questions, which are usually answers related to some operations and implementations. For example, the Prompt template can be designed as "How is {title} made? / How to make {title}?", or "Please instruct me to make {title} / Give me the instruction to make {title}", etc., and the present disclosure does not limit this.

[0073] Therefore, the data generation template can be determined according to the title in the sample data, and then the answer data can be determined, which not only improves the efficiency of training data generation, but also enhances the diversity of prompts.

[0074] In a possible manner, determining a data generation template based on sample data may include: when the first data in the sample data is a conceptual entity, determining a second data generation template, wherein the second data generation template is a question template for obtaining the interpretation content of the first data. Determining answer data based on second data other than the first data in the sample data may include: determining the answer data based on the context content of the first data in the sample data.

[0075] For example, we can also focus on the entities in the text. We can identify the entities in the text, ask conceptual questions about the entities, and use the context in which the entities are located as answers. For example, some sample data may not include the title content, or when there are conceptual entities in the title text that are not related to the title, we can directly determine the question template "What is {concept entity}? / What is {concept entity}?" based on the conceptual entities in the sample data, and determine the answer data based on the context content. For example, for Figure 4 In the second-level title text, we can identify a concept "rice noodles" through the entity recognition model, and the text is the explanation of this concept. Therefore, Prompt can be the entity, and Answer is this text.

[0076] For another example, the sample data is "When making rice noodles, you can add xx seasoning (including a mixture of H, M, and N) to enhance the flavor." From this, the concept entity "xx seasoning" is identified, and the Prompt can be constructed as "What is xx seasoning? / What isxx seasoning?", and the Answer is "xx seasoning is a mixture of H, M, and N."

[0077] Therefore, a data generation template can be determined according to entities in the body of the sample data, and then the answer data can be determined, which enriches the source of Prompt and enhances the diversity of Prompt.

[0078] In a possible manner, determining a data generation template based on sample data may include: when the second data in the sample data is arranged data, determining a third data generation template, wherein the third data generation template is a question template for obtaining arranged data; accordingly, the first data is the data in the sample data that is located before the second data.

[0079] For example, you can also focus on bullet points, and convert the content of the previous sentence into a question or a declarative statement, such as "Show me the type list of {subheading} / Show me the type list of {subheading}", or "Give me all the types that belong to {subheading}", etc. The present disclosure does not limit this.

[0080] For example, refer to Figure 4 The question template may be a question template for obtaining the steps of making hot and sour rice noodles. For example, a prompt may be constructed as "How to make hot and sour rice noodles?", and the answer may be the content of step 1, step 2, and step 3. Thus, a data generation template may be determined based on data in a special format, and then the answer data may be determined, further enhancing the diversity of the prompt.

[0081] It is worth noting that the same sample data can be matched with multiple templates to obtain multiple training data. Figure 4 , we can obtain training data 1: "What is rice noodle?", "Rice noodle is a kind of xxx..."; training data 2: "What is hot and sour rice noodle?", "Spicy and sour rice noodle is a kind of xxx..."; training data 3: "What flavors does rice noodle have?", "Spicy and sour rice noodle and beef rice noodle"; training data 4: "How to make hot and sour rice noodle?", "Contents of step 1, step 2, step 3" and other training data. Based on the data generation template, the knowledge data in the vertical field is quickly and automatically converted into structured and large amounts of training data, and through these training data, the text generation model learns the knowledge in the vertical field, so that it can better cover and answer user questions.

[0082] The above method not only saves a lot of manual writing<Prompt,Answer> The human cost is reduced, and vertical content coverage is automatically generated.<Prompt,Answer> , improve the efficiency of generating training data for text generation models. And by flexibly designing templates to enhance the diversity of prompts, improve the generation effect of text generation models in vertical fields.<Prompt,Answer> The way to train a text generation model is to inject domain knowledge into the model. This method converts text or tables into<Prompt,Answer> This method can enable the general model to obtain sufficient high-quality training data when applied in a certain vertical field, and it is simple to implement. It will not introduce data noise caused by manual writing into the training data, reduce interference with model training, and further improve the efficiency of model training.

[0083] It is worth noting that the present disclosure can not only provide a method for automatically generating a Prompt data set corresponding to sample data (including text or table content) based on a template, but also provide a tool for generating a Prompt data set in a programmatic manner. In addition, the training data generation method provided by the present disclosure can be used to generate training data for a text generation model to train the text generation model, and can also generate training data for an image generation model to train the image generation model, and the present disclosure does not limit this. Among them, in the process of generating training data for the image generation model, the text content is Prompt, and the image content is Answer. For example, the context content in the document including the template image is used as Prompt, and the target image is used as Answer.

[0084] Based on the same inventive concept, the present disclosure provides a training data generating device, referring to Figure 5 , the device 500 comprises:

[0085] An acquisition module 501 is used to acquire sample data;

[0086] A template determination module 502, configured to determine a data generation template according to the sample data;

[0087] A data determination module 503, configured to generate question data according to the first data in the sample data and the data generation template, and determine answer data according to the second data in the sample data except the first data;

[0088] The combining module 504 is used to combine the question data and the answer data into training data.

[0089] By using the above-mentioned device, a data generation template can be determined based on sample data, and then training data including question data and answer data can be automatically generated. The implementation is simple and no manual writing is required, which improves the efficiency of model training and reduces costs. In addition, data noise caused by manual writing will not be introduced into the training data, which reduces interference with model training and further improves the efficiency of model training.

[0090] Optionally, the template determination module 502 includes:

[0091] A first determination submodule, configured to determine the data generation template according to arrangement information of data in the table data when the sample data includes table data;

[0092] The second determination submodule is configured to determine the data generation template in at least one of the following ways when the sample data includes text data:

[0093] Performing semantic recognition on the sample data to obtain a semantic recognition result, and determining the data generation template according to the semantic recognition result;

[0094] The sample data is subjected to entity recognition through a preset entity recognition model to obtain an entity recognition result, and the data generation template is determined according to the entity recognition result.

[0095] Optionally, the second determining submodule is used to:

[0096] According to the semantic recognition result, searching for at least one data generation template carrying a first template identifier in a preset template library, wherein the preset template library pre-stores a plurality of data generation templates, and the first template identifier is a preset template identifier that matches the semantic recognition result;

[0097] The second determining submodule is used for:

[0098] According to the entity recognition result, at least one data generation template carrying a second template identifier is searched in the preset template library, wherein the second template identifier is a preset template identifier that matches the entity recognition result.

[0099] Optionally, the first determining submodule is used to:

[0100] For any of the following data of the table data, determining the question template for obtaining the concept explanation content as the data generation template: table name, first row data, first column data;

[0101] For non-first row data except the table name or non-first column data except the table name in the table data, a conditional question template is determined as the data generation template.

[0102] Optionally, the template determination module 502 is used to:

[0103] When the first data in the sample data is a title, determining a first data generation template, wherein the first data generation template is a question template for obtaining an explanation content of the first data;

[0104] The data determination module 503 is used for:

[0105] The directory content corresponding to the sample data or the summary content of the sample data after the first data is used as the answer data.

[0106] Optionally, the template determination module 502 is used to:

[0107] When the first data in the sample data is a conceptual entity, determining a second data generation template, wherein the second data generation template is a question template for obtaining an explanation content of the first data;

[0108] The data determination module 503 is used for:

[0109] The answer data is determined according to the context content of the first data in the sample data.

[0110] Optionally, the template determination module 502 is used to:

[0111] When the second data in the sample data is arranged data, determining a third data generation template, wherein the third data generation template is a question template for obtaining the arranged data;

[0112] Correspondingly, the first data is data located before the second data in the sample data.

[0113] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0114] Based on the same concept, an embodiment of the present disclosure further provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of the above-mentioned training data generating method are implemented.

[0115] Based on the same concept, an embodiment of the present disclosure further provides an electronic device, including:

[0116] a storage device having a computer program stored thereon;

[0117] A processing device is used to execute the computer program in the storage device to implement the steps of the above-mentioned training data generation method.

[0118] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0119] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0120] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0121] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0122] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0123] In some embodiments, any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol) can be used for communication, and can be interconnected with any form or medium of digital data communication (e.g., communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), internets (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.

[0124] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0125] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains sample data; determines a data generation template based on the sample data; generates question data based on first data in the sample data and the data generation template, and determines answer data based on second data in the sample data except the first data; and combines the question data and the answer data into training data.

[0126] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0127] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0128] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a module does not, in some cases, limit the module itself.

[0129] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0130] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0131] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0132] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0133] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims

1. A method for generating training data, characterized in that: The method comprises: Get sample data; Determine a data generation template according to the sample data; Generate question data according to first data in the sample data and the data generation template, and determine answer data according to second data in the sample data except the first data; The question data and the answer data are combined as training data.

2. The method according to claim 1, characterized in that The step of determining a data generation template according to the sample data includes: When the sample data includes table data, determining the data generation template according to arrangement information of data in the table data; When the sample data includes text data, the data generation template is determined by at least one of the following methods: Performing semantic recognition on the sample data to obtain a semantic recognition result, and determining the data generation template according to the semantic recognition result; The sample data is subjected to entity recognition through a preset entity recognition model to obtain an entity recognition result, and the data generation template is determined according to the entity recognition result.

3. The method according to claim 2, characterized in that Determining the data generation template according to the semantic recognition result includes: According to the semantic recognition result, searching for at least one data generation template carrying a first template identifier in a preset template library, wherein the preset template library pre-stores a plurality of data generation templates, and the first template identifier is a preset template identifier that matches the semantic recognition result; The step of determining the data generation template according to the entity recognition result includes: According to the entity recognition result, at least one data generation template carrying a second template identifier is searched in the preset template library, wherein the second template identifier is a preset template identifier that matches the entity recognition result.

4. The method according to claim 2 or 3, characterized in that: The step of determining the data generation template according to the arrangement information of the data in the table data includes: For any of the following data of the table data, determining the question template for obtaining the concept explanation content as the data generation template: table name, first row data, first column data; For non-first row data except the table name or non-first column data except the table name in the table data, a conditional question template is determined as the data generation template.

5. The method according to any one of claims 1 to 3, characterized in that: The step of determining a data generation template according to the sample data includes: When the first data in the sample data is a title, determining a first data generation template, wherein the first data generation template is a question template for obtaining an explanation content of the first data; The step of determining answer data according to second data other than the first data in the sample data comprises: The directory content corresponding to the sample data or the summary content of the sample data after the first data is used as the answer data.

6. The method according to any one of claims 1 to 3, characterized in that: The step of determining a data generation template according to the sample data includes: When the first data in the sample data is a conceptual entity, determining a second data generation template, wherein the second data generation template is a question template for obtaining an explanation content of the first data; The step of determining answer data according to second data other than the first data in the sample data comprises: The answer data is determined according to the context content of the first data in the sample data.

7. The method according to any one of claims 1 to 3, characterized in that: The step of determining a data generation template according to the sample data includes: When the second data in the sample data is arranged data, determining a third data generation template, wherein the third data generation template is a question template for obtaining the arranged data; Correspondingly, the first data is data located before the second data in the sample data.

8. A training data generating device, characterized in that: The device comprises: An acquisition module is used to acquire sample data; A template determination module, used to determine a data generation template according to the sample data; A data determination module, configured to generate question data based on first data in the sample data and the data generation template, and determine answer data based on second data in the sample data except the first data; A combining module is used to combine the question data and the answer data into training data.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 7 are implemented.

10. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 7.