Method for generating question-answer pairs, method and apparatus for training neural network model

By using a multi-stage processing model based on neural networks, the problem of low efficiency in manually extracting question-answer pairs is solved, enabling more efficient and complete question-answer pair generation and expanding the scope of knowledge base construction.

CN114691850BActive Publication Date: 2026-03-24CHINA CONSTRUCTION BANK +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-31
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In the construction of existing intelligent question-answering knowledge bases, manual extraction of question-answer pairs is inefficient and the results are incomplete, which limits the scope of knowledge base construction.

Method used

Using a neural network model, including a language representation model and a sequence-to-sequence model, text data is decomposed into answers and questions through multi-stage processing to generate question-answer pairs.

Benefits of technology

It improves the efficiency of question-answer pair extraction, generates more complete question-answer pairs, avoids the limitation of knowledge base construction scope caused by keyword dependence, and improves the quality of intelligent question answering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691850B_ABST
    Figure CN114691850B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method for generating a question and answer pair using a neural network model, which can be applied to the field of financial technology. The method for generating a question and answer pair using a neural network model comprises: inputting first target text data into a first network model to obtain an answer extraction result corresponding to the first target text data; inputting second target text data and the answer extraction result into a second network model to obtain a question result corresponding to the second target text data; and generating a question and answer pair based on the answer extraction result and the question result. The present disclosure also provides a training method and device for a neural network model, equipment, a storage medium and a program product.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of artificial intelligence, can be applied to the technical field of finance, and more particularly to a method for generating a question-answer pair using a neural network model, a training method, an apparatus, an electronic device, a storage medium, and a program product. BACKGROUND

[0002] With the rise of intelligent question answering, the construction of a knowledge base becomes particularly important. The knowledge base should contain rich question-answer pair content to support intelligent question answering.

[0003] However, the current construction of an intelligent question answering knowledge base requires manual extraction of question-answer pairs from a corpus based on experience, and different personnel may extract different question-answer pairs, which may limit the scope of the knowledge base construction, and the manual processing method is inefficient and the extracted question-answer pairs are not complete. SUMMARY

[0004] In view of the above problems, the present disclosure provides a method, apparatus, device, medium, and program product for generating a question-answer pair using a neural network model to improve the efficiency of question-answer pair extraction.

[0005] According to a first aspect of the present disclosure, a method for generating a question-answer pair using a neural network model is provided, the neural network model comprising a first network model and a second network model, the method comprising: inputting first target text data to the first network model to obtain an answer extraction result corresponding to the first target text data; inputting second target text data and the answer extraction result to the second network model to obtain a question result corresponding to the second target text data; and generating a question-answer pair based on the answer extraction result and the question result.

[0006] According to an embodiment of the present disclosure, the first target text data and / or the second target text data is obtained by: obtaining text data; wherein the text data comprises text data of a standard document; obtaining related information of the standard document, the related information comprising: the standard document and format information corresponding to the standard document; performing text decomposition processing on the text data based on the related information of the standard document to obtain a text decomposition processing result corresponding to the text data; and obtaining one or more of the first target text data and the second target text data based on the text decomposition processing result corresponding to the text data; wherein the text decomposition processing comprises a regular method.

[0007] According to an embodiment of the present disclosure, the first network model comprises a language representation model, and the second network model comprises a sequence-to-sequence model.

[0008] According to an embodiment of the present disclosure, the sequence-to-sequence model comprises a language representation model and a language model.

[0009] A second aspect of the present disclosure provides a method for training a neural network model, comprising: constructing a neural network model to be trained based on a language representation model and a language model; parsing text data to obtain title data, body data corresponding to the title data, and answer data; and inputting the title data, the body data corresponding to the title data, and the answer data as sample input data, and training the neural network model to be trained using a machine learning algorithm.

[0010] According to an embodiment of the present disclosure, the answer data comprises an answer extraction result; and the answer extraction result is obtained by: inputting the text data as sample input data; and training a language representation model to be trained using a machine learning algorithm according to the sample input data to obtain an answer extraction result corresponding to the sample input data.

