Question-answer pair generation method, device, electronic device and storage medium

By converting the paragraph text into the target text type and generating question-answer pairs, the problem of poor generalization ability and low accuracy of the question and answer system is solved, and the user experience is improved.

CN117933235BActive Publication Date: 2024-10-29TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410095943.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-23
Publication Date
2024-10-29
Estimated Expiration
2044-01-23

AI Technical Summary

Technical Problem

The existing question and answer system has poor generalization ability, and when providing answers, the accuracy rate is low due to inaccurate question recognition, which affects the user experience.

Method used

By obtaining paragraph text and identifying its target text type, converting it to the target text type, extracting question answer pairs, and generating accurate question answer pairs through multi-task models and entity naming, the generalization ability and accuracy of the question answering system are improved.

Benefits of technology

It has improved the diversity of question answer pairs and the generalization ability of the question and answer system, improved the user experience, and solved the problems of poor generalization ability and low accuracy of the question and answer system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117933235B_ABST
    Figure CN117933235B_ABST
Patent Text Reader

Abstract

The present application relates to the field of natural language processing technology, and in particular to a method, device, electronic device and storage medium for generating question-answer pairs, wherein the method comprises: obtaining paragraph text, and identifying the target text type to be converted corresponding to the paragraph text; inputting the paragraph text into a trained language model, and converting the paragraph text into a target text corresponding to the target text type; extracting at least one question-answer pair from the target text, wherein the question-answer pair includes a question and an answer corresponding to the question; and determining a target question-answer pair from at least one question-answer pair. Thus, the technical problem that the question-answer system trained in the related art is poor in generalization ability because it is only for existing articles and its text type is relatively single, and in addition, when providing answers to the questions posed, the wrong answers are provided due to the inaccurate questions identified, which makes the accuracy of the question-answer system low and affects the user experience is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of natural language processing, and in particular to a method, device, electronic device and storage medium for generating question-answer pairs. Background Art

[0002] With the continuous development of speech recognition, question-answering systems are becoming more and more important. Question-answering systems are used to provide corresponding answers to questions asked in natural language.

[0003] In the related technology, the main implementation process is: when training the question-answering system, an article is first given, and then the document is split into several sentences or paragraphs, and question-answer pairs are generated from the split paragraphs or sentences. However, the generation of question-answer pairs often requires manual intervention, for example, manual labeling of questions or answers, and finally the question-answer pairs are used as training data for training the question-answering system.

[0004] However, in the related technology, only existing articles are targeted, and the text type is relatively single, so the generalization ability of the trained question-answering system is poor. In addition, when providing answers to the questions asked, the questions are not accurately identified, resulting in wrong answers, which leads to low accuracy of the question-answering system, affecting the user experience, and urgently needs to be improved. Summary of the invention

[0005] The present application provides a method, device, electronic device and storage medium for generating question-answer pairs to solve the technical problems in the related art that the question-answering system is only trained for existing articles with a relatively single text type, and thus has poor generalization ability. In addition, when providing answers to the questions raised, the questions are not accurately identified, resulting in wrong answers being provided, which leads to low accuracy of the question-answering system and affects the user experience.

[0006] The first aspect of the present application provides a method for generating a question-answer pair, comprising the following steps: obtaining a paragraph text, and identifying a target text type to be converted corresponding to the paragraph text; inputting the paragraph text into a trained language model, and converting the paragraph text into a target text corresponding to the target text type; extracting at least one question-answer pair from the target text, wherein the question-answer pair includes a question and an answer corresponding to the question; and determining a target question-answer pair from at least one question-answer pair.

[0007] Optionally, in one embodiment of the present application, inputting the paragraph text into a trained language model to convert the paragraph text into a target text corresponding to the target text type includes: generating a prompt text based on the target text type and the paragraph text, wherein the prompt text is text prompting to convert the paragraph text into the target text type; inputting the prompt text into the trained language model to obtain the language model outputting the target text.

[0008] Optionally, in one embodiment of the present application, extracting at least one question-answer pair from the target text includes: obtaining a target noun referred to by a pronoun in the target text, and replacing the pronoun with the target noun to obtain a replacement text; inputting the replacement text into a preset multi-task model to obtain at least one triple output by the multi-task model; performing entity naming on the elements in the triple to obtain at least one entity triple; and generating at least one question-answer pair based on the at least one entity triple and a preset question template.

[0009] Optionally, in one embodiment of the present application, the multi-task model includes a shared encoder, an extraction task decoder, and a classification task decoder, the shared encoder and the extraction task decoder implement the extraction of triples, and the shared encoder and the classification task decoder implement the classification of phrases of the replacement text, wherein the inputting the replacement text into a preset multi-task model to obtain at least one triple output by the multi-task model includes: inputting the replacement text into the shared encoder to obtain a vector encoding sequence corresponding to the replacement text; inputting the vector encoding sequence into the extraction task decoder and the classification task decoder respectively to obtain at least one initial triple output by the extraction task decoder and a classification result of the replacement text output by the classification task decoder, wherein the classification result includes the part of speech of each phrase in the replacement text; adjusting each initial triple according to the classification result to obtain at least one adjusted triple, and determining the adjusted triple as the triple output by the multi-task model.

[0010] Optionally, in one embodiment of the present application, the entity triple includes a subject, a predicate and an object, and the question template includes a question word and a slot to be filled, wherein generating at least one question-answer pair based on at least one of the entity triples and the preset question template includes: when there are multiple entity triples, recording the entity triples with the same subject or object as an entity triple combination, and recording the entity triples without the same subject or object as separate entity triples; for each entity triple in the entity triple combination, recording the subject or object in the entity triple that is the same as that of other entity triples as the answer, and recording the subject or object that is not recorded as the answer. The recorded object or subject, and predicate are filled into the slot to be filled; according to the unrecorded object or subject, and predicate, a first target question word is determined; the first target question word and the content of the slot to be filled are combined to obtain the question corresponding to the entity triple; for each individual entity triple, the subject or object of the individual entity triple is recorded as the answer, and the unrecorded object or subject, and predicate are filled into the slot to be filled; according to the unrecorded object or subject, and predicate, a second target question word is determined; the second target question word and the content of the slot to be filled are combined to obtain the question corresponding to the individual entity triple.

