Question generation method, system and related equipment based on text content
By obtaining text summary and Q&A reference information, and using a question generation model to generate target question data, the problem of low flexibility and insufficient relevance of question generation methods in the existing technology is solved, and richer and relevant question content is achieved, satisfying users. need.
Patent Information
- Application Number
- CN202410806172.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-06-21
AI Technical Summary
In the existing technology, the flexibility of generating question content based on pre-set fixed question templates is low, resulting in insufficient richness of generated question content and insufficient relevance to the text, making it unable to meet user needs.
By obtaining text summaries, combined with Q&A reference information, the preset question generation model is used to generate target question data, avoiding reliance on fixed question templates and increasing the flexibility and relevance of question generation.
It improves the richness and relevance of question content to the text, meets the specific needs and preferences of users, and enhances the flexibility and user experience of question generation.
Smart Images

Figure CN118378597B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, system and related equipment for generating questions based on text content. Background Art
[0002] With the development of science and technology, users have put forward various processing requirements for electronic texts. For example, it is necessary to automatically generate relevant questions based on electronic texts to be applied in scenarios such as intelligent question answering, or to provide reference for users.
[0003] In the related art, the question content associated with the current text content is usually generated based on a preset fixed question template. The problem with the related art is that the flexibility of the question generation method is low, which is not conducive to improving the richness of the generated question content, and the generated questions have low relevance to the text, which is not enough to meet user needs.
[0004] Therefore, relevant technologies still need to be improved and developed. Summary of the invention
[0005] The main purpose of this application is to provide a method, system and related equipment for generating questions based on text content, aiming to solve the technical problems in the related technology that the method of generating question content based on pre-set fixed question templates for the current text content has low flexibility, is not conducive to improving the richness of the generated question content, has low relevance to the text, and does not meet user needs.
[0006] In order to achieve the above object, the present application provides a first aspect of a text content-based question generation method, wherein the text content-based question generation method comprises:
[0007] Get the text to be processed;
[0008] Obtaining a text summary corresponding to the text to be processed according to the text to be processed, wherein the text summary at least includes key points and key point types obtained according to the text to be processed;
[0009] According to the text summary, obtaining question and answer reference information associated with the text to be processed;
[0010] According to the question-and-answer reference information, target question data corresponding to the text to be processed is generated through a preset question generation model.
[0011] Optionally, obtaining a text summary corresponding to the text to be processed according to the text to be processed includes:
[0012] Dividing the text to be processed into paragraphs to obtain at least one paragraph text;
[0013] Get key point extraction tips;
[0014] According to the key point extraction prompt and the content of each paragraph text, a text summary of each paragraph text is obtained through a preset large language model.
[0015] Optionally, obtaining question and answer reference information associated with the text to be processed according to the text summary includes:
[0016] For the text summary of each paragraph text, obtaining candidate questions of the same type as the main points of the text summary through a preset database;
[0017] Determining a target question associated with the text summary from the candidate questions according to the candidate questions and the main points of the text summary;
[0018] The question and answer reference information associated with the text to be processed is obtained according to the target question.
[0019] Optionally, determining a target question associated with the text summary from the candidate questions according to the candidate questions and the main contents of the text summary includes:
[0020] Generate first sentence embedding information according to the content of the candidate question;
[0021] Generating second sentence embedding information according to the key points of the text summary;
[0022] Determining the similarity between each of the candidate questions and the key content according to the first sentence embedding information and the second sentence embedding information;
[0023] According to the similarity, a target question associated with the text summary is determined from the candidate questions.
[0024] Optionally, generating target question data corresponding to the text to be processed by a preset question generation model according to the question and answer reference information includes:
[0025] Get the first question generation prompt;
[0026] Using the target question as a question template;
[0027] The question template, the first question generation prompt and the key content are input into a preset first question generation model to generate first target question data corresponding to the text to be processed through the first question generation model.
[0028] Optionally, the method further includes:
[0029] Get the first answer to generate prompt;
[0030] According to the first answer generation prompt, the first target question data and the text to be processed, the first target answer data corresponding to the first target question data is obtained through a preset first answer generation model.
[0031] Optionally, obtaining a text summary corresponding to the text to be processed according to the text to be processed; and obtaining question and answer reference information associated with the text to be processed according to the text summary, includes:
[0032] The target paragraph selected by the target object is used as the text to be processed, and a text summary corresponding to the target paragraph is obtained;
[0033] According to the key points in the text summary corresponding to the target paragraph, a reference text associated with the text to be processed is obtained, and the reference text is used as the question and answer reference information.
[0034] Optionally, generating target question data corresponding to the text to be processed by a preset question generation model according to the question and answer reference information includes:
[0035] Get the second question generation prompt;
[0036] The target paragraph, the question-and-answer reference information, and the second question generation prompt are input into a preset second question generation model to generate second target question data corresponding to the target paragraph through the second question generation model.
[0037] Optionally, obtaining a text summary corresponding to the text to be processed according to the text to be processed; and obtaining question and answer reference information associated with the text to be processed according to the text summary, includes:
[0038] The target sentence selected by the target object is used as the text to be processed, and a text summary corresponding to the target sentence is obtained;
[0039] Determining target historical question data associated with the target sentence content from the historical question data of the target object interaction according to the text summary and the target sentence;
[0040] The target historical answer data corresponding to the target historical question data is obtained, and the target historical question data and the target historical answer data are used as question and answer reference information corresponding to the target sentence.
[0041] Optionally, generating target question data corresponding to the text to be processed by a preset question generation model according to the question and answer reference information includes:
[0042] Get the third question generation prompt;
[0043] The target sentence, the question-and-answer reference information and the third question generation prompt are input into a preset third question generation model to obtain the third target question data corresponding to the target sentence through the third question generation model.
[0044] A second aspect of the present application provides a text content-based question generation system, wherein the text content-based question generation system includes:
[0045] A text acquisition module is used to acquire the text to be processed;
[0046] A text summarizing module, used for obtaining a text summary corresponding to the text to be processed according to the text to be processed, wherein the text summary at least includes key points and key point types obtained according to the text to be processed;
[0047] A reference information acquisition module, used to obtain question and answer reference information associated with the text to be processed according to the text summary;
[0048] The question generation module is used to generate target question data corresponding to the text to be processed through a preset question generation model according to the question and answer reference information.
[0049] A third aspect of the present application provides an intelligent terminal, which includes a memory, a processor, and a text content-based question generation program stored in the memory and executable on the processor, wherein the text content-based question generation program implements any one of the steps of the text content-based question generation method when executed by the processor.
[0050] A fourth aspect of the present application provides a computer-readable storage medium, on which a text content-based question generation program is stored. When the text content-based question generation program is executed by a processor, any step of the text content-based question generation method is implemented.
[0051] As can be seen from the above, in the present application scheme, a text to be processed is obtained; based on the text to be processed, a text summary corresponding to the text to be processed is obtained, and the text summary at least includes key content and key type obtained based on the text to be processed; based on the text summary, question and answer reference information associated with the text to be processed is obtained; based on the question and answer reference information, target question data corresponding to the text to be processed is generated through a preset question generation model.
[0052] Compared with the prior art, the target question data is not only generated by the current text content, but also generated by combining the obtained question and answer reference information. On the one hand, the relevance of the text can be used to improve the richness of the generated question content. On the other hand, questions can be generated based on the user's questions and answers and historical interactions to meet user needs and improve user experience. In addition, when generating target question data, it is generated through a question generation model, rather than generated according to a fixed question template. In this way, the question generation method in the present application scheme is more flexible, further improving the richness of the generated question content. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0054] Figure 1 It is a flowchart of a method for generating questions based on text content provided in an embodiment of the present application;
[0055] Figure 2 This is an embodiment of the present application Figure 1 Specific flow diagram of step S200;
[0056] Figure 3 This is an embodiment of the present application Figure 1 Specific flow diagram of step S300;
[0057] Figure 4 It is a schematic diagram of the components of a text content-based question generation system provided in an embodiment of the present application;
[0058] Figure 5 It is a block diagram of the internal structure principle of a smart terminal provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0060] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0061] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, the singular forms "a", "an" and "the" are intended to include plural forms unless the context clearly indicates otherwise.
[0062] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0063] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to being classified into," depending on the context. Similarly, the phrase "if it is determined" or "if classified into [described condition or event]" may be interpreted as meaning "upon determination" or "in response to determining" or "upon classification into [described condition or event]" or "in response to being classified into [described condition or event]," depending on the context.
[0064] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings of the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0065] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present application. Therefore, the present application is not limited to the specific embodiments disclosed below.
[0066] Currently, a lot of information is stored in the form of electronic texts, and users have also put forward various processing requirements for electronic texts. For example, questions and answers related to the content of the electronic texts are automatically generated based on the electronic texts to be applied in scenarios such as intelligent question answering, or to provide references for users.
[0067] In one application scenario, the corresponding question content is directly generated based on a preset fixed question template, but this question generation method has low flexibility and the richness of the question content finally generated is also low.
[0068] In another application scenario, questions can also be generated based on text content through a large language model, but there is a lack of content integration and relevance, and the text content is not associated with the question database, resulting in the generated questions being not relevant and professional enough, and difficult to meet the actual needs of users.
[0069] At the same time, the above question generation scheme relies on a single text content and fails to make extensive use of related content (such as relevant news, research reports and other external information), which limits the richness and timeliness of the generated questions and answers, and fails to fully explore and reflect the content of the corresponding field.
[0070] In addition, the related technologies rely more on general algorithms and lack consideration of the user's personal historical interaction behavior, resulting in the generated questions being too general and insufficient to meet the specific needs or preferences of specific users. In addition, the generated questions have low relevance to the text and are insufficient to meet user needs.
[0071] In order to solve at least one technical problem among the multiple technical problems, in the present application scheme, a text to be processed is obtained; based on the text to be processed, a text summary corresponding to the text to be processed is obtained, and the text summary at least includes key content and key type obtained based on the text to be processed; based on the text summary, question and answer reference information associated with the text to be processed is obtained; based on the question and answer reference information, target question data corresponding to the text to be processed is generated through a preset question generation model.
[0072] Compared with the prior art, the present application solution does not only rely on the current text content to generate the target question data, but also combines the obtained question and answer reference information to generate the target question data. Moreover, when generating the target question data, it is generated through a question generation model, rather than based on a fixed question template. In this way, the question generation method in the present application solution is more flexible, can better meet user needs, and improve the richness of the generated question content.
[0073] Exemplary Methods
[0074] like Figure 1 As shown, the embodiment of the present application provides a method for generating questions based on text content. Specifically, the method comprises the following steps:
[0075] Step S100, obtaining the text to be processed.
[0076] The text to be processed is the initial content for which question content needs to be generated, that is, in the embodiment of the present application, target question data related to the content of the text to be processed needs to be generated. It should be noted that the text to be processed can be the entire document, or one or more paragraphs in the document, or one or more sentences in the document, or one or more words in the document. In the embodiment of the present application, the text to be processed is taken as the entire document as an example for explanation, but it is not a specific limitation.
[0077] Step S200: obtaining a text summary corresponding to the text to be processed according to the text to be processed, wherein the text summary at least includes key content and key type obtained according to the text to be processed.
[0078] The text summary is a content summary of the text to be processed. The text summary can be extracted through a preset model, manually, or by other means. In the embodiment of the present application, the extraction of key points through a preset model is taken as an example for specific description, but it is not a specific limitation.
[0079] Figure 2 This is an embodiment of the present application Figure 1 The specific flow chart of step S200 is as follows: Figure 2 As shown, obtaining a text summary corresponding to the text to be processed according to the text to be processed includes:
[0080] Step S201, dividing the text to be processed into paragraphs to obtain at least one paragraph text;
[0081] Step S202, obtaining a key point extraction prompt;
[0082] Step S203, according to the key point extraction prompt and the content of each paragraph text, a text summary of each paragraph text is obtained through a preset large language model.
[0083] Specifically, in the present application, the text to be processed is first divided into paragraphs, and then key points are extracted for each paragraph text, so that the key point extraction process is more accurate, that is, the accuracy of the extracted key points is improved.
[0084] The text to be processed may be a PDF document, a webpage text, etc. In the embodiment of the present application, a coordinate system is established with the upper left corner of the PDF document or webpage text as the coordinate origin, the wide side (the side parallel to the horizontal direction) as the x-axis, and the long side (the side perpendicular to the horizontal direction) as the y-axis. For a multi-page PDF document, a coordinate system is established for each page.
[0085] For web page text, according to the paragraph tags in its HTML code And <\p> to segment the paragraphs to obtain each candidate paragraph. And you can use the getBoundingClientRect() function in JavaScript (that is, the element position acquisition function for the web page) to obtain the position of the text element relative to the top, bottom, left and right sides of the viewport, that is, to obtain the first The position area corresponding to the candidate paragraphs .
[0086] For a PDF document, the PDF parser locates the position area corresponding to each line of text in the PDF document, and determines the line spacing between adjacent lines based on the position area of each line of text. Thus, it is determined whether the adjacent lines belong to the same paragraph based on the line spacing between adjacent lines, so as to divide each line of text into paragraphs and obtain multiple paragraph texts.
[0087] Specifically, for PDF documents, locate the range of each line of text according to the preset PDF parser and use To express the The position of the line text, where For the The coordinates of the upper left corner of the rectangular box corresponding to the line of text. For the The coordinates of the lower right corner of the rectangle corresponding to the line of text. The line spacing between adjacent lines can be calculated by the coordinates of the rectangle of the corresponding text line, for example Line text and The line spacing of line text can be expressed as Furthermore, after obtaining the line spacing between each adjacent line, it is possible to determine whether two adjacent lines belong to the same paragraph based on the line spacing between the adjacent lines.
[0088] In an application scenario, the line spacing between adjacent lines can be compared with a preset line spacing threshold. If it is greater than the preset line spacing threshold, it means that the two adjacent lines do not belong to the same paragraph, otherwise it means that the two adjacent lines belong to the same paragraph.
[0089] In an embodiment of the present application, the mean line spacing is used as the line spacing threshold, and whether two adjacent lines belong to the same paragraph is determined based on the mean line spacing, thereby improving the accuracy of paragraph division, and the position area corresponding to the paragraph text can be determined based on the position area corresponding to each line of text in the paragraph text.
[0090] The key point extraction prompt is a prompt used to instruct the model to extract key points, and the large language model is pre-set. In the embodiment of the present application, the large language model prompt project is used to summarize each paragraph into no more than 3 key points, and the key point extraction prompt is: "Please summarize the following paragraph into no more than 3 key points, each key point is no more than 20 words, and indicate the key point type involved in each key point (that is, the level involved in the key point, such as macroeconomics, industry, company, product, etc.), and return the following json format" + [json example] + [paragraph text].
[0091] An example of an extracted JSON provided in an embodiment of the present application is as follows:
[0092] {
[0093] "Key points": [
[0094] {
[0095] "Content": "The plug-in hybrid track is the best choice at present",
[0096] "Level": "Industry"
[0097] },
[0098] {
[0099] "Content": "The company has been deeply involved in the plug-in hybrid field, with stable sales",
[0100] "Level": "Company"
[0101] },
[0102] {
[0103] "Content": "New car launch expectations boost company valuations",
[0104] "Level": "Company"
[0105] } ]
[0107] }.
[0108] It should be noted that the number of key points in the summary and the number of words for each key point specified in the key point extraction prompt can be set and adjusted according to actual needs, and are not specifically limited here. At the same time, the types and number of key point types can also be pre-set and adjusted according to actual needs, and a general open source large language model can be selected based on the number of key points in the summary, the number of words in the key points, the type of key points, etc., to ensure that the large language model can identify the corresponding text summary and its key point type. In this way, the content and key points of each part of the article can be better summarized based on the characteristics of the paragraph text (i.e., each paragraph in the text), while filtering out irrelevant details, such as the specific values of financial indicators.
[0109] Step S300, obtaining question and answer reference information associated with the text to be processed according to the text summary.
[0110] Among them, the question and answer reference information is information associated with the text summary, which is used as a reference in the question generation process to make the generated questions more in line with user needs, or to enrich the original content based on which the generated questions are based, thereby enriching the generated target questions.
[0111] In one application scenario, the question and answer reference information includes reference questions and answers, reference text, etc. associated with the text to be processed (or a text summary corresponding to the text to be processed), which is not specifically limited here.
[0112] It should be noted that the question and answer reference information may specifically include at least one of the following information: target questions and / or answers to target questions associated with the text summary corresponding to the text to be processed, reference text associated with the text summary corresponding to the text to be processed (target paragraph), target historical question data and / or answers to target historical question data associated with the text to be processed (target sentence).
[0113] In an embodiment of the present application, the question and answer reference information is information related to the content of the text to be processed (or to the text of each paragraph in the text to be processed), and can be used as reference information in the question generation process to expand the scope of data considered in the question generation process, improve the richness of the generated target question data, and obtain better intelligent question generation effects.
[0114] It should be noted that the key point type corresponding to the text summary can also be obtained by other methods, such as first extracting the key points corresponding to the text to be processed through a large language model, and then determining the key point type corresponding to the key point through manual annotation, search matching, etc., which is not specifically limited here. In the embodiment of the present application, when the large language model extracts and obtains each of the text summaries, the key point type corresponding to each of the text summaries is directly extracted.
[0115] Figure 3 This is an embodiment of the present application Figure 1 The specific flow chart of step S300 is as follows: Figure 3 As shown, obtaining question and answer reference information associated with the text to be processed according to the text summary includes:
[0116] Step S301, for the text summary of each paragraph text, obtaining candidate questions of the same type as the key points of the text summary through a preset database;
[0117] Step S302, determining a target question associated with the text summary from the candidate questions according to the candidate questions and the main contents of the text summary;
[0118] Step S303: obtaining question and answer reference information associated with the text to be processed according to the target question.
[0119] Among them, the preset database is a pre-set database that is the same as the field of the text to be processed, and is used to store preset frequently asked questions in the field. In the embodiment of the present application, the field corresponding to the text to be processed is the financial field as an example for specific description, but it is not a specific limitation. Specifically, the database stores the content corresponding to each question and its corresponding type. The target question is a question whose type is the same as the key point type, and the content is related to (or similar to) the content of the text summary.
[0120] Furthermore, in the embodiment of the present application, the text to be processed has been divided into paragraph texts, and each paragraph text is processed separately to improve the processing efficiency and accuracy during the processing. For each paragraph text, according to the summarized text summary, the questions frequently asked by financial practitioners corresponding to the text summary are searched from the preset financial FAQ database. Among them, the questions in the financial FAQ database are collected from professionals, or manually selected industry-representative questions. Each question is marked with the type (i.e., level, such as macroeconomics, industry, company, product, etc.) involved in the question as the label of the question, and can also be marked with the sentence embedding information corresponding to the question. Among them, the sentence embedding information can be generated in advance through a large language model, and then the top k questions with the same key point type and the closest sentence embedding information corresponding to the current text summary are screened from the database. The value of k can be pre-set and adjusted according to actual needs, and is not specifically limited here.
[0121] In an embodiment of the present application, the first sentence embedding information corresponding to the candidate question can be generated in real time to reduce the amount of data that needs to be pre-stored and reduce the storage space occupied.
[0122] Specifically, determining a target question associated with the text summary from the candidate questions according to the candidate questions and the main contents of the text summary includes:
[0123] Generate first sentence embedding information according to the content of the candidate question;
[0124] Generating second sentence embedding information according to the key points of the text summary;
[0125] Determining the similarity between each of the candidate questions and the key content according to the first sentence embedding information and the second sentence embedding information;
[0126] According to the similarity, a target question associated with the text summary is determined from the candidate questions.
[0127] It should be noted that the first sentence embedding information may also be pre-stored in the preset database to reduce the amount of data calculation in the real-time processing process and improve processing efficiency.
[0128] The database stores information related to frequently asked questions, including the content and type of the questions. In one application scenario, the frequently asked questions stored in the database are in the following format: [
[0130] {
[0131] "Question": "How do current macroeconomic trends affect the stock market?",
[0132] "Level": "Macroeconomics",
[0133] "embedding": "eJyrVkrLz1eyUlBKSixON... (omitted to simplify presentation)"
[0134] },
[0135] {
[0136] "Question": "What factors influence the funding of startups?",
[0137] "Level": "Company",
[0138] "embedding": "eJzrWJSSW5iamZmaX6... (omitted to simplify presentation)"
[0139] },
[0140] …
[0141] ].
[0142] In the embodiment of the present application, the level represents the type (the type involved in the question or the key point type corresponding to the text summary).
[0143] Step S400: obtaining question and answer reference information associated with the text to be processed according to the text summary.
[0144] The question generation model is a pre-trained large language model, which is used to generate corresponding target question data according to prompts and other input content.
[0145] In the embodiment of the present application, the target question data corresponding to the to-be-processed text is generated by a preset question generation model according to the question and answer reference information, including:
[0146] Get the first question generation prompt;
[0147] Using the target question as a question template;
[0148] The question template, the first question generation prompt and the key content are input into a preset first question generation model to generate first target question data corresponding to the text to be processed through the first question generation model.
[0149] In one application scenario, the method further includes:
[0150] Get the first answer to generate prompt;
[0151] According to the first answer generation prompt, the first target question data and the text to be processed, the first target answer data corresponding to the first target question data is obtained through a preset first answer generation model.
[0152] The first question generation prompt is a pre-set prompt (i.e., prompt) for rewriting the key points into questions. Specifically, the searched target question information is used as a question template, and the pre-trained first question generation model (large language model) and the first question generation prompt are used to rewrite the key points in the text summary into the corresponding first target question data.
[0153] In one application scenario, the prompt for the first question generation is: "Please refer to the following question-asking method" + [k pieces of target question information retrieved] + "Rewrite the following key points into one question" + [key points in the text summary].
[0154] For example:
[0155] Key points from the text summary: Expectations of new vehicle launches boost company valuations;
[0156] 2 target questions retrieved: What factors mainly affect the company's market value? How will the market acceptance of new products affect the company's long-term value?
[0157] It should be noted that the specific form of the prompt generated by the first question can be set and adjusted according to actual needs and is not specifically limited.
[0158] The first answer generation prompt (i.e., the answer generation prompt) is used to indicate the generation process of the answer data for the first target question data. For each first target question data generated, the first answer generation model (large language model) and the first answer generation prompt are used to generate a corresponding answer (i.e., the first target answer data) according to the paragraph text to which the text summary corresponding to the first target question data belongs.
[0159] In one application scenario, the prompt for generating the first answer is: "Please answer based on the following text" + [first target question data] + "The text is:" + [the paragraph text to which the text summary corresponding to the first question data belongs].
[0160] In this way, the key points can be rewritten into questions using the questions asked by professionals as a template. On the one hand, the rewritten questions are closer to the perspective of professionals; on the other hand, the generated questions will be more macro, rather than asking about some details in the article (such as the specific values of specific economic indicators). In this way, the quality of the generated target question data can be improved, thereby improving the user experience.
[0161] It should be noted that in the description, the question and answer reference information only includes one type of information, namely, the target question information corresponding to the target question. However, in the embodiment of the present application, the question and answer reference information may be in the form of one or more of a variety of information. For example, the question and answer reference information may include the target question information corresponding to the target question, the reference text obtained based on the main points of the text, the reference text corresponding to the target paragraph selected from the target historical object, and one or more of the target historical question data and the target historical answer data corresponding to the target sentence selected from the target object.
[0162] In the embodiments of the present application, the specific generation method of the target question data is described by taking the question and answer reference information as one of them as an example. It should be noted that when the question and answer reference information includes multiple types, the corresponding target question is generated based on each corresponding generation method, and the final target question is obtained by combining them.
[0163] In some embodiments of the present application, obtaining a text summary corresponding to the text to be processed according to the text to be processed; and obtaining question and answer reference information associated with the text to be processed according to the text summary include:
[0164] The target paragraph selected by the target object is used as the text to be processed, and a text summary corresponding to the target paragraph is obtained;
[0165] According to the key points in the text summary corresponding to the target paragraph, a reference text associated with the text to be processed is obtained, and the reference text is used as the question and answer reference information.
[0166] Specifically, at this time, the text to be processed includes a target paragraph selected by a target object; the target question data corresponding to the text to be processed is generated by a preset question generation model according to the question and answer reference information, including:
[0167] Get the second question generation prompt;
[0168] The target paragraph, the question-and-answer reference information, and the second question generation prompt are input into a preset second question generation model to generate second target question data corresponding to the target paragraph through the second question generation model.
[0169] In one application scenario, only the target paragraph selected by the target object is searched to obtain the corresponding reference text, without searching the entire text.
[0170] In another application scenario, the question and answer reference information also includes the reference text corresponding to the target paragraph selected by the target object in history. The reference text corresponding to the target paragraph selected by the target object in history is also used as the current question and answer reference information to obtain question and answer reference information that better meets the user's needs, thereby generating target question data that better meets the user's needs.
[0171] In an application scenario, a target paragraph for target object selection is determined from multiple paragraph texts corresponding to the text to be processed, as follows:
[0172] Obtaining the location area corresponding to each paragraph text;
[0173] The target paragraph is determined from each of the paragraph texts according to the interaction position corresponding to the interaction operation triggered by the target object and the position area corresponding to each of the paragraph texts.
[0174] Among them, the interactive operation triggered by the target object may include operations such as clicking and swiping triggered by a mouse or touch screen, which are not specifically limited here. The position area corresponding to each paragraph text is used to indicate the position coordinate range corresponding to each paragraph text. The target paragraph selected by the target object in the paragraph text can be determined based on the coordinates of the interactive position and the coordinates of the position area. Among them, the target paragraph may include one or more paragraph texts. In the embodiment of the present application, a specific description is given by taking one paragraph text as an example. If the target paragraph includes multiple paragraph texts, the processing method provided in the embodiment of the present application can be used for each paragraph text separately, which will not be repeated here.
[0175] Furthermore, the method further comprises:
[0176] Get the second answer generation prompt;
[0177] The target paragraph, the reference text, the second target question data and the second answer generation prompt are input into a preset second answer generation model to generate second target answer data corresponding to the second target question data through the second answer generation model.
[0178] It should be noted that in an application scenario, the target question data can be pre-set as a set of blank data, and the target question data can be updated based on the generated first target question data, second target answer data, second target question data, second target answer data and other data.
[0179] The second question generation prompt (ie, prompt) is used to indicate the generation process of the second target question data. The second answer generation prompt is used to indicate the generation process of the second target answer data.
[0180] Specifically, for each paragraph of text, the front end monitors the mouse click behavior of the user (ie, the target object), obtains the coordinates corresponding to the mouse click position, selects the corresponding text in the PDF document or web page according to the coordinates, and obtains the target paragraph of interest to the user.
[0181] Based on the text summary of the target paragraph, relevant research reports and news are retrieved to obtain a series of supplementary content as the reference text corresponding to the target paragraph. Based on the reference text, the second question generation model (preset large language model) is used to generate new questions.
[0182] In one application scenario, the second question generation prompt and the second answer generation prompt may also be combined, and the corresponding second target question data and second target answer data may be generated simultaneously using the same model. Specifically, the prompt is: "Please follow the following text" + [reference text, separated by semicolons] + "Generate 5 questions and corresponding answers".
[0183] The number of the generated second target question data can be set and adjusted according to actual needs, and is not specifically limited here. The target paragraph text contains less content, and directly generating questions based on the target paragraph text may result in too much detail, or duplicate the questions corresponding to the full text generated based on the text summary of the full text above. Therefore, by searching the relevant corpus, questions related to the paragraph content but not mentioned in the original text can be extracted, making the generated second target question data richer.
[0184] In an embodiment of the present application, question content corresponding to the target sentence can also be generated based on a single (or multiple) sentences (or clauses) selected by the target object (ie, the user) in the text to be processed, that is, the target sentence selected by the user.
[0185] Therefore, the target sentence in the text to be processed can also be obtained based on the target user interaction operation, and then the target historical target question data similar to the target sentence can be searched from the historical target question database corresponding to the target object, wherein the historical target question database includes historical questions asked by the target object and their corresponding answers.
[0186] In some embodiments of the present application, obtaining a text summary corresponding to the text to be processed according to the text to be processed; and obtaining question and answer reference information associated with the text to be processed according to the text summary include:
[0187] The target sentence selected by the target object is used as the text to be processed, and a text summary corresponding to the target sentence is obtained;
[0188] Determining target historical question data associated with the target sentence content from the historical question data of the target object interaction according to the text summary and the target sentence;
[0189] The target historical answer data corresponding to the target historical question data is obtained, and the target historical question data and the target historical answer data are used as question and answer reference information corresponding to the target sentence.
[0190] Furthermore, the step of generating target question data corresponding to the text to be processed by a preset question generation model according to the question and answer reference information includes:
[0191] Get the third question generation prompt;
[0192] The target sentence, the question-and-answer reference information and the third question generation prompt are input into a preset third question generation model to obtain the third target question data corresponding to the target sentence through the third question generation model.
[0193] Specifically, the front end monitors the user's mouse swiping behavior of the text, obtains the coordinate range of the swiping position in the corresponding coordinate system, and selects the corresponding sentence or clause in the PDF document or web page text as the target sentence for target object selection.
[0194] For the target sentence, as well as the historical questions and answers to the historical questions in the historical question data corresponding to the target object, the sentence embedding method is used to calculate their respective sentence embedding information (embedding). The inner product of the embedding of the selected sentence and the embedding of the historical question is calculated to obtain the vector similarity, and the historical questions are sorted from high to low according to the similarity, and the top k most relevant historical questions and their corresponding answers are selected as the question and answer reference information corresponding to the target sentence. Specifically, the question and answer reference information includes the target historical question data and the target historical answer data. Among them, the specific value of k can be set and adjusted according to actual needs, and is not specifically limited here.
[0195] Based on the third question generation prompt, a preset third question generation model (pre-set large language model) is used to expand the target sentence selected by the user into a more in-depth and macro question according to the target historical question data and its corresponding target historical answer data.
[0196] In one application scenario, the third question generates a prompt: "The user's historical questions and corresponding answers are as follows:" + [target historical question data + target historical answer data] + "Please expand 3 deeper and more macro questions based on the historical questions and the following content" + [target sentence].
[0197] The specific number of generated questions can be set and adjusted according to actual needs and is not specifically limited here.
[0198] In some embodiments of the present application, the target sentence selected by the user is: Plug-in hybrid models are the company's basic sales base and are mostly in a higher price range than pure electric models.
[0199] Historical user questions (with corresponding answers omitted) include: What is the difference between plug-in hybrid and pure electric models in market positioning? What impact does the high pricing of plug-in hybrid models have on sales? Why are consumers willing to pay a higher price for plug-in hybrid models...
[0200] The generated questions (i.e., the third objective questions) include: As electric vehicle technology advances and costs decrease, how will the positioning and competitiveness of plug-in hybrid vehicles change in the future automotive market...
[0201] In this way, for a single target sentence containing less text information, the user's previous question data and the content in the sentence are combined to conduct in-depth questioning, making the questions raised more in-depth and targeted, and more in line with user needs.
[0202] It should be noted that, during the processing, different models are used to generate corresponding questions and answers respectively, for example, the first question generation model and the first answer generation model are used to generate corresponding first target question data and first target answer data respectively. In actual use, the prompts can also be modified to achieve the use of the same model to generate corresponding questions and answers at the same time, which is not specifically limited here.
[0203] It should be further explained that in the embodiments of the present application, the models used, such as the first target question generation model, the first answer generation model, the second target question generation model, the second answer generation model, the third target question generation model, the third answer generation model, etc., are all pre-trained large language models.
[0204] In an application scenario, the various models may be the same large language model, and different effects may be achieved based on different prompts.
[0205] In the embodiment of the present application, each model is a different large language model obtained by training based on different samples. In this way, better data generation effect can be obtained for different data that need to be generated.
[0206] As can be seen from the above, in the text content-based question generation method provided by the embodiment of the present application, the target question data is not only generated by relying on the current text content, but also generated by combining the obtained question and answer reference information. In addition, when generating the target question data, it is generated by a question generation model, rather than generated according to a fixed question template. In this way, the question generation method in the present application scheme is more flexible, can better meet user needs, and improve the richness of the generated question content.
[0207] At the same time, the embodiment of the present application summarizes the target document content and generates new questions in combination with a database that pre-stores frequently asked questions, thereby improving the accuracy and relevance of question generation, making the generated questions more in line with the actual needs of financial practitioners, thereby solving the shortcomings of existing methods in content integration and professionalism.
[0208] The embodiment of the present application also enhances the question generation process based on the reference information obtained through retrieval, expands the text content of the question to news and research reports related to the original text, increases the diversity and timeliness of the question content, and thus solves the problem of content source limitations.
[0209] Furthermore, in the embodiment of the present application, new questions are generated based on the user's historical interaction behavior (i.e., the user's historical questions and their answers), so that the generated questions are more personalized and in-depth. Such improvements make the question generation closer to the needs and preferences of specific users.
[0210] Exemplary Devices
[0211] like Figure 4 As shown in , corresponding to the text content-based question generation method, the embodiment of the present application also provides a text content-based question generation system, and the text content-based question generation system includes:
[0212] The text acquisition module 410 is used to acquire the text to be processed;
[0213] A text summarizing module 420 is used to obtain a text summary corresponding to the text to be processed according to the text to be processed, wherein the text summary at least includes key points and key point types obtained according to the text to be processed;
[0214] A reference information acquisition module 430, configured to obtain question and answer reference information associated with the text to be processed according to the text summary;
[0215] The question generation module 440 is used to generate target question data corresponding to the text to be processed according to the question and answer reference information through a preset question generation model.
[0216] In this way, the target question data is generated not only by relying on the current text content, but also by combining the obtained question and answer reference information. Moreover, when generating the target question data, it is generated through the question generation model, rather than generated according to a fixed question template. In this way, the question generation method in the present application scheme is more flexible, can better meet user needs, and improve the richness of the generated question content.
[0217] It should be noted that the specific structure and implementation of the text content-based question generation system and its various modules or units can refer to the corresponding description in the method embodiment, and will not be repeated here.
[0218] It should be noted that the division method of each module of the text content-based question generation system is not unique and is not specifically limited here.
[0219] Based on the embodiment, the present application also provides a smart terminal, whose principle block diagram can be as follows: Figure 5 As shown. The intelligent terminal includes a processor, a memory, a network interface and a display screen connected via a system bus. Among them, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a text content-based question generation program. The internal memory provides an environment for the operation of the operating system and the text content-based question generation program in the non-volatile storage medium. The network interface of the intelligent terminal is used to communicate with an external terminal via a network connection. When the text content-based question generation program is executed by the processor, the steps of any one of the text content-based question generation methods are implemented. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen.
[0220] Those skilled in the art will understand that Figure 5 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the smart terminal to which the solution of the present application is applied. The specific smart terminal may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0221] In one embodiment, a smart terminal is provided, which includes a memory, a processor, and a text content-based question generation program stored in the memory and executable on the processor. When the text content-based question generation program is executed by the processor, the steps of any one of the text content-based question generation methods provided in the embodiments of the present application are implemented.
[0222] An embodiment of the present application also provides a computer-readable storage medium, on which a text content-based question generation program is stored. When the text content-based question generation program is executed by a processor, the steps of any one of the text content-based question generation methods provided in the embodiments of the present application are implemented.
[0223] It should be understood that the serial numbers of the steps in the embodiments do not imply a sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0224] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the functional units and modules is used as an example. In practical applications, the function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the device can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0225] In the embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0226] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0227] In the embodiments provided in the present application, it should be understood that the disclosed system / terminal device and method can be implemented in other ways. For example, the system / terminal device embodiments described above are only schematic, for example, the division of the modules or units is only a logical function division, and in actual implementation, other division methods can be used, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0228] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process in the embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of each method embodiment when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.
[0229] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method for generating questions based on text content, characterized in that: The method comprises: Get the text to be processed; According to the text to be processed, a text summary corresponding to the text to be processed is obtained, wherein the text summary is a content summary of the text to be processed, and the text summary at least includes key content and key type obtained according to the text to be processed; According to the text summary, obtaining question and answer reference information associated with the text to be processed; According to the question-answer reference information, target question data corresponding to the text to be processed is generated by a preset question generation model; The step of obtaining a text summary corresponding to the text to be processed according to the text to be processed includes: dividing the text to be processed into paragraphs to obtain at least one paragraph text; obtaining a key point extraction prompt; and obtaining a text summary of each paragraph text through a preset large language model according to the key point extraction prompt and the content of each paragraph text; The method of obtaining question and answer reference information associated with the text to be processed based on the text summary includes: for the text summary of each paragraph text, obtaining candidate questions of the same type as the main points of the text summary through a preset database; determining target questions associated with the text summary from the candidate questions based on the candidate questions and the main points of the text summary; and obtaining question and answer reference information associated with the text to be processed based on the target questions.
2. The method for generating questions based on text content according to claim 1, characterized in that: The step of determining a target question associated with the text summary from the candidate questions based on the candidate questions and the main contents of the text summary includes: Generate first sentence embedding information according to the content of the candidate question; Generating second sentence embedding information according to the key points of the text summary; Determining the similarity between the candidate question and the key content according to the first sentence embedding information and the second sentence embedding information; According to the similarity, a target question associated with the text summary is determined from the candidate questions.
3. The method for generating questions based on text content according to claim 1, characterized in that: The step of generating target question data corresponding to the text to be processed by a preset question generation model according to the question and answer reference information includes: Get the first question generation prompt; Using the target question as a question template; The question template, the first question generation prompt and the key content are input into a preset first question generation model to generate first target question data corresponding to the text to be processed through the first question generation model.
4. The method for generating questions based on text content according to claim 3, characterized in that: The method further comprises: Get the first answer to generate prompt; According to the first answer generation prompt, the first target question data and the text to be processed, the first target answer data corresponding to the first target question data is obtained through a preset first answer generation model.
5. The method for generating questions based on text content according to claim 1, characterized in that: The step of obtaining a text summary corresponding to the text to be processed according to the text to be processed; and obtaining question and answer reference information associated with the text to be processed according to the text summary, includes: The target paragraph selected by the target object is used as the text to be processed, and a text summary corresponding to the target paragraph is obtained; According to the key points in the text summary corresponding to the target paragraph, a reference text associated with the text to be processed is obtained, and the reference text is used as the question and answer reference information.
6. The method for generating questions based on text content according to claim 5, characterized in that: The step of generating target question data corresponding to the text to be processed by a preset question generation model according to the question and answer reference information includes: Get the second question generation prompt; The target paragraph, the question-and-answer reference information, and the second question generation prompt are input into a preset second question generation model to generate second target question data corresponding to the target paragraph through the second question generation model.
7. The method for generating questions based on text content according to claim 1, characterized in that: The step of obtaining a text summary corresponding to the text to be processed according to the text to be processed; and obtaining question and answer reference information associated with the text to be processed according to the text summary, includes: The target sentence selected by the target object is used as the text to be processed, and a text summary corresponding to the target sentence is obtained; Determining target historical question data associated with the target sentence content from the historical question data of the target object interaction according to the text summary and the target sentence; The target historical answer data corresponding to the target historical question data is obtained, and the target historical question data and the target historical answer data are used as question and answer reference information corresponding to the target sentence.
8. The method for generating questions based on text content according to claim 7, characterized in that: The step of generating target question data corresponding to the text to be processed by a preset question generation model according to the question and answer reference information includes: Get the third question generation prompt; The target sentence, the question-and-answer reference information and the third question generation prompt are input into a preset third question generation model to obtain the third target question data corresponding to the target sentence through the third question generation model.
9. A text content-based question generation system, characterized in that: The system comprises: A text acquisition module is used to acquire the text to be processed; A text summarizing module, used for obtaining a text summary corresponding to the text to be processed according to the text to be processed, wherein the text summary is a content summary of the text to be processed, and the text summary at least includes key points and key point types obtained according to the text to be processed; A reference information acquisition module, used to obtain question and answer reference information associated with the text to be processed according to the text summary; A question generation module, used to generate target question data corresponding to the text to be processed through a preset question generation model according to the question and answer reference information; The text summarization module is specifically used to: divide the text to be processed into paragraphs to obtain at least one paragraph text; obtain a key point extraction prompt; and obtain a text summary of each paragraph text through a preset large language model according to the key point extraction prompt and the content of each paragraph text; The reference information acquisition module is specifically used for: for the text summary of each paragraph text, obtaining candidate questions of the same type as the main points of the text summary through a preset database; determining the target questions associated with the text summary from the candidate questions based on the candidate questions and the main points of the text summary; and obtaining the question and answer reference information associated with the text to be processed based on the target questions.
10. An intelligent terminal, characterized in that: The intelligent terminal includes a memory, a processor, and a text content-based question generation program stored in the memory and executable on the processor. When the text content-based question generation program is executed by the processor, the steps of the text content-based question generation method as described in any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a text content-based question generation program, and when the text content-based question generation program is executed by the processor, the steps of the text content-based question generation method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Information processing method and device based on large language model, equipment and storage medium
CN117521675A
Question and answer pair generation method, computer equipment and storage medium
CN117633190A
Business problem reply method and device, storage medium and electronic equipment
CN117688155A