[0011] A third aspect of the present disclosure provides an apparatus for generating a question and answer pair using a neural network model, the neural network model comprising a first network model and a second network model, the apparatus comprising: a determination answer module configured to input first target text data to the first network model to obtain an answer extraction result corresponding to the first target text data; a determination question module configured to input second target text data and the answer extraction result to the second network model to obtain a question result corresponding to the second target text data; and a generation question and answer pair module configured to generate a question and answer pair based on the answer extraction result and the question result.

[0012] A fourth aspect of the present disclosure provides an apparatus for training a neural network model, comprising: a construction module configured to construct a neural network model to be trained based on a language representation model and a language model; a parsing module configured to parse text data to obtain title data, body data corresponding to the title data, and answer data; and a training module configured to input the title data, the body data corresponding to the title data, and the answer data as sample input data, and train the neural network model to be trained using a machine learning algorithm.

[0013] A fifth aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method disclosed above.

[0014] A sixth aspect of the present disclosure further provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method disclosed above.

[0015] The seventh aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the method disclosed above. BRIEF DESCRIPTION OF DRAWINGS

[0016] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description when taken in conjunction with the accompanying drawings, in which:

[0017] Figure 1 An application scenario diagram of a method for generating a question and answer pair using a neural network model, a training method of a neural network model, an apparatus, a device, a medium and a program product according to an embodiment of the present disclosure is schematically shown;

[0018] Figure 2 A flowchart of the method for generating a question and answer pair using a neural network model according to an embodiment of the present disclosure is schematically shown;

[0019] Figure 3 A flowchart of extracting an answer by using a language representation model according to an embodiment of the present disclosure is schematically shown;

[0020] Figure 4 A flowchart of a training method of a neural network model according to an embodiment of the present disclosure is schematically shown;

[0021] Figure 5 An execution schematic diagram of a sequence-to-sequence model according to an embodiment of the present disclosure is schematically shown;

[0022] Figure 6 A structural block diagram of an apparatus for generating a question and answer pair using a neural network model according to an embodiment of the present disclosure is schematically shown;

[0023] Figure 7 A structural block diagram of a training apparatus of a neural network model according to an embodiment of the present disclosure is schematically shown; and

[0024] Figure 8 A block diagram of an electronic device suitable for implementing the method for generating a question and answer pair using a neural network model and / or the training method of a neural network model according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0025] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood, however, that the description is merely exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description of the embodiments of the present disclosure, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. However, it would be apparent to those skilled in the art that the embodiments of the present disclosure can be practiced without these specific details. In other instances, well-known structures and methods are not described in detail in order to avoid obscuring the concepts of the present disclosure.

[0026] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present disclosure. As used herein, the term "includes" and tautological expressions thereof, such as "including," "includes," "include," "contains," "containing," and so on, mean the term "comprises," unless otherwise noted.

[0027] All terms used herein, including technical and scientific terms, have the same meanings as those generally understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the present description, and should not be interpreted in an idealized or excessively formal manner.

[0028] In the case of using expressions similar to "at least one of A, B, and C, etc.", it should generally be interpreted to include any of them alone, any combination of two or more of them, and the like.

[0029] Embodiments of the present disclosure provide a method and apparatus for generating a question and answer pair using a neural network model including a first network model and a second network model, the method including: inputting first target text data to the first network model to obtain an answer extraction result corresponding to the first target text data; inputting second target text data and the answer extraction result to the second network model to obtain a question result corresponding to the second target text data; and generating a question and answer pair based on the answer extraction result and the question result.

[0030] Figure 1 An application scenario diagram of a method for generating a question and answer pair using a neural network model, a training method, apparatus, device, medium, and program product of the neural network model according to embodiments of the present disclosure is schematically shown.

[0031] As Figure 1As shown, the application scenario 100 according to this embodiment can include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is a medium for providing a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links, or fiber optic cables, and the like.

[0032] A user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, and the like. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, and the like (only as examples).

[0033] The terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0034] The server 105 can be a server providing various services, such as a background management server providing support for websites browsed by users using the terminal devices 101, 102, 103 (only as an example). The background management server can analyze and process received user requests and the like, and feed back the processing results (such as web pages, information, or data, and the like obtained or generated according to user requests) to the terminal devices.