[0011] Optionally, in one embodiment of the present application, determining a target question-answer pair from at least one question-answer pair includes: inputting the question in the at least one question-answer pair and the paragraph text into a trained reward model to obtain a matching value between each of the question and the paragraph text; and taking the question-answer pair containing the question having a matching value greater than a preset matching value threshold as the target question-answer pair.

[0012] Optionally, in one embodiment of the present application, after determining the target question-answer pair, it also includes: obtaining the target question text type; using the language model to convert the target question in each of the target question-answer pairs into a synonymous question of the target question text type; for each target question-answer pair, combining the synonymous question of the target question and the target answer in the target question answer pair into a new question-answer pair.

[0013] The second aspect of the present application provides a question-answer pair generation device, including: a first acquisition module, used to acquire paragraph text and identify the target text type to be converted corresponding to the paragraph text; an input module, used to input the paragraph text into a trained language model, and convert the paragraph text into a target text corresponding to the target text type; an extraction module, used to extract at least one question-answer pair from the target text, wherein the question-answer pair includes a question and an answer corresponding to the question; and a generation module, used to determine a target question-answer pair from at least one question-answer pair.

[0014] Optionally, in one embodiment of the present application, the input module includes: a generation unit, used to generate a prompt text according to the target text type and the paragraph text, wherein the prompt text is a text prompting to convert the paragraph text into the target text type; and an output unit, used to input the prompt text into the trained language model to obtain the language model to output the target text.

[0015] Optionally, in one embodiment of the present application, the extraction module includes: an acquisition unit, used to acquire a target noun referred to by a pronoun in the target text, and replace the pronoun with the target noun to obtain a replacement text; a first input unit, used to input the replacement text into a preset multi-task model to obtain at least one triple output by the multi-task model; an entity naming unit, used to perform entity naming on the elements in the triple to obtain at least one entity triple; and a generation unit, used to generate at least one question-answer pair based on the at least one entity triple and a preset question template.

[0016] Optionally, in one embodiment of the present application, the multi-task model includes a shared encoder, an extraction task decoder, and a classification task decoder, the shared encoder and the extraction task decoder implement the extraction of triples, and the shared encoder and the classification task decoder implement the classification of phrases of the replacement text, wherein the first input unit includes: a first input subunit, used to input the replacement text into the shared encoder to obtain a vector encoding sequence corresponding to the replacement text; a second input subunit, used to input the vector encoding sequence into the extraction task decoder and the classification task decoder respectively, to obtain at least one initial triple output by the extraction task decoder and a classification result of the replacement text output by the classification task decoder, wherein the classification result includes the part of speech of each phrase in the replacement text; an output subunit, used to adjust each initial triple according to the classification result to obtain at least one adjusted triple, and determine the adjusted triple as the triple output by the multi-task model.

[0017] Optionally, in one embodiment of the present application, the entity triple includes a subject, a predicate and an object, the question template includes a question word and a slot to be filled, wherein the generation unit includes: a first recording subunit, for, when there are multiple entity triples, recording the entity triples with the same subject or object as an entity triple combination, and recording the entity triples without the same subject or object as separate entity triples; a second recording subunit, for, for each entity triple in the entity triple combination, recording the subject or object in the entity triple that is the same as other entity triples as an answer, and recording the object or subject that is not recorded as an answer. and predicate to fill the slot to be filled; determine a first target question word according to the unrecorded object or subject, and the predicate; combine the first target question word and the content of the slot to be filled to obtain the question corresponding to the entity triple; a third recording subunit is used to record the subject or object of the individual entity triple as the answer for each individual entity triple, and fill the slot to be filled with the unrecorded object or subject, and the predicate; determine a second target question word according to the unrecorded object or subject, and the predicate; combine the second target question word and the content of the slot to be filled to obtain the question corresponding to the individual entity triple.

[0018] Optionally, in one embodiment of the present application, the generation module includes: a second input unit, used to input the question in the at least one question-answer pair and the paragraph text into a trained reward model to obtain a matching value between each question and the paragraph text; and a determination unit, used to take the question-answer pair containing the question whose matching value is greater than a preset matching value threshold as the target question-answer pair.

[0019] Optionally, in one embodiment of the present application, it also includes: a second acquisition module, used to obtain the target question text type after the target question-answer pair is determined; a conversion module, used to use the language model to convert the target question in each of the target question-answer pairs into a synonymous question of the target question text type; a new generation module, used to form a new question-answer pair for each target question-answer pair by combining the synonymous question of the target question and the target answer in the target question answer pair.

[0020] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the question-answer pair generating method as described in the above embodiment.

[0021] The fourth aspect of the present application provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, implements the above-mentioned question-answer pair generating method.

[0022] The fifth aspect of the present application provides a computer program, which, when executed, is used to implement the above-mentioned method for generating question-answer pairs.

[0023] The embodiment of the present application can utilize a language model to convert a paragraph text into a target text of a target text type, and then extract at least one question answer pair from the target text, and determine the target question answer pair from the question answer pair. The embodiment of the present application can perform text type conversion on the paragraph text for generating question answer pairs through a language model, and generate question answer pairs through the converted text, thereby achieving the improvement of the diversity of generating question answer pairs, improving the generalization ability and accuracy of the question-answering system, and improving the user experience. Thus, the related art is solved, which is only for existing articles, and its text type is relatively single, so the generalization ability of the question-answering system obtained by training is poor. In addition, when providing answers to the questions raised, due to the inaccurate questions identified, wrong answers are provided, thereby resulting in the low accuracy of the question-answering system, affecting the user experience and other technical problems.

[0024] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0026] Figure 1 A flowchart of a method for generating question-answer pairs according to an embodiment of the present application;

