Topic generation method and device, electronic equipment and computer readable medium
By extracting the Q&A pairs from the text and splitting the answers according to the preset thresholds, high-quality questions are generated, and the problems of poor quality and low efficiency of question generation in the existing system are solved, and intelligent and automated question generation is achieved.
Patent Information
- Application Number
- CN202411272281.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2025-01-07
AI Technical Summary
The existing question generation system lacks intelligent extraction function, cannot automatically generate high-quality questions from the original text, and is inefficient, and cannot intelligently generate different types of questions based on chapters and paragraph content.
By receiving the question generation request, obtaining the target text, splitting it into paragraphs, extracting question-and-answer pairs, determining the length and splitable attributes of the answer, splitting the answers according to the preset threshold type, generating a collection of candidate answers, and generating obfuscated answers through the big model , and finally generate high-quality questions based on the Q&A pair and candidate answer set.
It improves the quality and efficiency of question generation, realizes intelligent question generation, and can automatically generate different types of questions based on text content, reduces manual operations, and improves the efficiency of question bank generation.
Smart Images

Figure CN119272760A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data processing technology, and in particular to a question generation method, device, electronic device and computer-readable medium. Background Art
[0002] In the existing educational environment, lecturers usually need to manually select questions from textbooks or handouts, which is a time-consuming and error-prone process. Some question bank management systems can help lecturers store and manage prepared questions. However, these systems usually lack intelligent extraction functions and cannot automatically generate questions from raw texts. In addition, some systems may provide automatic generation of questions, but often lack a deep understanding of the text content and cannot intelligently generate different types of questions based on chapter and paragraph content. The quality of question generation is poor and the efficiency is low. Summary of the invention
[0003] In view of this, the embodiments of the present application provide a question generation method, device, electronic device and computer-readable medium, which can solve the problems of poor quality and low efficiency of existing question generation.
[0004] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present application, a question generation method is provided, including: receiving a question generation request and obtaining a target text; splitting the target text into paragraphs, and extracting question and answer pairs based on each paragraph; determining the length and separability of the answer in the question and answer pair, determining the type of the answer in the question and answer pair based on the length, separability and preset threshold, and splitting the answer according to the type to obtain each split answer; generating a set of candidate answers for the target question type based on each split answer; generating a confused answer, and then generating a target question based on the target question type, the question and answer pair, the set of candidate answers and the confused answer.
[0005] Optionally, question-answer pairs are extracted based on each paragraph, including: calling a large model to identify questions in each paragraph, and extracting keywords in the identified questions; matching the keywords with candidate answers in each paragraph for semantic similarity to determine matching answers; combining questions and matching answers into question-answer pairs, and extracting question-answer pairs.
[0006] Optionally, the preset threshold includes a first preset threshold and a second preset threshold, the first preset threshold is less than or equal to the second preset threshold, and determining the type of answer in the question and answer pair includes: in response to the length being less than the first preset threshold and the separable attribute being separable, determining the type of answer in the question and answer pair as a separable short answer; in response to the length being less than the first preset threshold and the separable attribute being inseparable, determining the type of answer in the question and answer pair as an inseparable short answer; in response to the length being greater than the second preset threshold and the separable attribute being inseparable, determining the type of answer in the question and answer pair as an inseparable long answer.
[0007] Optionally, the answer is split according to type to obtain individual split answers, including: in response to the type being a separable short answer, the answer is split based on separable dimensions contained in the answer to obtain individual split answers.
[0008] Optionally, based on each split answer, a set of candidate answers for the target question type is generated, including: adding each split answer to the set of candidate answers for the question type corresponding to the splittable short answer, so as to obtain an updated set of candidate answers corresponding to the question type corresponding to the splittable short answer.
[0009] Optionally, generating a confusing answer includes: generating a confusing answer according to multiple-choice questions and true-or-false questions in a target question type, a candidate answer set, and target paragraph information.
[0010] Optionally, generating a target question includes: calling a question generation template corresponding to the target question type, extracting information corresponding to placeholders in the question generation template from question-answer pairs, candidate answer sets, and confused answers, and replacing the corresponding placeholders with the information to generate the target question.
[0011] In addition, the present application also provides a question generation device, including: a receiving unit, configured to receive a question generation request and obtain a target text; an extraction unit, configured to split the target text into paragraphs, and extract question and answer pairs based on each paragraph; a splitting unit, configured to determine the length and splittable attribute of the answer in the question and answer pair, determine the type of the answer in the question and answer pair according to the length, the splittable attribute and a preset threshold, and split the answer according to the type to obtain each split answer; a candidate answer set generation unit, configured to generate a candidate answer set of a target question type based on each split answer; a target question generation unit, configured to generate a confused answer, and then generate a target question based on the target question type, the question and answer pair, the candidate answer set, and the confused answer.
[0012] Optionally, the extraction unit is further configured to: call the large model to identify questions in each paragraph, and extract keywords in the identified questions; perform semantic similarity matching between the keywords and the candidate answers in each paragraph to determine matching answers; combine the questions and matching answers into question-answer pairs, and extract the question-answer pairs.
[0013] Optionally, the preset threshold includes a first preset threshold and a second preset threshold, the first preset threshold is less than or equal to the second preset threshold, and the splitting unit is further configured to: in response to the length being less than the first preset threshold and the separable attribute being separable, determine that the answer type in the question and answer pair is a separable short answer; in response to the length being less than the first preset threshold and the separable attribute being inseparable, determine that the answer type in the question and answer pair is an inseparable short answer; in response to the length being greater than the second preset threshold and the separable attribute being inseparable, determine that the answer type in the question and answer pair is an inseparable long answer.
[0014] Optionally, the splitting unit is further configured to: in response to the type being a separable short answer, split the answer based on separable dimensions contained in the answer to obtain individual split answers.
[0015] Optionally, the candidate answer set generating unit is further configured to: add each split answer to the candidate answer set of the question type corresponding to the split short answer, so as to obtain an updated candidate answer set corresponding to the question type corresponding to the split short answer.
[0016] Optionally, the target question generating unit is further configured to generate confusing answers according to the multiple-choice questions and true-or-false questions in the target question type, the candidate answer set and the target paragraph information.
[0017] Optionally, the target question generation unit is further configured to: call the question generation template corresponding to the target question type, extract information corresponding to the placeholders in the question generation template from the question and answer pairs, candidate answer sets and confused answers, and replace the corresponding placeholders with the information to generate the target question.
[0018] In addition, the present application also provides a question generating electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the one or more processors implement the above-mentioned question generating method.
[0019] In addition, the present application also provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned question generating method is implemented.
[0020] To achieve the above objective, according to another aspect of the embodiments of the present application, a computer program product is provided.
[0021] A computer program product according to an embodiment of the present application includes a computer program, and when the program is executed by a processor, the question generating method provided by the embodiment of the present application is implemented.
[0022] One embodiment of the above invention has the following advantages or beneficial effects: the application receives a question generation request to obtain a target text; splits the target text into paragraphs, and extracts question-answer pairs based on the paragraphs; determines the length and splittable attribute of the answer in the question-answer pair, determines the type of the answer in the question-answer pair based on the length, splittable attribute and preset threshold, and splits the answer based on the type to obtain each split answer; generates a candidate answer set of the target question type based on each split answer; generates a confused answer, and then generates a target question based on the target question type, question-answer pair, candidate answer set, and confused answer. Improve the quality and efficiency of text-based question generation.
[0023] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are used to better understand the present application and do not constitute an improper limitation on the present application.
[0025] Figure 1 is a schematic diagram of the main process of a method for generating a topic according to an embodiment of the present application;
[0026] Figure 2 is a schematic diagram of the main process of a method for generating a topic according to an embodiment of the present application;
[0027] Figure 3 It is a schematic diagram of the main process of a method for generating a topic according to an embodiment of the present application;
[0028] Figure 4 is a schematic diagram of the main units of the question generating device according to an embodiment of the present application;
[0029] Figure 5 is an exemplary system architecture diagram to which the embodiments of the present application can be applied;
[0030] Figure 6 It is a structural diagram of a computer system of a terminal device or server suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION
[0031] The following is a description of the exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of known functions and structures is omitted in the following description. It should be noted that the acquisition, transmission, storage, use, and processing of data in the technical solution of the present application are in compliance with the relevant provisions of national laws and regulations. It should be noted that in the embodiments of the present application, certain software, components, models, and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or must have used the solution. In the technical solution of the present application, the collection, analysis, use, transmission, storage, and other aspects of the user's personal information involved are in compliance with the provisions of relevant laws and regulations, and are used for legal and reasonable purposes, and are not shared, leaked, or sold outside of these legal uses, and are subject to supervision and management by regulatory authorities. Take necessary measures to prevent illegal access to such personal information, ensure that persons with access to personal information comply with relevant laws and regulations, and ensure the security of personal information. Once such personal information is no longer needed, risks should be minimized by limiting or even prohibiting data collection and / or deleting data.
[0032] When used, including in certain related applications, user privacy is protected by de-identifying data, such as by removing specific identifiers when used, controlling the amount or specificity of data stored, controlling how data is stored, and / or other methods of de-identification.
[0033] Figure 1 is a schematic diagram of the main process of the topic generation method according to an embodiment of the present application, such as Figure 1 As shown, the topic generation method mainly includes the following steps S101 to S105.
[0034] Step S101, receiving a topic generation request and obtaining a target text.
[0035] In this embodiment, the execution subject of the topic generation method (for example, a server) can receive the topic generation request through a wired connection or a wireless connection. After receiving the topic generation request, the execution subject can obtain a document uploaded or provided by the user corresponding to the request, that is, a target text, such as "explain the formation process of the planets in the solar system". The embodiment of the present application does not specifically limit the content of the target file.
[0036] Step S102: split the target text into paragraphs, and extract question-answer pairs based on each paragraph.
[0037] The execution entity can split the target text into paragraphs by title and chapter, identify punctuation marks in each paragraph, and extract question-answer pairs based on the identified punctuation marks. For example, if a question mark "?" is identified followed by a period ".", the short sentence containing the question mark "?" can be used as the question, and the short sentence containing the period "." can be used as the answer to the question, so as to quickly obtain question-answer pairs.
[0038] Step S103, determine the length and separability of the answer in the question-answer pair, determine the type of the answer in the question-answer pair based on the length, separability and preset threshold, and split the answer according to the type to obtain each split answer.
[0039] The divisible attributes include divisible and non-divisible.
[0040] The answers in the splittable question-answer pairs are split to obtain the split answers, and the answers in the non-splittable question-answer pairs are not split, and the answers in the non-splittable question-answer pairs are directly defined as the split answers.
[0041] Specifically, the preset thresholds include a first preset threshold and a second preset threshold, the first preset threshold is less than or equal to the second preset threshold, and determining the type of answer in the question-answer pair includes: in response to the length being less than the first preset threshold and the separable attribute being separable, determining the type of answer in the question-answer pair as a separable short answer; in response to the length being less than the first preset threshold and the separable attribute being inseparable, determining the type of answer in the question-answer pair as an inseparable short answer; in response to the length being greater than the second preset threshold and the separable attribute being inseparable, determining the type of answer in the question-answer pair as an inseparable long answer.
[0042] The first preset threshold is, for example, Figure 3 The second preset threshold is, for example, Figure 3 Threshold B in the question-answer pair. By presetting thresholds and separable attributes to determine the type of answer in the question-answer pair, the type of answer can be accurately determined to prepare for the subsequent setting of single-choice questions, multiple-choice questions, true-or-false questions, and short-answer questions, thereby improving the quality and efficiency of generating questions.
[0043] Specifically, the answer is split according to the type to obtain individual split answers, including: in response to the type being a splittable short answer, the answer is split based on the splittable dimensions contained in the answer to obtain individual split answers.
[0044] The splittable dimensions contained in the answer, such as the letters, symbols, etc. The answer is split based on the letters and / or symbols contained in the answer to quickly and accurately obtain each split answer.
[0045] Step S104, generating a set of candidate answers for the target question type based on each split answer.
[0046] Specifically, based on each split answer, a candidate answer set for the target question type is generated, including: adding each split answer to the candidate answer set for the question type corresponding to the splittable short answer, so as to obtain an updated candidate answer set corresponding to the question type corresponding to the splittable short answer.
[0047] The question types corresponding to the split short answers may include single-choice questions, multiple-choice questions, and true-or-false questions. Each split answer is added to the existing candidate answer set corresponding to the single-choice question, multiple-choice question, and true-or-false question to obtain an updated candidate answer set of the target question type (single-choice question, multiple-choice question, and true-or-false question), thereby ensuring the real-time nature of the data used to generate the question and ensuring the accuracy of the generated question.
[0048] The indivisible short answers are directly assigned to the candidate answer set of single-choice questions, multiple-choice questions and true-or-false questions, and the indivisible long answers are directly assigned to the candidate answer set of short-answer questions. This ensures the accuracy of the generated questions.
[0049] Step S105, generate obfuscated answers, and then generate target questions based on the target question type, question-answer pairs, candidate answer sets, and obfuscated answers.
[0050] The execution subject can extract the keywords of the correct answer and determine the antonyms of the keywords based on the known questions and correct answers, and generate the obfuscated answers for the known questions based on the antonyms, thereby improving the efficiency of generating obfuscated answers.
[0051] Specifically, generating a target question includes: calling a question generation template corresponding to the target question type, extracting information corresponding to the placeholders in the question generation template from question-answer pairs, candidate answer sets, and confused answers, and replacing the corresponding placeholders with the information to generate the target question.
[0052] When it is detected that the question generation template is called, the data extraction tool associated with the placeholder of the question generation template is triggered to extract the information corresponding to the placeholder in the question generation template from the question-answer pair, the candidate answer set and the confused answer, and replace the corresponding placeholder with the information to generate the target question. This improves the response speed and accuracy of question generation.
[0053] In this embodiment, by receiving a question generation request, the target text is obtained; the target text is split into paragraphs, and Q&A pairs are extracted based on the paragraphs; the length and splittable attribute of the answer in the Q&A pair are determined, and according to the length, splittable attribute and preset threshold, the type of the answer in the Q&A pair is determined, and the answer is split according to the type to obtain each split answer; based on each split answer, a candidate answer set for the target question type is generated; confusing answers are generated, and then according to the target question type, Q&A pairs, candidate answer set, and confusing answers, the target question is generated. This improves the quality and efficiency of text-based question generation.
[0054] Figure 2 It is a schematic diagram of the main process of a question generation method according to an embodiment of the present application. As Figure 2 shown, the question generation method mainly includes the following steps S201 - step S208.
[0055] Step S201, receive a question generation request and obtain the target text.
[0056] The type of the question to be generated can be carried in the question generation request, for example, it can be one or several of single-choice questions, multiple-choice questions, true or false questions, or short-answer questions. The target text can be a question input by the user, such as "What are the colors of apples?" or "Explain the formation process of planets in the solar system".
[0057] Step S202, split the target text into paragraphs.
[0058] The execution entity can remove meaningless words in the target text, such as "of", and perform word segmentation on the text remaining after removing meaningless words in the target text to obtain each paragraph.
[0059] Step S203, call a large model to identify questions in each paragraph and extract keywords in the identified questions.
[0060] The large model can identify questions in each paragraph by identifying the symbols at the end of each paragraph and accurately and reasonably extract keywords in the identified questions based on parts of speech such as nouns and verbs.
[0061] Step S204, perform semantic similarity matching between the keywords and candidate answers in each paragraph to determine the matching answers.
[0062] For each keyword of the question sentence in each paragraph extracted, the keyword is matched with the candidate answer in the sentence ending with a period in each paragraph by semantic similarity. Specifically, the keyword can be converted into a keyword vector, and each candidate answer can be converted into a candidate answer vector. By calculating the cosine similarity between the keyword vector and each candidate answer vector, the candidate answer corresponding to the candidate answer vector corresponding to the largest cosine similarity is determined as the matching answer corresponding to the keyword. This improves the accuracy of the answer determined to match the keyword.
[0063] Step S205: Combine the question and the matching answer into a question-answer pair, and extract the question-answer pair.
[0064] After determining the matching answer corresponding to each keyword, the question and answer pairs are combined, and then the combined question and answer pairs are extracted, thereby improving the efficiency and accuracy of question and answer pair extraction.
[0065] Step S206, determine the length and splittable attribute of the answer in the question-answer pair, determine the type of the answer in the question-answer pair based on the length, splittable attribute and preset threshold, and split the answer based on the type to obtain each split answer.
[0066] The separable attributes include separable and non-separable. When the length of the answer is less than the first preset threshold and the separable attribute is separable, the answer type in the question and answer pair is determined to be a separable short answer; when the length of the answer is less than the first preset threshold and the separable attribute is non-separable, the answer type in the question and answer pair is determined to be a non-separable short answer; when the length of the answer is greater than the second preset threshold and the separable attribute is non-separable, the answer type in the question and answer pair is determined to be a non-separable long answer. The first preset threshold is less than or equal to the second preset threshold. The answers in the question and answer pairs that can be split are split to obtain separate split answers, and the answers in the question and answer pairs that cannot be split are not split, and the answers in the question and answer pairs that cannot be split are directly defined as split answers.
[0067] Step S207, generating a set of candidate answers for the target question type based on each split answer.
[0068] For example, the target question types include single-choice questions, multiple-choice questions, true-or-false questions, and short-answer questions. The separable short answers and the inseparable short answers can correspond to the same candidate answer set. Since the answers in the question-answer pairs that can be separable are split to obtain the individual split answers, and the answers in the question-answer pairs that cannot be split are not split, the answers in the question-answer pairs that cannot be split are directly defined as split answers. Therefore, the split answers corresponding to the separable short answers and the inseparable short answers can be added to the candidate answer set of the same single-choice question, multiple-choice question, and true-or-false question. The inseparable long answers (that is, the split answers directly defined) are directly added to the candidate answer set of the short-answer questions. This makes it easy to generate a candidate answer set in a unified manner.
[0069] Step S208, generate obfuscated answers, and then generate target questions based on the target question type, question-answer pairs, candidate answer sets, and obfuscated answers.
[0070] Specifically, generating obfuscated answers includes: generating obfuscated answers according to multiple-choice questions and true-or-false questions in a target question type, a set of candidate answers, and target paragraph information.
[0071] Confused answers are used for multiple-choice questions and true-or-false questions. For candidate question types that include multiple-choice questions (single-choice, multiple-choice) and true-or-false questions, a large language model can be used to extract the required data in the same paragraph or document corresponding to the target paragraph information based on the candidate answer set to generate at least three confused answers. This ensures the rationality and accuracy of the generated multiple-choice questions and true-or-false questions. In addition, the target question can be accurately generated based on the target question type, question-answer pair, candidate answer set, and confused answers.
[0072] Figure 3 FIG. 1 is a schematic diagram of the main flow of a method for generating a topic according to an embodiment of the present application. Figure 3As shown, the execution subject obtains the document uploaded / provided by the user, calls the text preprocessing module to split the document into paragraphs, then calls the question-answer pair extraction module to extract the question-answer pair, and then calls the answer splitting module to split the answer. Specifically, the execution subject can determine the length and splittable attributes (including splittable and non-splittable) of the answer in the question-answer pair, and in response to the length of the answer being greater than a first preset threshold (i.e., threshold A), set the corresponding answer as a short-answer question candidate, and in response to the length of the answer being less than the first preset threshold (i.e., threshold A), use the large model to split the answer into multiple small points. If the answer can be split and the split is successful, the answer is set as a candidate for a single-choice question, a multiple-choice question, or a true-or-false question. If the answer cannot be split and the split is unsuccessful, continue to determine whether the length of the answer is greater than a second preset threshold (i.e., threshold B). In response to the length of the answer being greater than the second preset threshold (i.e., threshold B), the answer is set as a candidate for a short-answer question. In response to the length of the answer being less than the second preset threshold (i.e., threshold B), the answer is set as a candidate for a single-choice question, a multiple-choice question, or a true-or-false question. Then, the question generation module is called according to each single-choice question, multiple-choice question, true-or-false question, and short-answer question candidate to generate a target question.
[0073] In the embodiments of the present application: LLM (Large Language Mode) refers to a large-scale language model built based on deep learning technology. LLM is a powerful natural language processing tool that can understand and generate text. The following are some introductions and important concepts about LLM. Pre-training: LLM is usually built by pre-training on a large-scale text corpus. The pre-training stage refers to the model learning the statistical laws and semantic relationships of language under unsupervised conditions. Pre-training enables the model to acquire rich language knowledge and representation capabilities. Context understanding: LLM can generate coherent text through context understanding. It can understand the semantics, context and related information of the previous text, and generate subsequent text based on this information. This makes LLM have excellent performance in tasks such as question answering, dialogue generation and automatic summarization. Multi-field application: LLM can adapt to natural language processing tasks in multiple fields. It can be used for various tasks such as machine translation, text summarization, sentiment analysis, named entity recognition, dialogue systems, etc. Through fine-tuning or transfer learning, LLM can be adjusted to specific fields according to specific tasks. Generate text: LLM is able to generate text related to the input context. This makes it widely used in scenarios such as generating dialogues, automatic writing, language creation, and chatbots. The generated text is usually based on the model's learning and understanding of a large corpus. Prompt: refers to the input text or question provided to the model to guide it to generate the corresponding response or output. Prompt is a way to interact with the model. It can be a short sentence, a question, a description, or any other form of text. Embedding model: An embedding model is a machine learning model that converts discrete symbols or objects into continuous vector representations (also called embedding vectors or embeddings). The goal of the embedding model is to map a high-dimensional, sparse input space to a low-dimensional, dense embedding space to capture the semantics and associations between inputs. By using an embedding model, text can be converted into a continuous vector representation, which can be applied to tasks such as text similarity calculation, text classification, and information retrieval. The advantage of the embedding model is that it can encode semantics and associations into low-dimensional vectors, which is convenient for calculation and application. Prompt template: A prompt template is a structured input form used to interact with a language model. It consists of two main components: context and question. The content part (context) is the contextual information related to the question, which provides some background or premise so that the model can generate accurate answers based on this information. The content part can be one or more paragraphs of text, which is used to provide the model with enough context to understand the question and generate meaningful answers. The question part (question) is the specific question or inquiry asked by the user, which guides the direction of the model to generate answers.A question can be a simple question or a series of related questions. By providing a clear description of the question in the question section, the model can better understand the user's intent and provide an accurate answer. The purpose of the prompt template is to guide the language model to generate the answer the user expects. By clearly specifying the content and the structure of the question, it can help the model better understand the task and context and generate the expected output. It can also be used to control and customize the style, tone, and format of the generated text.
[0074] The embodiment of the present application provides a more efficient and intelligent question bank assisted extraction system, which can extract questions according to text structure and semantics, decompose answers into different knowledge points, and generate obfuscated answers to improve the quality and diversity of questions. By decomposing answers into different knowledge points through a large model, the flexibility and coverage of questions are improved; generating obfuscated answers increases the diversity and difficulty of questions.
[0075] like Figure 3As shown in the figure, the text preprocessing module: splits the document into paragraphs. The system first preprocesses the documents / texts uploaded / provided by the user and divides them according to titles and chapters. The purpose of this is to facilitate subsequent paragraph analysis and ensure that the system can accurately understand the structure and organization of the text. For example: if the input text is a textbook containing multiple chapters and titles, the system will first divide the text into multiple parts according to the chapters and titles, such as Chapter 1, Chapter 2, etc. Question-answer pair extraction module: extract question-answer pairs. For each paragraph, the system uses a fine-tuned large model to extract question-answer pairs. These question-answer pairs will serve as the basis for generating questions. The large model used here is a fine-tuned large model. First, several segmented paragraphs are selected and annotated, and potential question-answer pairs contained in the paragraphs are identified and annotated. The answers in the data are all from the original text and are the shortest. If a paragraph lacks substantive information, it is marked as invalid. The annotated data is used to fine-tune a large pre-trained model to obtain a dedicated question-answer pair extraction model. For example, the un-fine-tuned large model may extract the following question and answer: "What is the surface area of the Earth?" The answer is "The surface area of the Earth is about 510 million square kilometers", while the fine-tuned large model will extract the answer "about 510 million square kilometers". Answer splitting module: The goal of this module is to split the answer. For answers whose length is less than threshold A, the system further uses the large model to try to split the answer into multiple small points. Successful splitting can be classified as single-choice, multiple-choice, or true-or-false questions. For questions that cannot be split into multiple points, if the answer length is greater than threshold B, it is classified as a short-answer question candidate. If the answer length is less than threshold B, it is classified as a single-choice, multiple-choice, or true-or-false question candidate. If the answer length is greater than threshold A, the answer is set as a short-answer question candidate. Example of splitting: For the answer to the question "What colors are apples?": "red, yellow, green", the answer length is short and can be split, and the system will split it into "red", "yellow", and "green". For the question "Explain the formation process of the planets in the solar system", the answer is "Initially, the solar system was formed in a huge molecular cloud. When part of the material in the cloud began to gather and formed a protostar..." The answer is long and cannot be split into multiple small points. The system classifies it as a candidate for a short-answer question. For the questions "What is the surface area of the earth?" and "About 510 million square kilometers", the answers are short and cannot be split. They are classified as single-choice questions, multiple-choice questions, and true-or-false questions. Confused answer generation module: For candidate question types that include multiple-choice questions (single-choice, multiple-choice) and true-or-false questions, the system uses a large language model to generate at least three confused answers in the same paragraph or the same document.
[0076] For example, you can use prompt:
[0077] """
[0078] You are an experienced teacher, and you want to give a multiple-choice question. The title is {xxx}, and the correct answers are {xxx}{xxx}. Please generate confusing wrong answers with similar answer lengths based on the paragraph information below, and give at least 3 wrong answers. Paragraph information: {xxxxxxxx}
[0079] """
[0080] Question generation module: When generating single-choice questions, the system will select from the candidate questions with single-choice options. After selecting the question, the question will be transformed into "Regarding question {xxx}, which of the following is correct / incorrect?" When the question is correct, one of the correct answers will be taken out, and the three confusing wrong answers will be taken out; vice versa when wrong is selected. When generating multiple-choice questions, the system will select from the candidate questions with multiple-choice options. After selecting the question, the question will be transformed into "Regarding question {xxx}, which of the following options are correct / incorrect?" When the question is correct, 1-4 answers will be taken out, and 3-0 answers will be taken out from the confusing wrong answers; vice versa when wrong is selected. When generating judgment questions, the system will select the candidate question types with judgment questions and answers. After selecting the question, the question will be modified according to the following rules: When there is only one correct answer, the question is rewritten as "xxx is / is not {correct answer}" or xxx is / is not {wrong answer}". The rewriting here can be done through a large model or a rule, and the effect is: the surface area of the earth is / is not about 510 million square kilometers, the answer is: yes / no; the surface area of the earth is / is not about 560 million square kilometers, the answer is: no / yes. When there are multiple correct answers, the question is rewritten as something like "xxx has / only has / does not have {wrong answer}". Correct answers are mixed}", the correct answers are: use yes and correct answers, use only and all correct answers, and use no and all wrong answers. For example: The colors of apples are red and yellow (correct), the colors of apples are only red and yellow (wrong), the colors of apples are red, yellow, and black (wrong), and the color of apples is not black (correct). When generating short-answer questions, the system directly randomly selects a specified item from the candidate question type of simple questions. In this step, the user can choose which wording to use, and the correct answer and mixed wrong answers can also be checked by the user. The final answer will be given by the system to ensure the accuracy of the final answer.
[0081] The question generation method of the embodiment of the present application has a high degree of automation: the system can automatically extract question-answer pairs from a large amount of text, reducing the need for manual operation and greatly improving the efficiency of question bank generation. Intelligent question generation: the system can intelligently generate different types of test questions according to the text content, including multiple-choice questions, true-or-false questions, fill-in-the-blank questions and short-answer questions, so as to meet different test needs. Accurate answer splitting: using a large language model, the system can accurately split the splittable answers to generate multiple-choice questions, increasing the diversity of questions and the difficulty of the test. Confusing answer generation: the system can generate confusing answers in the same text paragraph, providing more options for multiple-choice questions, enhancing the distraction of the questions, and improving the quality of the test. Flexible question customization: the question setter can check one or more correct answers and wrong answers as needed to make the questions more in line with specific teaching objectives.
[0082] Figure 4 Schematic diagram of the main units of the question generating device according to an embodiment of the present application. Figure 4 As shown, the question generating device 400 includes a receiving unit 401, an extracting unit 402, a splitting unit 403, a candidate answer set generating unit 404 and a target question generating unit 405.
[0083] The receiving unit 401 is configured to receive a topic generation request and obtain a target text;
[0084] An extraction unit 402 is configured to split the target text into paragraphs and extract question-answer pairs based on the paragraphs;
[0085] The splitting unit 403 is configured to determine the length and splittable property of the answer in the question-answer pair, determine the type of the answer in the question-answer pair according to the length, the splittable property and a preset threshold, and split the answer according to the type to obtain each split answer;
[0086] A candidate answer set generating unit 404 is configured to generate a candidate answer set of a target question type based on each split answer;
[0087] The target question generating unit 405 is configured to generate a confusing answer, and then generate a target question according to the target question type, question-answer pair, candidate answer set, and confusing answer.
[0088] In some embodiments, the extraction unit 402 is further configured to: call the large model to identify questions in each paragraph, and extract keywords in the identified questions; perform semantic similarity matching between the keywords and the candidate answers in each paragraph to determine matching answers; combine the questions and matching answers into question-answer pairs, and extract the question-answer pairs.
[0089] In some embodiments, the preset threshold includes a first preset threshold and a second preset threshold, the first preset threshold is less than or equal to the second preset threshold, and the splitting unit 403 is further configured to: in response to the length being less than the first preset threshold and the separable attribute being separable, determine that the answer type in the question and answer pair is a separable short answer; in response to the length being less than the first preset threshold and the separable attribute being inseparable, determine that the answer type in the question and answer pair is an inseparable short answer; in response to the length being greater than the second preset threshold and the separable attribute being inseparable, determine that the answer type in the question and answer pair is an inseparable long answer.
[0090] In some embodiments, the splitting unit 403 is further configured to: in response to the type being a separable short answer, split the answer based on the separable dimensions contained in the answer to obtain separate split answers.
[0091] In some embodiments, the candidate answer set generating unit 404 is further configured to: add each split answer to the candidate answer set of the question type corresponding to the split short answer, so as to obtain an updated candidate answer set corresponding to the question type corresponding to the split short answer.
[0092] In some embodiments, the target question generating unit 405 is further configured to generate a confusing answer based on the multiple-choice question and true-or-false question in the target question type, the candidate answer set and the target paragraph information.
[0093] In some embodiments, the target question generation unit 405 is further configured to: call the question generation template corresponding to the target question type, extract information corresponding to the placeholders in the question generation template from the question and answer pairs, candidate answer sets and confused answers, and replace the corresponding placeholders with the information to generate the target question.
[0094] It should be noted that the topic generation method and topic generation device of the present application have a corresponding relationship in terms of specific implementation contents, so the repeated contents will not be described again.
[0095] Figure 5 An exemplary system architecture 500 is shown to which the topic generation method or topic generation device according to the embodiment of the present application can be applied.
[0096] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0097] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0098] The terminal devices 501, 502, 503 may be various electronic devices having a question generation processing screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0099] Server 505 can be a server that provides various services, such as a background management server that provides support for topic generation requests submitted by users using terminal devices 501, 502, and 503 (only as an example). The background management server can receive topic generation requests and obtain target text; split the target text into paragraphs, and extract question-answer pairs based on each paragraph; determine the length and splittable attributes of the answers in the question-answer pairs, determine the type of answers in the question-answer pairs based on the length, splittable attributes, and preset thresholds, and split the answers based on the type to obtain each split answer; generate a set of candidate answers for the target question type based on each split answer; generate a confused answer, and then generate a target topic based on the target question type, question-answer pairs, candidate answer set, and confused answer. Improve the quality and efficiency of text-based topic generation.
[0100] It should be noted that the question generating method provided in the embodiment of the present application is generally executed by the server 505 , and accordingly, the question generating device is generally arranged in the server 505 .
[0101] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0102] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present application. Figure 6 The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0103] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0104] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0105] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present application are executed.
[0106] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. Computer-readable storage media may include, for example, but are not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0107] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0108] The units involved in the embodiments described in the present application may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a receiving unit, an extraction unit, a splitting unit, a candidate answer set generation unit, and a target question generation unit. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0109] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device receives a question generation request and obtains a target text; splits the target text into paragraphs, and extracts question-answer pairs based on each paragraph; determines the length and splittable properties of the answers in the question-answer pairs, determines the type of answers in the question-answer pairs based on the length, splittable properties and preset thresholds, and splits the answers based on the type to obtain each split answer; generates a set of candidate answers for the target question type based on each split answer; generates a confused answer, and then generates a target question based on the target question type, question-answer pairs, candidate answer set, and confused answer.
[0110] The computer program product of the present application includes a computer program, and when the computer program is executed by a processor, the question generating method in the embodiment of the present application is implemented.
[0111] According to the technical solution of the embodiment of the present application, the quality and efficiency of text-based question generation can be improved.
[0112] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A method for generating a topic, characterized in that: include: Receive a topic generation request and obtain the target text; Splitting the target text into paragraphs, and extracting question-answer pairs based on the paragraphs; Determine the length and splittable property of the answer in the question-answer pair, determine the type of the answer in the question-answer pair according to the length, the splittable property and a preset threshold, and split the answer according to the type to obtain split answers; Based on the split answers, generate a set of candidate answers for the target question type; Generate a confused answer, and then generate a target question based on the target question type, the question-answer pair, the candidate answer set, and the confused answer.
2. The method according to claim 1, characterized in that The extracting question-answer pairs based on the respective paragraphs comprises: Calling the big model to identify the questions in each paragraph, and extracting keywords in the identified questions; Performing semantic similarity matching between the keyword and the candidate answers in each paragraph to determine a matching answer; The question sentence and the matching answer are combined into a question-answer pair, and the question-answer pair is extracted.
3. The method according to claim 1, characterized in that The preset threshold includes a first preset threshold and a second preset threshold, the first preset threshold is less than or equal to the second preset threshold, and the determining the type of the answer in the question-answer pair includes: In response to the length being less than the first preset threshold and the separable attribute being separable, determining that the answer type in the question-answer pair is a separable short answer; In response to the length being less than the first preset threshold and the separability attribute being inseparable, determining that the answer type in the question-answer pair is an inseparable short answer; In response to the length being greater than the second threshold and the separability attribute being inseparable, determining that the answer type in the question-answer pair is an inseparable long answer.
4. The method according to claim 1, characterized in that: The answer is split according to the type to obtain each split answer, including: In response to the type being a separable short answer, the answer is split based on the separable dimensions contained in the answer to obtain separate split answers.
5. The method according to claim 1, characterized in that The step of generating a set of candidate answers for a target question type based on the split answers includes: The split answers are added to the candidate answer set of the question type corresponding to the split short answer to obtain an updated candidate answer set corresponding to the question type corresponding to the split short answer.
6. The method according to claim 1, characterized in that The generating of the obfuscated answer comprises: A confusing answer is generated according to the multiple-choice questions and true-or-false questions in the target question type, the candidate answer set and the target paragraph information.
7. The method according to any one of claims 1 to 6, characterized in that: The generating of the target topic comprises: Call the question generation template corresponding to the target question type, extract information corresponding to the placeholder in the question generation template from the question-answer pair, the candidate answer set and the confused answer, and replace the corresponding placeholder with the information to generate the target question.
8. A question generating device, characterized in that: include: A receiving unit is configured to receive a topic generation request and obtain a target text; An extraction unit, configured to split the target text into paragraphs, and extract question-answer pairs based on the paragraphs; a splitting unit configured to determine the length and splittable property of the answer in the question-answer pair, determine the type of the answer in the question-answer pair according to the length, the splittable property and a preset threshold, and split the answer according to the type to obtain split answers; A candidate answer set generating unit, configured to generate a candidate answer set of a target question type based on the split answers; The target question generating unit is configured to generate a confusing answer, and then generate a target question according to the target question type, the question-answer pair, the candidate answer set, and the confusing answer.
9. The device according to claim 8, characterized in that The extraction unit is further configured to: Calling the big model to identify the questions in each paragraph, and extracting keywords in the identified questions; Performing semantic similarity matching between the keyword and the candidate answers in each paragraph to determine a matching answer; The question sentence and the matching answer are combined into a question-answer pair, and the question-answer pair is extracted.
10. The device according to claim 8, characterized in that The preset threshold includes a first preset threshold and a second preset threshold, the first preset threshold is less than or equal to the second preset threshold, and the splitting unit is further configured to: In response to the length being less than the first preset threshold and the separable attribute being separable, determining that the answer type in the question-answer pair is a separable short answer; In response to the length being less than the first preset threshold and the separability attribute being inseparable, determining that the answer type in the question-answer pair is an inseparable short answer; In response to the length being greater than the second threshold and the separability attribute being inseparable, determining that the answer type in the question-answer pair is an inseparable long answer.
11. The device according to claim 8, characterized in that The splitting unit is further configured to: In response to the type being a separable short answer, the answer is split based on the separable dimensions contained in the answer to obtain separate split answers.
12. The device according to claim 8, characterized in that The candidate answer set generating unit is further configured to: The split answers are added to the candidate answer set of the question type corresponding to the split short answer to obtain an updated candidate answer set corresponding to the question type corresponding to the split short answer.
13. The device according to claim 8, characterized in that The target topic generating unit is further configured to: A confusing answer is generated according to the multiple-choice questions and true-or-false questions in the target question type, the candidate answer set and the target paragraph information.
14. An electronic device for generating questions, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
15. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.