[0035] It should be noted that the method for generating a question and answer pair using a neural network model and / or the training method of the neural network model provided by the embodiments of the present disclosure can generally be executed by the server 105. Accordingly, the apparatus for generating a question and answer pair using a neural network model and / or the training apparatus of the neural network model provided by the embodiments of the present disclosure can generally be arranged in the server 105. The method for generating a question and answer pair using a neural network model and / or the training method of the neural network model provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the apparatus for generating a question and answer pair using a neural network model and / or the training apparatus of the neural network model provided by the embodiments of the present disclosure can also be arranged in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105.

[0036] It should be understood that Figure 1 The number of terminal devices, networks, and servers in the application scenario 100 is only illustrative. According to the implementation needs, there can be any number of terminal devices, networks, and servers.

[0037] The following will be based on Figure 1 The described scenario, by Figure 2 The method for generating question and answer pairs using a neural network model of the disclosed embodiment is described in detail.

[0038] Figure 2 The flowchart of the method for generating question and answer pairs using a neural network model according to the embodiments of the present disclosure is schematically shown.

[0039] As Figure 2 shown, the embodiment includes operation S210~operation S230, the method for generating question and answer pairs using a neural network model can be executed by a server, and the neural network model includes a first network model and a second network model.

[0040] In operation S210, the first target text data is input to the first network model to obtain an answer extraction result corresponding to the first target text data.

[0041] In operation S220, the second target text data and the answer extraction result are input to the second network model to obtain a question result corresponding to the second target text data.

[0042] In operation S230, based on the answer extraction result and the question result, a question and answer pair is generated.

[0043] The first target text data and the second target text data can include text data in a document corpus, and can include preprocessed text data. The preprocessing can include data cleaning, data deduplication processing, etc.

[0044] The first network model and the second network model can include a neural network model to be trained using a machine learning algorithm.

[0045] Unlike directly extracting question and answer pairs (questions, answers) in text data, the method for generating question and answer pairs using a neural network model provided by the embodiment divides the process of extracting question and answer pairs into multiple stages. Through repeated analysis and practice, it is found that the answer part in the question and answer pair is obtained by extracting from the original text in the text data, and the question part in the question and answer pair can be extracted from the original text in the text data, or can be extracted from the answer, that is, the question has a relationship with the original text and the answer. Therefore, the method for generating question and answer pairs using a neural network model provided by the embodiment divides the process of extracting question and answer pairs into three stages, such as the first stage, text data→answer, the second stage, (text data, answer)→question, and the third stage, (answer extraction result, question result)→question and answer pair.

[0046] Different from locating the answer range according to the keywords, the method for generating the question and answer pair using the neural network model provided in the embodiment can directly obtain the answer extraction result corresponding to the first target text data by using the first network model. It can be seen that the process of extracting the answer does not need to give the keywords artificially, and avoids the dependency of the part of speech of the keywords, which leads to the extraction of the answer in a certain aspect, thereby no longer limiting the range of the knowledge base construction.

[0047] The method for generating the question and answer pair using the neural network model provided in the embodiment solves the case that the relevant keywords of the question are outside the answer content by inputting the second target text data and the answer extraction result into the second network model to obtain the question result corresponding to the second target text data. For example, in the processing of official documents, the relevant keywords of the question can be in the title of the article. If the question is generated only in the answer, it is easy to cause an error generation result. Therefore, the second target text data and the answer extraction result are used as the input data of the network model to avoid the generation of the error question generation result, and the range of the knowledge base construction is no longer limited.

[0048] The method for generating the question and answer pair using the neural network model provided in the embodiment divides the process of extracting the question and answer pair into multiple stages, decouples the answer generation and the question generation, inputs the first target text data into the first network model to obtain the answer extraction result corresponding to the first target text data, inputs the second target text data and the answer extraction result into the second network model to obtain the question result corresponding to the second target text data, and generates the question and answer pair based on the answer extraction result and the question result. The method can avoid the dependency of the generation process of the answer on the part of speech of the keywords, which leads to the extraction of the answer in a certain aspect, thereby no longer limiting the range of the knowledge base construction. The second target text data and the answer extraction result are used as the input data of the network model to avoid the generation of the error question generation result. At the same time, the method uses the network model to improve the extraction efficiency of the question and answer pair, and the extracted question and answer pair is more complete.