[0027] Figure 2 A flowchart of a method for extracting a question answer from a target text according to an embodiment of the present application;

[0028] Figure 3 A schematic diagram of the structure of a multi-task model provided according to an embodiment of the present application;

[0029] Figure 4 A block diagram of a question-answer pair generating device provided according to an embodiment of the present application;

[0030] Figure 5 It is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0031] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0032] The following describes the method, device, electronic device and storage medium for generating question-answer pairs in the embodiment of the present application with reference to the accompanying drawings. In view of the fact that the above-mentioned background technology is only for existing articles, the text type is relatively single, so the generalization ability of the question-answer system obtained by training is poor. In addition, when providing answers to the questions raised, due to the inaccurate questions identified, wrong answers are provided, resulting in low accuracy of the question-answer system, which affects the technical problems of user experience. The present application provides a method for generating question-answer pairs, in which a language model can be used to convert paragraph text into a target text of a target text type, and then at least one question-answer pair can be extracted from the target text, and the target question-answer pair can be determined from the question-answer pair. The embodiment of the present application can convert the text type of the paragraph text for generating the question-answer pair through the language model, and generate the question-answer pair through the converted text, thereby improving the diversity of the generated question-answer pairs, improving the generalization ability and accuracy of the question-answer system, and improving the user experience. This solves the problem that the related technology only targets existing articles with a relatively single text type, so the trained question-answering system has poor generalization ability. In addition, when providing answers to the questions raised, the questions are not accurately identified, resulting in wrong answers, which leads to low accuracy of the question-answering system and affects user experience.

[0033] Specifically, Figure 1 The present invention is a flowchart of a method for generating question-answer pairs according to an embodiment of the present application.

[0034] like Figure 1 As shown, the question-answer pair generation method includes the following steps:

[0035] In step S101, a paragraph text is obtained, and the target text type to be converted corresponding to the paragraph text is identified.

[0036] It is not difficult to understand that the paragraph text can be a text separated from a preset article or a text separated from a preset website, and this application does not make specific restrictions. Among them, the paragraph text can include one sentence or multiple sentences, and this application does not make specific restrictions.

[0037] The target text type can be but is not limited to a text type different from a paragraph text, wherein the text type can be but is not limited to: spoken type, prose type, novel type, poetry type, news type, email type, report type, web page type, and explanatory text type, etc. This application does not make specific restrictions.

[0038] In some embodiments, there may be multiple paragraph texts in the preset corpus. Based on this, the embodiments of the present application can directly obtain at least one paragraph text from the preset corpus.

[0039] In other embodiments, there may be multiple articles in a preset corpus. Based on this, the embodiments of the present application can obtain at least one article from the corpus and split the obtained article to obtain at least one paragraph text.

[0040] In some embodiments, after obtaining the paragraph text, the embodiments of the present application can obtain any text type from a preset text type library as the target text type.

[0041] In other embodiments, after acquiring the paragraph text, the embodiments of the present application can output multiple text types through a visual interface, and when a user's click operation on any text type is detected, the text type corresponding to the click operation is determined as the target text type.

[0042] In some embodiments, after acquiring the paragraph text, the embodiments of the present application can acquire the text type input by the user through a visual interface, and use the acquired text type as the target text type.

[0043] In step S102, the paragraph text is input into the trained language model, and the paragraph text is converted into a target text corresponding to the target text type.

[0044] It is understandable that the language model can be but is not limited to a pre-trained model for converting text types of paragraph texts, and this application does not impose any specific limitations.

[0045] In addition, in the embodiment of the present application, the target text can be understood as the text after the text type of the paragraph text is converted into the target text type, wherein the vocabulary of the target text and the paragraph text may be different, but the meaning expressed is the same.

[0046] That is to say, the generalization ability of the question-answer pair generated for a single paragraph text in the related art is relatively weak. Therefore, in order to improve the generalization ability of the question-answer pair, the embodiment of the present application can convert the text type of the paragraph text through the trained language model to obtain a target text with different vocabulary from the paragraph text but the same meaning.

[0047] Optionally, in one embodiment of the present application, a paragraph text is input into a trained language model, and the paragraph text is converted into a target text corresponding to a target text type, including: generating a prompt text according to the target text type and the paragraph text, wherein the prompt text is a text prompting to convert the paragraph text into a target text type; and inputting the prompt text into a trained language model to obtain a language model output target text.

[0048] As a possible implementation method, in order to more clearly express the conversion of the text type of a paragraph text into a target text type, an embodiment of the present application can generate a prompt text based on the target text type and the paragraph text, wherein the prompt text can be used to prompt the conversion of the paragraph text into text of the target text type.

[0049] Furthermore, in an embodiment of the present application, for each target text type, after generating a prompt text by combining the target text type with the paragraph text, each prompt text is input into the trained language model in turn to obtain the target text corresponding to each target text type.

[0050] For example, in the embodiment of the present application, it is assumed that the paragraph text is paragraph A, wherein the text type of paragraph A is a spoken type, and it is assumed that the target text type is a prose type, then the prompt text may be "Please describe paragraph A in prose type". Afterwards, the embodiment of the present application may input the prompt text into the trained language model, and then obtain the converted target text type output by the language model.

[0051] Furthermore, in some embodiments, in order to increase the diversity of question-answer pairs, a plurality of target texts of different text types may be generated for the paragraph text, and then at least one question-answer pair may be extracted from each target text.

[0052] In step S103, at least one question-answer pair is extracted from the target text, wherein the question-answer pair includes a question and an answer corresponding to the question.

[0053] Those skilled in the art will appreciate that a question-answer pair may include at least one question and at least one answer corresponding to the question. That is, in an embodiment of the present application, a question-answer pair may include a question and an answer, or may include multiple questions and an answer. The present application does not impose any specific limitations on this.