[0049] The first target text data and / or the second target text data are obtained by the following method: obtaining text data; wherein the text data includes text data of a standard document; obtaining relevant information of the standard document, the relevant information including the standard document and format information corresponding to the standard document; performing text decomposition processing on the text data based on the relevant information of the standard document to obtain a text decomposition processing result corresponding to the text data; and obtaining one or more of the first target text data and the second target text data based on the text decomposition processing result corresponding to the text data; wherein the text decomposition processing includes a regular method.

[0050] The standard document can be a standard document issued by a standard committee such as a national standard committee or an industry standard committee, or a standard document such as a regulation document. The format information corresponding to the standard document can include information related to the format requirements of the standard document. The standard document has fixed format requirements, such as term information and interpretation information of the term. In the table of contents chapter, there is a chapter of terms, and for some proper nouns, i.e., terms, there are standard definitions. For example, cover requirements information, such as first-level title requirements information, second-level title requirements information, page setting requirements information, and header and footer requirements information, etc. Specifically, it can include font requirements, paragraph requirements, and related requirements of tab stops.

[0051] For example, taking a regulation document as an example, the standard document includes a document title, a table of contents, a body, and an appendix. For example, obtaining a document corpus, i.e., text data, thereby obtaining one or more of the first target text data and the second target text data in the document corpus. Obtaining the related information of the standard document, it can be understood that the document corpus is written in a fixed format, such as a regulation document, which includes a document title, a table of contents, a body, and an appendix. The body content includes a first-level title (such as Chapter 1 XXX), a second-level title (such as Article 1 XXX), and the specific content of the article. Based on the related information of the standard document, the text data is processed by text decomposition, thereby obtaining one or more of the first target text data and the second target text data based on the text decomposition processing result corresponding to the text data.

[0052] For example, the regular method is used to decompose the body content, and the body content is expressed as a tree structure, as shown in Table 1:

[0053] Table 1 Comparison table of decomposition processing

[0054] Before decomposition processing After decomposition processing Article 9 The social recruitment employee grading process is divided into three links: "XXXXX", "XXXXX", and "XXXXXXX". Article 10 The position demand is clear. When the recruitment position demand is proposed, it should be benchmarked against the professional competence development system, analyze the talent team structure, determine the position quantity, position JD (duties and requirements), position level (corresponding job level range), and position salary range. The position classification should correspond to the first and second sequences of the company's professional competence development system and the ability level of the recruitment position. The position description should be adjusted according to the description in the "Professional Competence Assessment Standard (2020 Edition)" in the professional competence development system, closely combined with the actual demand, and avoid cross-ability level and cross-sequence description. The estimated salary of the position should be within the corresponding salary range of the ability level, and will be included in the total cost of the unit's salary in the future. {The social recruitment employee grading process is divided into three links: "XXXXX", "XXXXX", and "XXXXXXX". The position demand is clear. When the recruitment position demand is proposed, it should be benchmarked against the professional competence development system, analyze the talent team structure, determine the position quantity, position JD (duties and requirements), position level (corresponding job level range), and position salary range. The position classification should correspond to the first and second sequences of the company's professional competence development system and the ability level of the recruitment position. The position description should be adjusted according to the description in the "Professional Competence Assessment Standard (2020 Edition)" in the professional competence development system, closely combined with the actual demand, and avoid cross-ability level and cross-sequence description. The estimated salary of the position should be within the corresponding salary range of the ability level, and will be included in the total cost of the unit's salary in the future.}

[0055] The method for generating a question and answer pair provided by the embodiment uses a neural network model to generate a question and answer pair. The text data is processed by text decomposition based on the related information of the standard document, and the regular matching is used to obtain one or more of the first target text data and the second target text data. The standard document has fixed format requirements, which is beneficial for more intelligent text decomposition processing. At the same time, the regular method has stronger ability to capture strings than the analyzer, and can quickly and flexibly obtain one or more of the first target text data and the second target text data.

[0056] The first network model includes a language representation model, and the second network model includes a sequence-to-sequence model.

[0057] Language representation models can include BERT (Bidirectional Encoder Representation from Transformers). BERT learns good feature representations for words by running a self-supervised learning method on massive corpora. Self-supervised learning refers to supervised learning performed on unlabeled data. In specific NLP tasks, BERT's feature representations can be directly used as word embeddings. Therefore, BERT provides a model for transfer learning in other tasks; it can be fine-tuned or fixed as a feature extractor depending on the task. BERT's most significant feature is that it abandons traditional RNNs and CNNs, using an attention mechanism to convert the distance between two words at any position to 1, effectively solving the thorny long-term dependency problem in NLP.

[0058] Figure 3 A flowchart illustrating the extraction of answers using a language representation model according to an embodiment of this disclosure is shown, see below. Figure 3 The text data 310 is processed to obtain sentences sen1 320, sen2 321, and senn 322; sentences sen1 320, sen2 321, and senn 322 are input into the language representation model and converted into vec vectors to obtain Vec1 340, Vec2 341, and Vecn 342; based on Vec1 340, Vec2 341, and Vecn 342, multi-label classification 350 is performed to obtain the answer extraction result 360.

[0059] For example, the main text is first segmented into sentences (sen) and input into the BERT model, which converts them into vec vectors. To facilitate batch training, the input text can be padded into m*n codes, where m is the uniform sentence length and n is the uniform number of sentences in the article. After passing through the BERT model, this is converted into 756*n sentence vectors. Assuming the text sentence sequence to be identified has a length of n, we can assume that each entity to be identified is a continuous segment of that sequence, with unlimited length, and can be nested (there is an intersection between two entities). Then, how many "candidate entities" are there in this sequence? The answer is n(n+1) / 2, meaning that a sequence of n sentences has n(n+1) / 2 distinct continuous subsequences. These subsequences contain all possible answers. Then, the true answer combination is selected from these n(n+1) / 2 "candidate answers". This is used to handle the multi-label classification problem of "choosing k from n(n+1) / 2", where k is the number of answers. If sen3 and sen4 are answer sentences, the matrix position of 1 determines the starting and ending sentences of the answer, thus obtaining the answer extraction result.

[0060] The sequence-to-sequence model can include a Seq2Seq model, i.e., a Sequence-to-Sequence model. For example, the sequence-to-sequence model includes a language representation model and a language model, i.e., a Seq2Seq model is constructed in the manner of BERT (language representation model) + UniLM (language model, Unified Language Model Pre-training for Natural Language Understanding and Generation).

[0061] The language model UniLM is a multi-layer Transformer network, but UniLM can simultaneously complete three pre-training objectives, including sequence-to-sequence training, so it has good performance on the NLG task.

[0062] The method for generating a question and answer pair using a neural network model provided in this embodiment includes a language representation model in the first network model and a sequence-to-sequence model in the second network model, which is beneficial to obtaining an answer extraction result and a question result in different training stages, thereby generating a question and answer pair.

[0063] The sequence-to-sequence model includes a language representation model and a language model.

[0064] The language representation model can include a BERT model, i.e., a Bidirectional Encoder Representation from Transformers model. The language model can include a UniLM model, i.e., a Unified Language Model Pre-training for Natural Language Understanding and Generation model.

[0065] The method for generating a question and answer pair using a neural network model provided in this embodiment can quickly and accurately obtain a question result through the sequence-to-sequence model constructed by the language representation model and the language model.

[0066] Figure 4 A flowchart of a method for training a neural network model according to an embodiment of the present disclosure is schematically shown.

[0067] As shown in Figure 4 This embodiment includes operations S410-S430, and the method for training the neural network model can be executed by a server.

[0068] At operation S410, a neural network model to be trained is constructed based on a language representation model and a language model.

[0069] At operation S420, the text data is parsed to obtain title data, body data corresponding to the title data, and answer data.

[0070] At operation S430, the title data, the body data corresponding to the title data, and the answer data are input as sample input data, and a machine learning algorithm is used to train the neural network model to be trained.

[0071] The neural network model to be trained can include a Seq2Seq model, i.e., a Sequence-to-Sequence model. The language representation model can include a BERT model, i.e., a Bidirectional Encoder Representation from Transformers model. The language model is a Unified Language Model Pre-training for Natural Language Understanding and Generation model. The language model UniLM is a multi-layer Transformer network, but UniLM can complete three pre-training objectives at the same time, including sequence-to-sequence training methods, so it has good performance on the NLG task.