[0054] In the embodiment of the present application, since the target text is obtained by converting the target text type from a paragraph text, compared with extracting at least one question-answer pair only through paragraph text, the present application extracts at least one question-answer pair through the target text, thereby increasing the diversity of question-answer pair generation.

[0055] Optionally, in one embodiment of the present application, extracting at least one question-answer pair from a target text includes: obtaining a target noun referred to by a pronoun in the target text, and replacing the pronoun with the target noun to obtain a replacement text; inputting the replacement text into a preset multi-task model to obtain at least one triple output by the multi-task model; performing entity naming on the elements in the triple to obtain at least one entity triple; and generating at least one question-answer pair based on at least one entity triple and a preset question template.

[0056] As a possible implementation method, how to extract at least one answer to a question from the target text in the embodiment of the present application can be as follows: Figure 2 As shown, Figure 2 The process shown is in Figure 1 Based on the process shown, how to extract at least one question-answer pair from the target text is specifically described. The process may include the following steps:

[0057] Step S201: obtaining a target noun referred to by a pronoun in a target text, and replacing the pronoun with the target noun to obtain a replacement text.

[0058] It is not difficult to understand that the anaphora may refer to a pronoun used to indicate a noun, including but not limited to: "you", "I", "he", "it" and "she", etc. This application does not make any specific limitations.

[0059] In some embodiments, when the present application extracts at least one question-answer pair from the target text, since there may be some pronouns in the target text, if the question-answer pairs are directly extracted from the target text with pronouns, unclear expressions may occur. Therefore, the embodiment of the present application can first perform reference elimination on the target text, that is, eliminate the pronouns in the target text. Specifically, in the embodiment of the present application, the target noun referred to by at least one pronoun in the target text can be first determined, and the target noun can be replaced with the corresponding pronoun to obtain the replacement text.

[0060] For example, the embodiment of the present application may assume that the target text is "Xiao Ming, do you want to eat cake?" Through analysis, it can be known that the target noun referred to by the pronoun "you" is "Xiao Ming". Therefore, in the embodiment of the present application, "Xiao Ming" can be replaced by the pronoun "you", and the resulting replacement text can be "Xiao Ming, do you want to eat cake?"

[0061] Step S202: inputting the replacement text into a preset multi-task model to obtain at least one triplet output by the multi-task model.

[0062] It is understandable that the multi-task model can be a pre-trained model that can perform multiple tasks simultaneously, or it can be other models, and this application does not make specific restrictions. Among them, the structure of the multi-task model can be as follows: Figure 3 As shown, it will be introduced below and will not be described in detail here.

[0063] In addition, in the embodiment of the present application, the multi-task model may include a main task of extracting triples and an auxiliary task of assisting in classifying the word groups in the target text, and the extracted triples may also be corrected by classifying the word groups. Among them, triples can be understood as triples constituting the text, that is, in a sentence, the triples constituting the sentence can be the subject, predicate and object, and the present application does not make specific restrictions.

[0064] As a possible implementation method, the embodiment of the present application can extract triples of the input replacement text through a multi-task model. Further, in the embodiment of the present application, in order to improve the accuracy of extracting triples, the multi-task model can perform two tasks at the same time, wherein one task can be used to extract triples of the target text, and the other task can be used to correct the extracted triples, thereby improving the accuracy of extracting triples.

[0065] Step S203: Entity naming is performed on the elements in the triplet to obtain at least one entity triplet.

[0066] Step S204: Generate at least one question-answer pair according to at least one entity triple and a preset question template.

[0067] Step S203 and step S204 are described in detail below. The specific contents are as follows.

[0068] It is not difficult to understand that the question template can be but is not limited to a preset template for generating questions. In addition, the question template can generate corresponding question-answer pairs based on the extracted triples, and this application does not impose specific limitations.

[0069] During the actual execution process, the embodiments of the present application can perform entity naming for the extracted triples. Generally speaking, entity naming is performed on the words in the subject or object position, which can be but is not limited to place entities, person name entities, and time entities, etc. This application does not make specific restrictions.

[0070] Afterwards, the embodiment of the present application can generate at least one question-answer pair based on at least one entity triple and a preset question template.

[0071] However, in actual applications, a target text in an embodiment of the present application may contain several sentences, and a sentence can often be decomposed into at least one triple, that is, a sentence often contains a subject, a predicate, and an object. Since the decomposed triples may only generate some simple and easy-to-answer questions, in order to generate more robust questions, the embodiment of the present application can group the triples when generating question-answer pairs based on entity triples and question templates. The specific grouping method will be introduced below and will not be described in detail here.

[0072] The embodiment of the present application can determine the target noun referred to by the pronoun in the target text, replace the pronoun with the target noun to obtain a replacement text, and input the replacement text into a preset multi-task model to obtain at least one triple output by the multi-task model. For each triple, the elements in the triple are entity named to obtain an entity triple, and at least one question-answer pair is generated based on the at least one entity triple and a preset question template. The embodiment of the present application can extract triples in the target text through the multi-task model, so that the triples in the target text can be extracted more accurately to generate at least one question-answer pair based on the triples. In addition, since the question-answer pair can be directly generated based on the triples and the question template, the inefficiency of generating the question-answer pair caused by manual intervention is avoided, and the accuracy and efficiency of generating the question-answer pair are improved.

[0073] Optionally, in one embodiment of the present application, the multi-task model includes a shared encoder, an extraction task decoder, and a classification task decoder, the shared encoder and the extraction task decoder implement the extraction of triples, and the shared encoder and the classification task decoder implement the classification of phrases of the replacement text, wherein the replacement text is input into a preset multi-task model to obtain at least one triple output by the multi-task model, including: inputting the replacement text into the shared encoder to obtain a vector encoding sequence corresponding to the replacement text; inputting the vector encoding sequence into the extraction task decoder and the classification task decoder respectively to obtain at least one initial triple output by the extraction task decoder and a classification result of the replacement text output by the classification task decoder, wherein the classification result includes the part of speech of each phrase in the replacement text; adjusting each initial triple according to the classification result to obtain at least one adjusted triple, and determining the adjusted triple as the triple output by the multi-task model.

[0074] In some embodiments, the structure of the multi-task model can be as follows Figure 3As shown, the multi-task model may include a shared encoder, an extraction task decoder, and a classification task decoder. The shared encoder and the extraction task decoder may realize the extraction of triples, and the shared encoder and the classification task decoder may realize the classification of phrases of the replacement text. That is to say, in the embodiment of the present application, the triple extraction task of the multi-task model and the phrase classification task of the replacement text may share the shared encoder.

[0075] It is not difficult for the technical personnel of this application to understand that the current method of extracting more triplets is implemented through the RNN (Recurrent Neural Networks) model, but the RNN model has weak processing capabilities when dealing with long texts, and the model has poor generalization ability, and is prone to overfitting, which ultimately leads to a certain error rate in the decomposed triplets.

[0076] Therefore, in an embodiment of the present application, a method for extracting information from a multi-task model is proposed, wherein the multi-task model can be understood as multi-task learning. In an embodiment of the present application, information extraction is used as the main task, and a classification task is introduced as an auxiliary task. By sharing parameters between the two tasks, the main task can learn the knowledge of the auxiliary task, and can also prevent the model parameters in the main task from having too much influence, thereby avoiding overfitting.

[0077] Generally speaking, the embodiments of the present application assign a corresponding model to the main task and the auxiliary task for task processing, but this means that there is no association between the main task and the auxiliary task. Therefore, the multi-task model provided in the embodiments of the present application can share a shared encoder between the triple extraction task of the multi-task model and the phrase classification task of the replacement text to improve the association between the main task and the auxiliary task, thereby improving the accuracy of triple extraction.

[0078] That is to say, in an embodiment of the present application, the multi-task model can first input the replacement text into a shared encoder to obtain a vector encoding sequence corresponding to the replacement text. Then, the embodiment of the present application can input the vector encoding sequence into an extraction task decoder and a classification task decoder respectively to obtain at least one initial triple output by the extraction task decoder and a classification result of the replacement text output by the classification task decoder. Finally, each initial triple is adjusted according to the classification result to obtain at least one adjusted triple, and the adjusted triple is determined as the triple output by the multi-task model. Among them, the classification result may include the part of speech of each phrase in the replacement text. In addition, in an embodiment of the present application, the classification result can also characterize whether the part of speech of each phrase in the replacement text is a predicate.

[0079] For example, the embodiment of the present application can assume that the target text is "We went to the fragrant trail along the bend of the Mount Lu." The shared encoder can first process the input target text, mainly performing vector encoding, and mapping it into a vector encoding sequence corresponding to the text words. Then, the embodiment of the present application can input the vector encoding sequence into the information extraction task decoder and the classification task decoder respectively, and obtain the following processing results:

[0080] In the information extraction task decoder, the output obtained after decoding is a sequence with a separator, which separates the subject, predicate, and object. That is, the final output will become: "We <sep>went to <sep>thefragrant trail <sep>along the bend of the Mount Lu."

[0081] In the classification task decoder, the output obtained after decoding is a sequence of labeled predicate verbs, that is, each word / phrase in the original text is judged, and the words / phrases regarded as predicates are marked as 1, and the words / phrases not regarded as predicates are marked as 0. The output can be expressed as 01100000000000 (one word corresponds to one digital mark). Among them, this is only an example of marking, and other marking methods can also be implemented, and this application does not make specific restrictions.

[0082] In the process of decoding by the information extraction task decoder, the embodiment of the present application will consider that went is a predicate verb, and the final output result can be: "We <sep>went <sep>to the fragrant trail <sep>along the bend of the Mount Lu." At this time, in the embodiment of the present application, the obtained triplet is<We,went,tothe fragrant trail> , but the actual triple we want is<We,went to,the fragrant trail> Therefore, after introducing the output result of the classification task decoder, the embodiment of the present application can correct the errors that may occur in the information extraction task decoder, and enable the information extraction task decoder to learn the relevant knowledge in the classification task decoder, and negatively feedback to the information extraction task decoder for learning, thereby reducing the occurrence of similar situations in the future.

[0083] Optionally, in one embodiment of the present application, an entity triple includes a subject, a predicate and an object, and a question template includes a question word and a slot to be filled, wherein at least one question-answer pair is generated based on at least one entity triple and a preset question template, including: in the case of multiple entity triples, the entity triples with the same subject or object are recorded as an entity triple combination, and the entity triples without the same subject or object are recorded as separate entity triples; for each entity triple in the entity triple combination, the subject or object in the entity triple that is the same as that of other entity triples is recorded as the answer, and the The unrecorded object or subject, and the predicate are filled into the slot to be filled; the first target question word is determined according to the unrecorded object or subject, and the predicate; the first target question word and the content of the slot to be filled are combined to obtain the question corresponding to the entity triple; for each individual entity triple, the subject or object of the individual entity triple is recorded as the answer, and the unrecorded object or subject, and the predicate are filled into the slot to be filled; the second target question word is determined according to the unrecorded object or subject, and the predicate; the second target question word and the content of the slot to be filled are combined to obtain the question corresponding to the individual entity triple.

[0084] Here, the specific process of triple grouping is introduced.

[0085] It is understandable that the entity triple may include a subject, a predicate, and an object, etc., and this application does not make specific restrictions. The question template may include interrogative words and slots to be filled, wherein the interrogative words may be, but are not limited to, "What", "Who", and "Where", etc., and this application does not make specific restrictions.

[0086] In some embodiments, when there are multiple entity triples, the present application may record entity triples with the same subject or object as one entity triple combination, and record entity triples without the same subject or object as separate entity triples.

[0087] For example, the embodiment of the present application assumes that there are two triples <Subject 1, Predicate 1, Object 1>, <Subject 2, Predicate 2, Object 2>, and after pronoun replacement, Subject 1 and Subject 2 are the same, then, the present application can group these two triples together.