[0072] Since the text data is written in a fixed format, the title data, the body data corresponding to the title data, and the answer data can be obtained by parsing the text data. By inputting the title data, the body data corresponding to the title data, and the answer data as sample input data, the two cases that the relevant keywords in the question appear in the chapter name or the answer sentence can be handled, and rich questioning methods are provided, such as when the text is intercepted, the chapter is "chapter name" + "first sentence of the chapter" + "last sentence of the chapter", and the answer is "answer sentence". A threshold can also be set, and if the question is relatively short and less than the threshold, no interception is performed. Further, the machine learning algorithm is used to train the neural network model to be trained, and when the answer is nested, the longest text answer is taken during the training process.

[0073] Figure 5 An execution schematic diagram of a sequence-to-sequence model according to an embodiment of the present disclosure is schematically shown, referring to FIG. 4. Figure 5The text data 510 is obtained, the text data 510 is processed, title data 520, text data 521 corresponding to the title data, and answer data 522 are obtained by parsing, and then the title data 520, the text data 521 corresponding to the title data, and the answer data 522 are input as sample input data into a neural network model to be trained, such as a sequence-to-sequence model 530 based on a language representation model and a language model, and a sequence-to-sequence model 530 is trained by using a machine learning algorithm to obtain a question result 540 output by the sequence-to-sequence model 530.

[0074] The training method of the neural network model provided in this embodiment effectively solves the case that the relevant keywords of the question are not in the passage by taking the title data, the text data corresponding to the title data, and the answer data as sample input data and training the neural network model to be trained by using a machine learning algorithm. The neural network model can generate a question by using the title data, the text data corresponding to the title data, and the answer data together, which is beneficial to input the second target text data and the answer extraction result into a second network model to obtain a question result corresponding to the second target text data.

[0075] The answer data includes an answer extraction result. The answer extraction result is obtained by the following operation: taking text data as sample input data; and training a language representation model to be trained by using a machine learning algorithm according to the sample input data to obtain an answer extraction result corresponding to the sample input data.

[0076] The answer data can include an answer extraction result. The answer extraction result can be obtained by using a trained language representation model. The language representation model is trained by using a machine learning algorithm, and the text data can be taken as sample input data, and the answer extraction result corresponding to the sample input data can be taken as an output result.

[0077] The training method of the neural network model provided in this embodiment is beneficial to quickly obtaining answer data, that is, taking the answer extraction result as the answer data, and the answer extraction result can be directly obtained by using a trained language representation model.

[0078] Figure 6 A structural block diagram of an apparatus for generating a question and answer pair by using a neural network model according to an embodiment of the present disclosure is schematically shown.

[0079] As Figure 6 shown, the apparatus 600 for generating a question and answer pair by using a neural network model in this embodiment includes a determination answer module 610, a determination question module 620, and a generation question and answer pair module 630.

[0080] The determining answer module 610 is configured to input the first target text data into a first network model to obtain an answer extraction result corresponding to the first target text data. The determining question module 620 is configured to input the second target text data and the answer extraction result into a second network model to obtain a question result corresponding to the second target text data. The generating question and answer pair module 630 is configured to generate a question and answer pair based on the answer extraction result and the question result.

[0081] In some embodiments, the first target text data and / or the second target text data is obtained by: obtaining text data; wherein the text data comprises text data of a standard document; obtaining related information of the standard document, the related information comprising: the standard document and format information corresponding to the standard document; performing text decomposition processing on the text data based on the related information of the standard document to obtain a text decomposition processing result corresponding to the text data; and obtaining one or more of the first target text data and the second target text data based on the text decomposition processing result corresponding to the text data; wherein the text decomposition processing comprises a regular method.

[0082] In some embodiments, the first network model comprises a language representation model, and the second network model comprises a sequence-to-sequence model.

[0083] In some embodiments, the sequence-to-sequence model comprises a language representation model and a language model.

[0084] According to embodiments of the present disclosure, any one or more of the determining answer module 610, the determining question module 620, and the generating question and answer pair module 630 can be combined in one module, or any one of them can be split into multiple modules. Alternatively, at least part of the function of one or more of these modules can be combined with at least part of the function of other modules, and implemented in one module. According to embodiments of the present disclosure, at least one of the determining answer module 610, the determining question module 620, and the generating question and answer pair module 630 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of integrating or packaging a circuit, etc. hardware or firmware, or in any one of software, hardware and firmware implementation or in a suitable combination of any one or more of them. Alternatively, at least one of the determining answer module 610, the determining question module 620, and the generating question and answer pair module 630 can be at least partially implemented as a computer program module that can perform corresponding functions when the computer program module is run.