[0088] In addition, the present application can generate corresponding question-answer pairs for entity triple combinations and single entity triples respectively.

[0089] In other embodiments, the present application may first record the subject or object in the entity triple that is the same as other entity triples as the answer for each entity triple in the entity triple, and fill the unrecorded object or subject and predicate into the slot to be filled.

[0090] Then, the application can determine the first target question word based on the unrecorded object or subject, and the predicate, and combine the first target question word and the content of the slot to be filled to obtain the question corresponding to the entity triple, thereby obtaining the question-answer pair corresponding to each entity triple.

[0091] Among them, the first target question word can be set by technicians in this field according to actual conditions, and this application does not make any specific restrictions.

[0092] For example, the present application assumes that there are two triples <Subject 1, Predicate 1, Object 1> and <Subject 2, Predicate 2, Object 2>, and that Subject 1 and Subject 2 are the same after pronoun replacement. In an embodiment of the present application, the question may be: interrogative word + predicate 1 + object 1, or, predicate 2 + object 2, and the final answer is subject 1 (or subject 2).

[0093] In other embodiments, the present application may first record the subject or object of each individual entity triple as the answer, and fill the unrecorded object or subject and predicate into the slot to be filled.

[0094] Then, the present application can determine the second target question word according to the unrecorded object or subject and the predicate, and combine the second target question word and the content of the slot to be filled to obtain the question corresponding to the single entity triple.

[0095] Among them, the second target question word can be set by technicians in this field according to actual conditions, and this application does not make any specific restrictions.

[0096] For example, the embodiment of the present application assumes that the entity triple corresponding to the target text is<Tim,went to,thepark> , and select Tim and went to to generate a question together with the question template. At this time, the interrogative word in the question template can be determined as where, and the question formed can be: "Where did Tim go to?", and the corresponding question-answer pair can be {"Where did Tim go to?", "The park"}.

[0097] In step S104, a target question-answer pair is determined from at least one question-answer pair.

[0098] It can be understood that the target question-answer pair may refer to the question-answer pair extracted from the target text that best matches the paragraph text.

[0099] In an embodiment of the present application, since the target text is a text of a different text type from the paragraph text, that is, at least one question-answer pair extracted based on the target text may have errors. Therefore, the embodiment of the present application can determine the target question-answer pair with the smallest error from at least one question-answer pair.

[0100] Optionally, in one embodiment of the present application, a target question-answer pair is determined from at least one question-answer pair, including: inputting the question and paragraph text in at least one question-answer pair into a trained reward model to obtain a matching value for each question and paragraph text; and taking the question-answer pair containing the question having a matching value greater than a preset matching value threshold as the target question-answer pair.

[0101] It can be understood that the reward model can be used to determine the matching degree between the question-answer pairs extracted from the target text and the paragraph text, wherein, in the embodiment of the present application, the higher the matching degree, the more accurate the question-answer pairs extracted from the target text are, and the present application does not impose any specific limitations.

[0102] In addition, the preset matching value threshold can be set by technicians in this field according to actual conditions, and this application does not impose any specific limitations.

[0103] During the actual implementation process, the embodiment of the present application can input the question and paragraph text in at least one question-answer pair into a trained reward model to obtain the matching value of each question and paragraph text, and determine the question-answer pair where the matching value is greater than a preset matching value threshold as the target question-answer pair.

[0104] Optionally, in one embodiment of the present application, after determining the target question-answer pair, it also includes: obtaining the target question text type; using a language model to convert the target question in each target question-answer pair into a synonymous question of the target question text type; for each target question-answer pair, combining the synonymous question of the target question and the target answer in the target question answer pair into a new question-answer pair.

[0105] In some embodiments, in order to further improve the diversity of question-answer pairs, the present application may further perform text type conversion on the questions in the target question-answer pair after determining the target question-answer pair, thereby obtaining question-answer pairs of multiple different text types for each question-answer pair.

[0106] As a possible implementation method, the embodiment of the present application can obtain the target question text type, and use the language model to convert the target question in each target question answer pair into a synonymous question of the target question text type. Finally, for each target question answer pair, the synonymous question of the target question and the target answer in the target question answer pair are combined into a new question answer pair. As for how to obtain the target question text type, please refer to the description in step S101, which will not be described in detail here.

[0107] According to the question-answer pair generation method proposed in the embodiment of the present application, the language model can be used to convert the paragraph text into a target text of the target text type, and then at least one question-answer pair can be extracted from the target text, and the target question-answer pair can be determined from the question-answer pair. The embodiment of the present application can perform text type conversion on the paragraph text for generating the question-answer pair through the language model, and generate the question-answer pair through the converted text, thereby improving the diversity of generating the question-answer pair, improving the generalization ability and accuracy of the question-answer system, and improving the user experience. Thus, the problem in the related art that only the existing articles are targeted, and the text type is relatively single, so the generalization ability of the question-answer system obtained by training is poor, and in addition, when providing answers to the questions raised, the wrong answers are provided due to the inaccurate questions identified, which leads to the low accuracy of the question-answer system, affecting the user experience and other technical problems.

[0108] Next, the question-answer pair generating device proposed in the embodiment of the present application is described with reference to the accompanying drawings.

[0109] Figure 4 A block diagram of a question-answer pair generating device provided according to an embodiment of the present application.

[0110] like Figure 4 As shown, the question-answer pair generating device 10 includes: a first acquiring module 100 , an input module 200 , an extracting module 300 and a generating module 400 .

[0111] Specifically, the first acquisition module 100 is used to acquire paragraph text and identify the target text type to be converted corresponding to the paragraph text.

[0112] The input module 200 is used to input the paragraph text into the trained language model and convert the paragraph text into a target text corresponding to the target text type.

[0113] The extraction module 300 is used to extract at least one question-answer pair from the target text, wherein the question-answer pair includes a question and an answer corresponding to the question.

[0114] The generating module 400 is used to determine a target question-answer pair from at least one question-answer pair.