[0085] Figure 7 A structural block diagram of a training apparatus of a neural network model according to an embodiment of the present disclosure is shown schematically.

[0086] As shown in Figure 7 The training apparatus 700 of the neural network model of this embodiment includes a construction module 710, an analysis module 720, and a training module 730.

[0087] The construction module 710 is configured to construct a neural network model to be trained based on a language representation model and a language model. The analysis module 720 is configured to analyze text data to obtain title data, text data corresponding to the title data, and answer data. The training module 730 is configured to input the title data, the text data corresponding to the title data, and the answer data as sample input data, and train the neural network model to be trained using a machine learning algorithm.

[0088] In some embodiments, the answer data includes an answer extraction result, and the answer extraction result is obtained by inputting the text data as sample input data, and training a language representation model to be trained using a machine learning algorithm according to the sample input data to obtain an answer extraction result corresponding to the sample input data.

[0089] According to an embodiment of the present disclosure, any of the construction module 710, the analysis module 720, and the training module 730 can be combined in one module, or any of the modules can be split into multiple modules. Alternatively, at least part of the function of one or more of the modules can be combined with at least part of the function of the other modules, and implemented in one module. According to an embodiment of the present disclosure, at least one of the construction module 710, the analysis module 720, and the training module 730 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on board, a system on package, an application specific integrated circuit (ASIC), or any other reasonable manner that can be integrated or packaged by a circuit, etc. hardware or firmware, or in any one of software, hardware, and firmware or in any appropriate combination of any of them. Alternatively, at least one of the construction module 710, the analysis module 720, and the training module 730 can be at least partially implemented as a computer program module that can perform corresponding functions when the computer program module is run.

[0090] Figure 8 A block diagram of an electronic device suitable for implementing a method of generating a question and answer pair using a neural network model and / or a training method of a neural network model according to an embodiment of the present disclosure is shown schematically.

[0091] As shown inFigure 8 As shown, the electronic device 800 according to embodiments of the present disclosure includes a processor 801 that can perform various appropriate actions and processes in accordance with a program stored in a read only memory (ROM) 802 or a program loaded into a random access memory (RAM) 803 from a storage section 808. The processor 801 can include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor, and / or a related chipset, and / or a special purpose microprocessor (e.g., an application specific integrated circuit (ASIC)), and so on. The processor 801 can also include an on-board memory for cache use. The processor 801 can include a single processing unit or multiple processing units for executing different actions of the method processes according to embodiments of the present disclosure.

[0092] In the RAM 803, various programs and data required for the operation of the electronic device 800 are stored. The processor 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. The processor 801 performs various operations of the method processes according to embodiments of the present disclosure by executing the programs in the ROM 802 and / or the RAM 803. Note that the programs can also be stored in one or more memories other than the ROM 802 and the RAM 803. The processor 801 can also perform various operations of the method processes according to embodiments of the present disclosure by executing the programs stored in the one or more memories.

[0093] According to embodiments of the present disclosure, the electronic device 800 can further include an input / output (I / O) interface 805 that is also connected to the bus 804. The electronic device 800 can further include one or more of the following components connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as necessary. A removable recording medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 810 as necessary, so that a computer program read out therefrom is installed in the storage section 808 as necessary.

[0094] The present disclosure also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments, or can exist independently without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present disclosure.

[0095] According to embodiments of the present disclosure, the computer readable storage medium can be a non-volatile computer readable storage medium, which can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer readable storage medium can include the ROM 802 and / or the RAM 803 described above, and / or one or more memories other than the ROM 802 and the RAM 803.

[0096] Embodiments of the present disclosure also include a computer program product, which includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the method for generating a question-answer pair using a neural network model and the training method of the neural network model provided by the embodiments of the present disclosure.

[0097] The above functions defined in the system / apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 801. According to embodiments of the present disclosure, the system, apparatus, module, unit, etc. described above can be implemented by computer program modules.

[0098] In one embodiment, the computer program can rely on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program can also be transmitted, distributed, and downloaded in the form of a signal via a network medium, and be downloaded and installed through the communication part 809 and / or installed from the detachable medium 811. The program codes contained in the computer program can be transmitted by any appropriate network medium, including but not limited to wireless, wired, etc., or any suitable combination of the foregoing.