[0115] Optionally, in one embodiment of the present application, the input module 200 includes: a generation unit and an output unit.

[0116] The generating unit is used to generate a prompt text according to the target text type and the paragraph text, wherein the prompt text is a text that prompts to convert the paragraph text into the target text type.

[0117] The output unit is used to input the prompt text into the trained language model to obtain the language model output target text.

[0118] Optionally, in one embodiment of the present application, the extraction module 300 includes: an acquisition unit, a first input unit, an entity naming unit and a generation unit.

[0119] The acquisition unit is used to acquire the target noun referred to by the pronoun in the target text, and replace the pronoun with the target noun to obtain the replacement text.

[0120] The first input unit is used to input the replacement text into a preset multi-task model to obtain at least one triple output by the multi-task model.

[0121] The entity naming unit is used to perform entity naming on the elements in the triple to obtain at least one entity triple.

[0122] A generating unit is used to generate at least one question-answer pair according to at least one entity triple and a preset question template.

[0123] Optionally, in one embodiment of the present application, the multi-task model includes a shared encoder, an extraction task decoder, and a classification task decoder, the shared encoder and the extraction task decoder implement the extraction of triples, and the shared encoder and the classification task decoder implement the classification of phrases of the replacement text, wherein the first input unit includes: a first input sub-unit, a second input sub-unit, and an output sub-unit.

[0124] Among them, the first input subunit is used to input the replacement text into the shared encoder to obtain a vector encoding sequence corresponding to the replacement text.

[0125] The second input subunit is used to input the vector encoding sequence into the extraction task decoder and the classification task decoder respectively, to obtain at least one initial triple output by the extraction task decoder and the classification result of the replacement text output by the classification task decoder, wherein the classification result includes the part of speech of each phrase in the replacement text.

[0126] The output subunit is used to adjust each initial triplet according to the classification result to obtain at least one adjusted triplet, and determine the adjusted triplet as the triplet output by the multi-task model.

[0127] Optionally, in one embodiment of the present application, the entity triple includes a subject, a predicate and an object, the question template includes a question word and a slot to be filled, wherein the generation unit includes: a first recording subunit, a second recording subunit and a third recording subunit.

[0128] The first recording subunit is used to record, when there are multiple entity triples, entity triples with the same subject or object as one entity triple combination, and entity triples without the same subject or object as separate entity triples.

[0129] The second recording sub-unit is used to record the subject or object in the entity triplet that is the same as that in other entity triples as the answer for the entity triple in each entity triple combination, and fill the unrecorded object or subject and predicate into the slot to be filled; determine the first target question word according to the unrecorded object or subject and predicate; combine the first target question word and the content of the slot to be filled to obtain the question corresponding to the entity triplet.

[0130] The third recording subunit is used to record the subject or object of the individual entity triple as the answer for each individual entity triple, and fill the unrecorded object or subject, and predicate into the slot to be filled; determine the second target question word according to the unrecorded object or subject, and predicate; combine the second target question word and the content of the slot to be filled to obtain the question corresponding to the individual entity triple.

[0131] Optionally, in one embodiment of the present application, the generating module 400 includes: a second input unit and a determining unit.

[0132] The second input unit is used to input the question and paragraph text in at least one question-answer pair into the trained reward model to obtain a matching value between each question and paragraph text.

[0133] The determination unit is used to take the question-answer pair containing the question whose matching value is greater than a preset matching value threshold as the target question-answer pair.

[0134] Optionally, in one embodiment of the present application, it further includes: a second acquisition module, a conversion module and a new generation module.

[0135] The second acquisition module is used to obtain the target question text type after determining the target question answer pair.

[0136] The conversion module is used to convert the target question in each target question-answer pair into a synonymous question of the target question text type by using a language model.

[0137] The new generation module is used to form a new question-answer pair for each target question-answer pair by combining the synonymous question of the target question and the target answer in the target question-answer pair.

[0138] It should be noted that the aforementioned explanation of the embodiment of the method for generating question-answer pairs is also applicable to the device for generating question-answer pairs of this embodiment, and will not be repeated here.

[0139] According to the question-answer pair generating device proposed in the embodiment of the present application, the input module can be used to convert the paragraph text into the target text of the target text type, and then the extraction module can be used to extract at least one question-answer pair from the target text, and the generation module can be used to determine the target question-answer pair from the question-answer pair. The embodiment of the present application can perform text type conversion on the paragraph text for generating the question-answer pair through the language model, and generate the question-answer pair through the converted text, thereby improving the diversity of generating the question-answer pair, improving the generalization ability and accuracy of the question-answering system, and improving the user experience. Thus, the related art is solved, which is only for existing articles, and its text type is relatively single, so the generalization ability of the question-answering system obtained by training is poor. In addition, when providing answers to the questions raised, due to the inaccurate questions identified, wrong answers are provided, which leads to the low accuracy of the question-answering system, affecting the user experience and other technical problems.

[0140] Figure 5 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present application. The electronic device may include:

[0141] A memory 501 , a processor 502 , and a computer program stored in the memory 501 and executable on the processor 502 .

[0142] When the processor 502 executes the program, the question-answer pair generating method provided in the above embodiment is implemented.

[0143] Furthermore, the electronic device further comprises:

[0144] The communication interface 503 is used for communication between the memory 501 and the processor 502 .

[0145] The memory 501 is used to store computer programs that can be executed on the processor 502 .

[0146] The memory 501 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0147] If the memory 501, the processor 502 and the communication interface 503 are implemented independently, the communication interface 503, the memory 501 and the processor 502 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0148] Optionally, in a specific implementation, if the memory 501, the processor 502 and the communication interface 503 are integrated on a chip, the memory 501, the processor 502 and the communication interface 503 can communicate with each other through an internal interface.

[0149] The processor 502 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.

[0150] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned method for generating question-answer pairs.

[0151] The embodiment of the present application also provides a computer program, which can run computer instructions. When the computer instructions are executed by a processor, the question-answer pair generating method provided by the embodiment of the present application is implemented.

[0152] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0153] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0154] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0155] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or N wirings (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways as necessary and then storing it in a computer memory.

[0156] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. If implemented by hardware, as in another embodiment, it can be implemented by any one or a combination of multiple of the following technologies known in the art: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0157] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0158] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0159] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.< / sep> < / sep> < / sep> < / sep> < / sep> < / sep>

Claims

1. A method for generating question-answer pairs, characterized in that: The following steps are involved: Acquire a paragraph text, and identify the target text type to be converted corresponding to the paragraph text; Inputting the paragraph text into a trained language model to convert the paragraph text into a target text corresponding to the target text type; Extracting at least one question-answer pair from the target text, wherein the question-answer pair includes a question and an answer corresponding to the question; and Determining a target question-answer pair from at least one question-answer pair; The step of extracting at least one question-answer pair from the target text includes: obtaining a target noun referred to by a pronoun in the target text, and replacing the pronoun with the target noun to obtain a replacement text; inputting the replacement text into a preset multi-task model to obtain at least one triple output by the multi-task model; performing entity naming on the elements in the triple to obtain at least one entity triple; and generating at least one question-answer pair according to the at least one entity triple and a preset question template; The multi-task model includes a shared encoder, an extraction task decoder, and a classification task decoder. The shared encoder and the extraction task decoder realize the extraction of triples, and the shared encoder and the classification task decoder realize the classification of phrases of the replacement text. The step of inputting the replacement text into a preset multi-task model to obtain at least one triple output by the multi-task model includes: inputting the replacement text into the shared encoder to obtain a vector encoding sequence corresponding to the replacement text; inputting the vector encoding sequence into the extraction task decoder and the classification task decoder respectively to obtain at least one initial triple output by the extraction task decoder and a classification result of the replacement text output by the classification task decoder, wherein the classification result includes the part of speech of each phrase in the replacement text; adjusting each initial triple according to the classification result to obtain at least one adjusted triple, and determining the adjusted triple as the triple output by the multi-task model.

2. The method according to claim 1, characterized in that The step of inputting the paragraph text into a trained language model and converting the paragraph text into a target text corresponding to the target text type includes: Generate a prompt text according to the target text type and the paragraph text, wherein the prompt text is a text prompting to convert the paragraph text into the target text type; The prompt text is input into the trained language model, and the language model outputs the target text.

3. The method according to claim 1, characterized in that The entity triples include a subject, a predicate, and an object, and the question template includes a question word and a slot to be filled, wherein generating at least one question-answer pair according to at least one of the entity triples and a preset question template includes: In the case where there are multiple entity triples, entity triples with the same subject or object are recorded as one entity triple combination, and entity triples without the same subject or object are recorded as separate entity triples; For each entity triple in the entity triple combination, the subject or object in the entity triple that is the same as that in other entity triples is recorded as the answer, and the unrecorded object or subject and predicate are filled into the slot to be filled; according to the unrecorded object or subject and predicate, a first target question word is determined; the first target question word and the content of the slot to be filled are combined to obtain the question corresponding to the entity triple; For each individual entity triple, the subject or object of the individual entity triple is recorded as the answer, and the unrecorded object or subject, and the predicate are filled into the slot to be filled; based on the unrecorded object or subject, and the predicate, a second target question word is determined; the second target question word and the content of the slot to be filled are combined to obtain the question corresponding to the individual entity triple.

4. The method according to claim 1, characterized in that Determining a target question-answer pair from at least one question-answer pair includes: Inputting the question in the at least one question-answer pair and the paragraph text into the trained reward model to obtain a matching value between each question and the paragraph text; The question-answer pair containing the question whose matching value is greater than a preset matching value threshold is used as the target question-answer pair.

5. The method according to claim 1, characterized in that After determining the target question answer pair, the method further includes: Get the target question text type; Using the language model, converting the target question in each target question-answer pair into a synonymous question of the target question text type; For each target question-answer pair, a synonymous question of the target question and the target answer in the target question-answer pair are combined to form a new question-answer pair.

6. A question-answer pair generating device, characterized in that: include: An acquisition module, used for acquiring paragraph text and identifying the target text type to be converted corresponding to the paragraph text; An input module, used for inputting the paragraph text into a trained language model, and converting the paragraph text into a target text corresponding to the target text type; an extraction module, configured to extract at least one question-answer pair from the target text, wherein the question-answer pair includes a question and an answer corresponding to the question; and A generating module, configured to determine a target question-answer pair from at least one question-answer pair; The extraction module includes: an acquisition unit, used to acquire a target noun referred to by a pronoun in the target text, and replace the pronoun with the target noun to obtain a replacement text; a first input unit, used to input the replacement text into a preset multi-task model to obtain at least one triple output by the multi-task model; an entity naming unit, used to perform entity naming on the elements in the triple to obtain at least one entity triple; a generation unit, used to generate at least one question-answer pair according to the at least one entity triple and a preset question template; The multi-task model includes a shared encoder, an extraction task decoder, and a classification task decoder. The shared encoder and the extraction task decoder realize the extraction of triples, and the shared encoder and the classification task decoder realize the classification of phrases of the replacement text. The first input unit includes: a first input subunit, used to input the replacement text into the shared encoder to obtain a vector encoding sequence corresponding to the replacement text; a second input subunit, used to input the vector encoding sequence into the extraction task decoder and the classification task decoder respectively, to obtain at least one initial triple output by the extraction task decoder and a classification result of the replacement text output by the classification task decoder, wherein the classification result includes the part of speech of each phrase in the replacement text; an output subunit, used to adjust each initial triple according to the classification result to obtain at least one adjusted triple, and determine the adjusted triple as the triple output by the multi-task model.

7. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the question-answer pair generating method as claimed in any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the question-answer pair generating method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for obtaining reading understanding material, electronic equipment and readable medium

    CN110347803A

  • Government affair domain knowledge automatic discovery method and system

    CN116821357A