[0099] In such embodiments, the computer program can be downloaded and installed from the network via the communication section 809, and / or installed from the removable media 811. When the computer program is executed by the processor 801, the above-described functions defined in the system of the embodiments of the present disclosure are executed. According to the embodiments of the present disclosure, the system, device, apparatus, module, unit, and the like described above can be implemented by the computer program modules.

[0100] According to the embodiments of the present disclosure, the program code for executing the computer program provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages, and specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming language, and / or assembly / machine language. The programming language includes, but is not limited to, such as Java, C++, python, “C” language or similar programming language. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case involving a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, connected to the Internet through an Internet service provider).

[0101] The flowcharts and block diagrams in the drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the drawings. For example, two blocks noted in succession can in fact be executed substantially concurrently or in the reverse order, depending on the functionality involved. It should also be noted that each block in the flowcharts or block diagrams, and combinations of blocks in the flowcharts or block diagrams, can be implemented by dedicated hardware-based systems that perform the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0102] Those skilled in the art can understand that the features described in various embodiments of the present disclosure and / or claims can be combined or / and integrated, even if such combinations or integrations are not explicitly described in the present disclosure. In particular, the features described in various embodiments of the present disclosure and / or claims can be combined and / or integrated in various combinations, without departing from the spirit and teachings of the present disclosure. All these combinations and / or integrations fall within the scope of the present disclosure.

[0103] The above describes embodiments of the present disclosure. However, these embodiments are merely for illustrative purposes, and are not intended to limit the scope of the present disclosure. Although each embodiment is described above separately, this does not mean that the measures in each embodiment cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Those skilled in the art can make various substitutions and modifications without departing from the scope of the present disclosure, and all such substitutions and modifications shall fall within the scope of the present disclosure.

Claims

1. A method for generating question-answer pairs using a neural network model, said neural network model comprising a first network model and a second network model, the method comprising: The first target text data is input into the first network model to obtain the answer extraction result corresponding to the first target text data; The second target text data and the answer extraction result are input into the second network model to obtain the question result corresponding to the second target text data; as well as Based on the answer extraction results and the question results, a question-answer pair is generated; The second network model was trained in the following manner: A second network model to be trained is constructed based on the language representation model and the language model. Parse the text data to obtain title data, body text data corresponding to the title data, and answer data; as well as The title data, the corresponding body text data, and the answer data are used as sample input data. A machine learning algorithm is used to train the second network model to be trained. The second network model is used to obtain the question results corresponding to the sample input data.

2. The method according to claim 1, wherein, The first target text data, and / or the second target text data, are obtained in the following ways: Acquire text data; wherein, the text data includes text data from standard documents; Obtain relevant information about the standard document, including the standard document and the format information corresponding to the standard document; Based on the relevant information in the standard document, the text data is decomposed to obtain a text decomposition result corresponding to the text data; and Based on the text decomposition processing results corresponding to the text data, one or more of the first target text data and the second target text data are obtained; The text decomposition process includes regular expressions.

3. The method according to claim 1 or 2, wherein, The first network model includes a language representation model, and the second network model includes a sequence-to-sequence model.

4. The method according to claim 3, wherein, The sequence-to-sequence model includes language representation models and language models.

5. An apparatus for generating question-answer pairs using a neural network model, said neural network model comprising a first network model and a second network model, the apparatus comprising: The answer determination module is used to input the first target text data into the first network model and obtain the answer extraction result corresponding to the first target text data; The question determination module is used to input the second target text data and the answer extraction result into the second network model to obtain the question result corresponding to the second target text data; as well as The question-answer pair generation module is used to generate question-answer pairs based on the answer extraction results and the question results; The second network model was trained in the following manner: A second network model to be trained is constructed based on the language representation model and the language model. Parse the text data to obtain title data, body text data corresponding to the title data, and answer data; as well as The title data, the corresponding body text data, and the answer data are used as sample input data. A machine learning algorithm is used to train the second network model to be trained. The second network model is used to obtain the question results corresponding to the sample input data.

6. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 4.

7. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 4.

8. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Question and answer pair generation method and device, and server

    CN110532369A