Method, device, storage medium and electronic equipment for generating answer content
By using a question generation model to generate a training sample set based on references to train the target question answering model, the problem of poor training effect of intelligent question answering models is solved, and the accuracy of the question answering model is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING CALORIE INFORMATION TECH CO LTD
- Filing Date
- 2026-04-27
- Publication Date
- 2026-07-14
AI Technical Summary
Existing intelligent question answering models rely on manually constructed training sample sets during training, resulting in poor training performance and consequently affecting the accuracy of the question answering model's responses.
By utilizing a question generation model to generate a training sample set based on references, the knowledge coverage and accuracy of the training sample set are improved, thereby training the target question-answering model.
It improves the accuracy of the question-answering model in answering the target question and solves the problem of poor training effect caused by relying on manually constructed training sample sets.
Smart Images

Figure CN122388104A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and more specifically, to a method, apparatus, storage medium, and electronic device for generating response content. Background Technology
[0002] With the continuous development of technology and artificial intelligence, intelligent question-answering systems have been widely applied in various fields. Currently, in related technologies, intelligent question-answering models in the health and fitness field typically rely on manually constructed training sample sets for supervised learning. These sample sets are usually manually compiled by domain experts or researchers, creating question-answer pairs. However, manually compiled samples are easily influenced by the subjective experience of the annotators and are susceptible to limitations in the professional capabilities of the compilers. Consequently, when training question-answering models based on such sample sets, the training effect is poor, leading to low accuracy in application.
[0003] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0004] The main objective of this application is to provide a method, apparatus, storage medium, and electronic device for generating answer content, in order to solve the problem that the question-answering models used in related technologies rely on manually constructed training sample sets during training, resulting in poor training effects and low accuracy of answers when applied.
[0005] To achieve the above objectives, according to one aspect of this application, a method for generating answer content is provided. The method includes: obtaining a target question of a target object; processing the target question using a target question-answering model to obtain answer content for the target question, wherein the target question-answering model is trained using a training sample set, where training samples in the training sample set are sample questions, and real labels are sample answers corresponding to the sample questions; the training sample set is generated by a question generation model based on references.
[0006] Optionally, the method for generating the answer content also includes: obtaining at least one reference; segmenting each reference into multiple text blocks corresponding to each reference; processing each text block separately using a question generation model to obtain the output result corresponding to each text block, wherein the output result includes sample questions and sample answers; and generating a training sample set based on the output results corresponding to multiple text blocks.
[0007] Optionally, the method for generating the answer content also includes: for each reference, determining the text structure of the reference; determining the text segmentation method corresponding to the reference based on the text structure of the reference; and segmenting the reference into multiple text blocks based on the text segmentation method to obtain multiple text blocks corresponding to the reference.
[0008] Optionally, the method for generating the answer content further includes: when the text structure represents that the reference has table of contents metadata and the table of contents does not have a multi-level nested structure, determining the first segmentation method as the text segmentation method corresponding to the reference, wherein the first segmentation method is used to segment the reference text according to the chapter range in the table of contents metadata; when the text structure represents that the reference has table of contents metadata and the table of contents has a multi-level nested structure, determining the second segmentation method as the text segmentation method corresponding to the reference, wherein the second segmentation method is used to segment the reference text according to the entry range in the target level in the table of contents metadata; When the text structure indicates that the references do not have table of contents metadata and there are no target type pages in the references, the third segmentation method is determined as the text segmentation method corresponding to the references. The third segmentation method is used to determine the scope of the entries based on the starting page number of the entries indicated by the operation object, and to segment the references according to the scope of the entries. When the text structure indicates that the references do not have table of contents metadata and there are target type pages in the references, the fourth segmentation method is determined as the text segmentation method corresponding to the references. The fourth segmentation method is used to segment the references according to the scope of the entries indicated by the operation object.
[0009] Optionally, the method for generating the answer content also includes: segmenting the references based on the text segmentation method to obtain multiple initial text blocks corresponding to the references; for each initial text block, segmenting the initial text block according to the target text segmentation method to obtain multiple text blocks corresponding to the initial text block.
[0010] Optionally, the method for generating the answer content further includes: for each text block, determining a target prompt word from multiple prompt words, wherein each prompt word includes at least one of the following constraints: question generation constraint, domain constraint, question type constraint; and processing the target prompt word and text block through a question generation model to obtain the output result corresponding to the text block.
[0011] Furthermore, the method for generating the answer content also includes: processing the target prompt words and text blocks through a question generation model to obtain the initial output result corresponding to the text block, wherein the initial output result includes the initial sample question and the initial sample answer; if the target language text exists in the initial output result, determining the translation method corresponding to the text format of the initial output result; and performing text translation processing on the initial output result based on the translation method corresponding to the text format to obtain the output result.
[0012] To achieve the above objectives, according to another aspect of this application, an apparatus for generating answer content is provided. The apparatus includes: a first acquisition module for acquiring a target question of a target object; and a first processing module for processing the target question using a target question-and-answer model to obtain answer content for the target question. The target question-and-answer model is trained using a training sample set, where training samples in the training sample set are sample questions, and real labels are sample answers corresponding to the sample questions. The training sample set is generated by a question generation model based on references.
[0013] Optionally, the device for generating the answer content further includes: a second acquisition module for acquiring at least one reference; a segmentation module for segmenting each reference into multiple text blocks corresponding to each reference; a second processing module for processing each text block separately using a question generation model to obtain an output result corresponding to each text block, wherein the output result includes a sample question and a sample answer; and a generation module for generating a training sample set based on the output results corresponding to the multiple text blocks.
[0014] Optionally, the segmentation module further includes: a first determination submodule, used to determine the text structure of each reference; a second determination submodule, used to determine the text segmentation method corresponding to the reference based on the text structure of the reference; and a segmentation submodule, used to segment the reference based on the text segmentation method to obtain multiple text blocks corresponding to the reference.
[0015] Optionally, the second determining submodule further includes: a first determining unit, used to determine the first segmentation method as the text segmentation method corresponding to the reference when the text structure representing the reference has table of contents metadata and the table of contents does not have a multi-level nested structure, wherein the first segmentation method is used to segment the reference text according to the chapter range in the table of contents metadata; a second determining unit, used to determine the second segmentation method as the text segmentation method corresponding to the reference when the text structure representing the reference has table of contents metadata and the table of contents has a multi-level nested structure, wherein the second segmentation method is used to segment the reference text according to the entry range in the target level in the table of contents metadata; The third determining unit is used to determine the third segmentation method as the text segmentation method corresponding to the reference when the text structure indicates that the reference does not have table of contents metadata and there is no target type page in the reference. The third segmentation method is used to determine the entry range according to the entry starting page number indicated by the operation object, and to segment the reference text according to the entry range. The fourth determining unit is used to determine the fourth segmentation method as the text segmentation method corresponding to the reference when the text structure indicates that the reference does not have table of contents metadata and there is a target type page in the reference. The fourth segmentation method is used to segment the reference text according to the entry range indicated by the operation object.
[0016] Optionally, the segmentation module further includes: a first segmentation unit, used to segment the references based on the text segmentation method to obtain multiple initial text blocks corresponding to the references; and a second segmentation unit, used to segment each initial text block according to the target text segmentation method to obtain multiple text blocks corresponding to the initial text block.
[0017] Optionally, the second processing module further includes: a third determining submodule, used to determine a target prompt word from multiple prompt words for each text block, wherein each prompt word includes at least one of the following constraints: question generation constraint, domain constraint, question type constraint; and a processing submodule, used to process the target prompt word and text block through a question generation model to obtain the output result corresponding to the text block.
[0018] Optionally, the processing submodule further includes: a first processing unit, used to process the target prompt words and text blocks through a question generation model to obtain the initial output result corresponding to the text block, wherein the initial output result includes an initial sample question and an initial sample answer; a fifth determining unit, used to determine the translation method corresponding to the text format of the initial output result when the target language text exists in the initial output result; and a second processing unit, used to perform text translation processing on the initial output result based on the translation method corresponding to the text format to obtain the output result.
[0019] To achieve the above objectives, according to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored executable program, wherein, when the executable program is running, it controls the device where the computer-readable storage medium is located to execute the above-described method for generating the answer content.
[0020] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, comprising a memory storing an executable program; and a processor for running the program, wherein the program executes the above-described method for generating the answer content during runtime.
[0021] To achieve the above objectives, according to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement the steps of the above-described method for generating answer content.
[0022] In this application, a training sample set is generated based on references using a question generation model. This enables the generation of a training sample set based on relevant knowledge within the domain, thereby improving the knowledge coverage and accuracy of the generated training sample set. This avoids the issue that the quality of the training sample set is easily affected by the professional ability of the writer when relying on manual construction of the training sample set. Therefore, when training the target question answering model using the training sample set in this application, the model training effect can be improved, and the accuracy of the answer can be improved when the target answering model processes the target question.
[0023] Therefore, the method provided in this application achieves the goal of using a question generation model to generate a training sample set based on references, and using the target answer model trained on the training sample set to answer user questions. This achieves the technical effect of improving the accuracy of the answer and solves the technical problem that the question answering model used in related technologies relies on manually constructed training sample sets during training, resulting in poor training effect and low answer accuracy when the question answering model is applied. Attached Figure Description
[0024] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0025] Figure 1 This is a hardware structure block diagram of a computer terminal provided according to an embodiment of this application;
[0026] Figure 2 This is a flowchart of a method for generating answer content according to an embodiment of this application;
[0027] Figure 3This is a schematic diagram of an apparatus for generating answer content according to an embodiment of this application;
[0028] Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant regulations and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding operation entry points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding operation entry points for them to choose to agree to or refuse automated decision results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.
[0032] Example 1
[0033] According to an embodiment of this application, an embodiment of a method for generating answer content is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0034] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal (or mobile device) for implementing a method to generate answer content is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor (MCU) or a field-programmable gate array (FPGA), etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output (I / O) interface, a Universal Serial Bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0035] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0036] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the answer content generation method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the above-mentioned answer content generation method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0037] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0038] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0039] Under the aforementioned operating environment, this application provides the following: Figure 2 The method for generating the answer content is shown. Figure 2 This is a flowchart of the method for generating the answer content according to Embodiment 1 of this application.
[0040] Step S201: Obtain the target problem of the target object.
[0041] Optionally, electronic devices, application systems, servers, and other similar devices can be used as the execution subject of this application. In this embodiment, a target processing system is used as the execution subject to execute the above-described method for generating answer content. Optionally, the target processing system can be an intelligent question-answering system in a specific domain, for example, an intelligent question-answering system in the field of health and fitness.
[0042] In an optional embodiment, the target object can be a user, for example, a user in a health app (application software) terminal. The target question is a real question raised by the user that needs to be answered by the model; for example, the target question could be "My muscles are very sore after running, what measures can I take to solve this?". The target object can input the target question in the health app terminal, and then the target processing system will obtain the target question and determine the answer content for the target question.
[0043] Step S202: The target question is processed by the target question answering model to obtain the answer content for the target question. The target question answering model is trained by the training sample set. The training samples in the training sample set are sample questions, and the real labels are the sample answers corresponding to the sample questions. The training sample set is generated by the question generation model based on references.
[0044] In an optional embodiment, the target question-answering model is a neural network model. For example, the target question-answering model is a large language model, or, for example, a convolutional neural network model. Optionally, the target processing system can input the target question into the target question-answering model, which processes the target question to obtain an answer. After obtaining the answer, the target processing system can feed the answer back to the target object.
[0045] Optionally, the target question-answering model is trained based on a training sample set. The training samples in the training sample set are sample questions, which can be multiple-choice, true / false, case study, etc. The true labels are the sample answers corresponding to the sample questions.
[0046] Optionally, the training sample set is generated by the question generation model based on references. The references are documents within the domain to which the target question answering model is intended to be applied. For example, if the target question answering model is intended to be applied to the health and fitness field, the references could be relevant textbooks in the health and fitness field. The question generation model can be a neural network model; for example, it could be a large language model. The question generation model can analyze the content of the textbooks in the references to generate corresponding sample questions and sample answers.
[0047] In this application, a training sample set is generated based on references using a question generation model. This enables the generation of a training sample set based on relevant knowledge within the domain, thereby improving the knowledge coverage and accuracy of the generated training sample set. This avoids the issue that the quality of the training sample set is easily affected by the professional ability of the writer when relying on manual construction of the training sample set. Therefore, when training the target question answering model using the training sample set in this application, the model training effect can be improved, and the accuracy of the answer can be improved when the target answering model processes the target question.
[0048] Therefore, the method provided in this application achieves the goal of using a question generation model to generate a training sample set based on references, and using the target answer model trained on the training sample set to answer user questions. This achieves the technical effect of improving the accuracy of the answer and solves the technical problem that the question answering model used in related technologies relies on manually constructed training sample sets during training, resulting in poor training effect and low answer accuracy when the question answering model is applied.
[0049] Optionally, in the method for generating answer content provided in the embodiments of this application, the training sample set is obtained in the following way: obtaining at least one reference; segmenting each reference into text to obtain multiple text blocks corresponding to each reference; processing each text block separately through a question generation model to obtain the output result corresponding to each text block, wherein the output result includes sample questions and sample answers; and generating a training sample set based on the output results corresponding to multiple text blocks.
[0050] Optionally, the references can be textbooks in the field where the target question-answering model is expected to be applied. For example, the references could be authoritative textbooks in the field of health and fitness.
[0051] After obtaining the references, for each reference, the text is segmented to obtain multiple text blocks corresponding to that reference. For example, the references can be split into smaller, independently processable fragments (i.e., text blocks) according to their semantics or text structure. These fragments can be a chapter, section, or segment divided by content length from the references.
[0052] In an optional embodiment, after obtaining multiple text blocks corresponding to each reference, each text block is processed separately using a question generation model, and the output of the question generation model is directly used as the output result. For example, each text block is independently fed into the question generation model, and the model generates one or more "question-answer" pairs under the corresponding prompt words. The question in the "question-answer" pair is determined as the sample question, and the answer in the "question-answer" pair is determined as the sample answer.
[0053] In an optional embodiment, after obtaining multiple text blocks corresponding to each reference, each text block is processed separately using a question generation model. The output of the question generation model is used as the initial output, which includes initial sample questions and initial sample answers. For example, the questions in the "question-answer" pairs output by the model are determined as the initial sample questions, and the answers in the "question-answer" pairs are determined as the initial sample answers. Then, the initial output is processed a second time to obtain the final output.
[0054] After obtaining the output results corresponding to multiple text blocks, a training sample set is generated based on the output results corresponding to the multiple text blocks.
[0055] Optionally, the process of generating the training sample set described above is illustrated by example. For instance, if a text block corresponds to a chapter in a reference, the system can create an independent processing context for each chapter, import the chapter into the title generation model, and generate the output result within that independent processing context. Specifically, this process may include the following steps:
[0056] Step 1: Create an independent processing context for each chapter (i.e., text block); for example, create an independent session window in the question generation model for each chapter.
[0057] Step 2: Upload the chapter to the question generation model.
[0058] Step 3: Wait for the model to process the data and obtain the output results.
[0059] Step 4: Save the output results.
[0060] Step 5: After the chapter processing is completed, delete the independent processing context to reduce irrelevant accumulated content.
[0061] In an optional embodiment, the system supports a retry mechanism during the chapter upload process. For example, when an upload fails, a retry is initiated after an increasing waiting time based on the number of attempts, until the maximum number of retries is reached (e.g., 3 times). For multiple chapters in the same reference, the system can also set a fixed waiting interval between chapters to reduce the probability of triggering platform rate limits.
[0062] For example, when processing Chapter 1 of textbook A, the system creates an independent processing context for that chapter and assigns a unique task identifier to each processing step. After processing the chapter, the task identifier and the number of questions generated for that chapter are retained in the corresponding metadata. If processing continues with Chapter 2, the system establishes a new independent processing context instead of reusing the document context from the previous chapter. This "one context per chapter" approach allows for the separate processing of content from different chapters. By using an independent context for each chapter and preventing the sharing of uploaded documents between different chapters, cross-chapter content interference can be reduced, helping to ensure that the model's output is primarily anchored to the content of the current chapter.
[0063] It should be noted that by segmenting the references into multiple text blocks and then generating "question-answer" pairs based on these text blocks, the relevance of the generated "question-answer" pairs to the relevant knowledge points can be improved. By using the question generation model to process each text block separately, crosstalk between text block content and the model can be reduced, improving the consistency between the model's generated results and the text block content, thereby improving the accuracy and quality of the generated training sample set.
[0064] Optionally, in the method for generating answer content provided in the embodiments of this application, each reference is segmented into text to obtain multiple text blocks corresponding to each reference, including: for each reference, determining the text structure of the reference; determining the text segmentation method corresponding to the reference based on the text structure of the reference; and segmenting the reference into text based on the text segmentation method to obtain multiple text blocks corresponding to the reference.
[0065] Optionally, for each reference, the text structure of the reference is determined. Text structure refers to the internal organizational features of the reference; for example, it can indicate whether the reference has table of contents metadata and its hierarchical structure. The text structure of the reference can be provided in advance by staff, or it can be determined by the system after automated analysis of the reference's internal structure.
[0066] After determining the text structure of the references, the corresponding text segmentation method is determined based on the text structure. For example, depending on whether the references have table of contents metadata and the table of contents hierarchy, text segmentation methods such as automatic table of contents mode, table of contents hierarchy mode, manual page number mode, or manual range mode are used to segment the references into text blocks, thereby obtaining multiple text blocks corresponding to the references.
[0067] It should be noted that by determining the corresponding text segmentation method based on the text structure of the references to segment them, adaptive segmentation of the references is achieved, which can improve the reliability of text segmentation and the accuracy of the obtained text blocks.
[0068] Optionally, in the method for generating answer content provided in this application embodiment, determining the text segmentation method corresponding to the reference based on the text structure of the reference includes: when the text structure indicates that the reference has table of contents metadata and the table of contents does not have a multi-level nested structure, determining the first segmentation method as the text segmentation method corresponding to the reference, wherein the first segmentation method is used to segment the reference text according to the chapter range in the table of contents metadata; when the text structure indicates that the reference has table of contents metadata and the table of contents has a multi-level nested structure, determining the second segmentation method as the text segmentation method corresponding to the reference, wherein the second segmentation method is used to segment the reference text according to the target layer in the table of contents metadata. The references are segmented into text based on the scope of entries within each level. If the text structure indicates that the references do not have table of contents metadata and there are no pages of the target type within the references, the third segmentation method is determined as the text segmentation method corresponding to the references. This third segmentation method is used to determine the scope of entries based on the starting page number indicated by the operation object, and then segment the references into text based on that scope. If the text structure indicates that the references do not have table of contents metadata and there are pages of the target type within the references, the fourth segmentation method is determined as the text segmentation method corresponding to the references. This fourth segmentation method is used to segment the references into text based on the scope of entries indicated by the operation object.
[0069] Target metadata refers to the structured navigation information embedded in a file. For example, table of contents metadata includes reference titles, hierarchical relationships (e.g., relationships between chapters, sections, and sub-units), and page numbers of entries at each level, which can be parsed by the program. When the table of contents of a reference only contains a first-level chapter and no nested levels such as sections or sub-units, it is determined that the table of contents of the reference does not have a multi-level nested structure. The aforementioned hierarchical relationships are used to represent the parent-child inheritance structure between entries. For example, a "chapter" entry can be a parent, and it can contain one or more "section" entries as children. An entry refers to an identifiable independent navigation item in the table of contents, corresponding to a logical paragraph unit in the reference, such as a chapter, byte, or sub-unit.
[0070] In an optional embodiment, when the text structure of the references indicates that the references have table of contents metadata and the table of contents does not have a multi-level nested structure, the "automatic table of contents mode" (i.e., the first segmentation method) can be determined as the text segmentation method corresponding to the references. The first segmentation method is used to parse the table of contents metadata to obtain the starting page number of each chapter, and then deduce the ending page number of the previous chapter based on the starting page number of the next chapter, thereby obtaining the chapter range of each chapter. The references are then segmented into text based on the chapter range, so that the segmented chapters are used as text blocks.
[0071] In an optional embodiment, when the text structure of the references indicates that the references have table of contents metadata and the table of contents has a multi-level nested structure, the "table of contents hierarchy mode" (i.e., the second segmentation method) can be determined as the text segmentation method corresponding to the references. The second segmentation method is used to parse the target metadata to obtain a complete table of contents tree. One level in the table of contents tree represents a table of contents level, and one node in the table of contents tree represents an entry under the corresponding level. The system can determine the page number range corresponding to the entry as the entry range, and perform text segmentation of the references according to the entry range in the target level in the table of contents metadata, so as to realize that the segmented entries are used as text blocks. The aforementioned target level can be pre-specified by the operator. When the structure of the references is complex and there are too many table of contents levels, in this case, instead of blindly segmenting all entries, a segmentation granularity is selected for segmentation, which is determined by the target level.
[0072] In an optional embodiment, when the text structure represents a reference without table of contents metadata and no target type page exists in the reference, the "manual page numbering mode" (i.e., the third segmentation method) can be determined as the text segmentation method corresponding to the reference. The target type page can refer to a blank page, a decorative page, or a transition page. The third segmentation method is used to obtain the starting page number of each entry manually entered by the operation object, and then deduce the ending page number of the preceding entry based on the starting page number of the subsequent entry, thereby determining the entry range of each entry. The reference is then segmented according to the entry range of each entry to achieve the goal of using the segmented entries as text blocks. The aforementioned operation object can also be referred to as an operator or administrator, who can operate and manage the target processing system.
[0073] In an optional embodiment, when the text structure indicates that the reference does not have table of contents metadata and the reference contains target type pages, the "manual range mode" (i.e., the fourth segmentation method) can be determined as the text segmentation method corresponding to the reference. The fourth segmentation method is used to obtain the entry range of each item manually entered by the operation object, and then segment the reference text according to the entry range of each item, so as to realize that the segmented items are used as text blocks.
[0074] Optionally, the process of determining the text segmentation method described above is illustrated by example. For instance, the references are textbooks in the field of health and fitness, including but not limited to textbooks on exercise physiology, sports nutrition, strength and fitness, biomechanics, and health assessment. To accommodate different textbook structures, the system supports the following four chapter segmentation modes:
[0075] Mode 1: Automatic Table of Contents Mode. When the textbook has table of contents metadata and does not have a multi-level nested structure, the system scans all table of contents levels, identifies entries with chapter patterns in their titles, automatically excludes non-text entries such as the cover, table of contents, preface, index, glossary, and references, and automatically derives the end page number of the current chapter based on the starting page number of adjacent chapters.
[0076] Mode 2: Directory Hierarchy Mode. When the textbook directory has directory metadata and a multi-level nested structure, the system first outputs the complete directory tree and statistical information of each level's entries. The operator (i.e., the object of operation) selects the target level, then extracts the entries under that level that satisfy the numbering, chapter, section, or unit pattern, and calculates their page number range.
[0077] Mode 3: Manual Page Numbering Mode. When the textbook lacks a usable table of contents, the operator enters the starting page numbers for multiple chapters (or sections, units, etc.), and the system automatically generates the page number range for each chapter (or section, unit, etc.) based on the adjacent starting page numbers.
[0078] Mode 4: Manual Range Mode. When the textbook is a scanned copy or there are blank pages or transition pages between chapters, the operator can directly enter multiple [start page, end page] page number pairs, and the system will accurately divide the chapters (or sections, units, etc.) according to the page number pairs.
[0079] In an optional embodiment, after segmentation, the system saves each segmented chapter (or section, unit, or other text block) as an independent chapter and generates a hierarchical output directory based on the book title, chapter number, and chapter heading. Optionally, the system can also perform a file size check on each chapter. To accommodate the upstream platform's limitations on single file size, the chapter file size threshold is lower than the platform's upper limit, for example, set to 18MB.
[0080] For example, for textbook A, the system uses the automatic table of contents mode to complete the segmentation, resulting in a chapter-level output of 981 pages and 26 chapters; for textbook B, the system uses the table of contents hierarchy mode to segment at the first level, resulting in 120 chapters; for textbook C, since the original textbook lacks directly usable table of contents information, the system uses the manual range mode to segment, resulting in 33 chapters.
[0081] It should be noted that the multi-mode chapter segmentation mechanism can be compatible with references of different structures, thereby improving the reliability of reference segmentation.
[0082] In an optional embodiment, after the text blocks are segmented, the system can establish metadata corresponding to the text blocks. Through metadata management, a stable traceability relationship between the generated results and the source text documents can be achieved. Optionally, taking chapters as an example, the method of constructing metadata is illustrated. For example, chapter-level metadata such as chapter number, chapter title, start and end page numbers, number of pages, source textbook identifier, and processing time are established for each segmented chapter, and a book-level progress file is established to record completed and failed chapters. Optionally, the system can save metadata at both the book and chapter levels. The book-level metadata may include: book title, source file path, segmentation mode used, total number of chapters, total number of pages, and processing timestamp. The chapter-level metadata may include: chapter number, chapter title, start page number, end page number, number of pages, generation task identifier, number of questions, and generation timestamp.
[0083] Optionally, the system can also maintain a progress file to record the list of completed chapters, failed chapters, and the reasons for failure. When the processing flow is re-executed, the system can read the progress file, skip completed chapters, and only re-execute the processing on incomplete or failed chapters, thus forming a chapter-level breakpoint resume mechanism.
[0084] For example, in the actual processing result of textbook A, the book-level metadata records the book title, source file path, automatic directory mode as the splitting mode, total number of chapters 26, total number of pages 981, and processing timestamp; the metadata of Chapter 1 further records the chapter title as "CHAPTER1-AAA", the page range as pages 38 to 64, the number of pages as 27, the number of corresponding questions as 10, and the corresponding generation task identifier. In the corresponding progress file, the list of completed chapters can be recorded as [1], and the set of failed chapters is empty. This example shows that the present invention not only saves the chapter boundaries, but also saves the processing status and generation result statistics.
[0085] It should be noted that by saving the metadata of the reference materials and the metadata of the text blocks, data traceability processing can be facilitated, thereby improving the reliability of text segmentation.
[0086] Optionally, in the method for generating answer content provided in the embodiments of this application, the reference is segmented into multiple text blocks corresponding to the reference based on the text segmentation method, including: segmenting the reference into multiple initial text blocks corresponding to the reference based on the text segmentation method; for each initial text block, the initial text block is segmented into multiple text blocks corresponding to the initial text block according to the target text segmentation method.
[0087] In an optional embodiment, the references are segmented based on a text segmentation method to obtain multiple initial text blocks corresponding to the references. Then, for each initial text block, a finer-grained text segmentation is performed according to a target text segmentation method to obtain multiple text blocks corresponding to that initial text block. The text blocks corresponding to the multiple initial text blocks corresponding to the references are then identified as the text blocks corresponding to the references. For example, the target text segmentation method can further segment the initial text blocks into finer-grained knowledge blocks (i.e., text blocks) based on at least one of the following: table of contents path, text length, or page number range, for subsequent generation of finer-grained assessment projects or teaching aids. The segmentation granularity of the target text segmentation method is smaller than that of the text segmentation method.
[0088] Optionally, the process of segmenting text blocks described above is illustrated with an example. Assuming the initial text block is a chapter, based on chapter-level processing, the system can convert the chapter into a specific format representation and further construct finer-grained knowledge blocks. The aforementioned specific format can be Markdown or other formats. Markdown is a lightweight markup language. After converting the chapter into a specific format representation, it is further segmented into fine-grained knowledge blocks (i.e., text blocks) based on at least one of the following:
[0089] (1) Locate the subsection within a chapter based on the directory tree path;
[0090] (2) Extract subsection content based on directory path;
[0091] (3) Extract local content within a chapter by page number range;
[0092] (4) Divide the text content into blocks based on the text length.
[0093] In an optional embodiment, metadata such as source textbook name, chapter name, page range, block number, and total number of blocks is appended to each fine-grained knowledge block. Text segmentation can use preset block lengths and overlap lengths to transform chapter content into fine-grained knowledge blocks suitable for subsequent processing while maintaining contextual continuity.
[0094] For example, in fine-grained expansion implementations, the system can first convert the chapter content into Markdown text, then locate a specific subsection according to the directory path, or split the Markdown text into multiple consecutive text blocks according to preset text block lengths and overlap lengths. For a specific knowledge block, the system can attach information such as the source textbook name, the chapter it belongs to, the page range, the block number, and the total number of blocks, so that subsequent processing is no longer limited to the entire chapter, but can be extended to local knowledge units within the chapter.
[0095] It should be noted that by using the text content obtained from text segmentation as the initial text block, and then further segmenting the initial text block into finer-grained segments, the flexibility of text segmentation in this application can be effectively improved, and the knowledge in the references can be divided into finer-grained segments, thereby improving the effectiveness of the segmented text blocks and the reliability of the generated questions.
[0096] Optionally, in the method for generating answer content provided in the embodiments of this application, each text block is processed separately by a question generation model to obtain the output result corresponding to each text block, including: for each text block, determining a target prompt word from multiple prompt words, wherein each prompt word includes at least one of the following constraints: question generation constraint, domain constraint, question type constraint; and processing the target prompt word and text block by a question generation model to obtain the output result corresponding to the text block.
[0097] To improve the output quality of the model, in an optional embodiment, the target processing system may pre-set multiple prompt words to constrain the model's generation behavior. Each prompt word includes at least one of the following constraints: question generation constraint, domain constraint, and question type constraint. The question generation constraint controls the form and quality of the generated content, such as prohibiting rote memorization questions and requiring derivations based on textbook texts; the domain constraint limits the professional boundaries of the generated content, such as excluding clinical medicine and focusing on the general fitness population; the question type constraint specifies the output question type, such as requiring the generation of multiple-choice questions or comprehensive questions.
[0098] In some implementations, for each text block, the system can randomly select one prompt word from multiple prompt words as the target prompt word.
[0099] In some implementations, the system may have a pre-defined correspondence between chapters in the references and prompt words. For each text block, the system can use the prompt word corresponding to the chapter to which the text block belongs as the target prompt word for that text block.
[0100] After the target prompt words are determined, the target processing system can input the target prompt words and text blocks into the question generation model, which will then process the target prompt words and text blocks to obtain the output results corresponding to the text blocks.
[0101] In an optional embodiment, after obtaining multiple text blocks corresponding to each reference, each text block is processed separately using a question generation model, and the output of the question generation model is directly used as the output result. For example, each text block is independently fed into the question generation model, and the model generates one or more "question-answer" pairs under the corresponding target prompt words. The question in the "question-answer" pair is determined as the sample question, and the answer in the "question-answer" pair is determined as the sample answer.
[0102] In an optional embodiment, after obtaining multiple text blocks corresponding to each reference, each text block is processed separately using a question generation model. The output of the question generation model is used as the initial output, which includes initial sample questions and initial sample answers. For example, the questions in the "question-answer" pairs output by the model are determined as the initial sample questions, and the answers in the "question-answer" pairs are determined as the initial sample answers. Then, the initial output is processed a second time to obtain the final output.
[0103] Optionally, the process of determining the output result described above can be illustrated. Optionally, during the generation phase, domain-specific prompts can be provided to the model to ensure that the generated result adopts the form of real user scenarios or cases, and to generate at least one of the following: multiple-choice questions, true / false questions, open-ended questions, flashcards, and case analysis questions, while controlling the difficulty, number of questions, and the question format of at least some chapters. When the system calls the model's generation capabilities, it does not directly use general prompts, but can use constraint prompts specific to the health and fitness domain. The question generation constraints in the prompts may include at least one of the following:
[0104] (1) Avoid generating rote memorization-based definition questions;
[0105] (2) Organize the questions into real customer scenarios or case problems;
[0106] (3) Describe the client's symptoms, exercise performance indicators, training status, dietary habits, movement patterns or recovery status;
[0107] (4) Require the identification of underlying physiological concepts based on source materials or provide corresponding suggestions;
[0108] (5) Adopting a higher level of difficulty;
[0109] (6) A large number of questions are used;
[0110] (7) Switch some chapters to true / false question format.
[0111] Domain constraints in prompt words may include at least one of the following:
[0112] (1) The scenario is limited to ordinary people in daily fitness environments;
[0113] (2) Exclude scenarios involving competitive sports, competitions, or professional athletes;
[0114] (3) Focus on sports science and normal physiology;
[0115] (4) Exclude scenarios related to clinical medicine, injury diagnosis, and disease management.
[0116] The question type constraints in the prompt words may include at least one of the following:
[0117] (1) Multiple choice questions, used to test knowledge identification and condition judgment abilities;
[0118] (2) True or False questions, used to test the ability to quickly judge the truth or falsehood of complex statements;
[0119] (3) Flashcards correspond to open-ended knowledge extraction content, with the front side containing concepts, terms or questions, and the back side containing a more complete discussion around the concept;
[0120] (4) Case analysis questions are used to construct real case analysis questions, requiring a comprehensive judgment on training status, physiological mechanisms or intervention strategies.
[0121] In an optional embodiment, the system generates questions using a hard difficulty mode and employs the standard question volume level supported by the model as the larger question volume mode. For some chapters, the system can add extended prompts for true / false questions with a preset probability, making all questions in that chapter adopt a true / false question format with explanations; for other chapters, the system generates flashcards or case analysis questions based on the prompts. Thus, the question generation corresponding to the text block is no longer limited to simple definition questions, but can form a multi-type assessment item set covering multiple choice, true / false, open-ended, and case analysis questions.
[0122] For example, in the generated output, one multiple-choice question uses the scenario of "the explosive release phase of a college discus thrower" as a context, requiring the identification of the primary limiting energy supply system; another question uses the scenario of "a 45-year-old client experiencing extreme fatigue, persistent soreness, and a minor stress fracture after exercise" as a context, requiring the identification of which stage of General Adaptation Syndrome (GAS) the client is in. These questions are not isolated terminology memorization questions, but rather transform physiological principles from textbooks into case-based multiple-choice questions. For another example, in the Chinese output of a textbook, questions could be constructed around "what logical steps should be taken after a static posture assessment of a client with chronic shoulder discomfort," reflecting a motion analysis and corrective training scenario. For open-ended argumentative content, the flashcards sample could use "General Adaptation Syndrome (GAS)" as the concept on the front of the card, and expand on its three stages, corresponding physiological manifestations, and application constraints in training on the back, forming an argumentative knowledge extraction result. For case analysis questions, longer analytical questions can be constructed around specific training states, physiological mechanisms, or intervention strategies.
[0123] In an optional embodiment, assuming the text block is a chapter, in addition to chapter-level question generation, the system can also invoke the model's extended content generation capabilities within the independent processing context of the imported chapters to construct flashcards, open-ended argumentative content, case study questions, or other teaching aids. For example, custom report generation prompts include one or more of the following constraints:
[0124] (1) Fixed number of cards generated;
[0125] (2) The front of the card contains complex concepts, questions, or terms;
[0126] (3) The back of the card should summarize as comprehensively as possible the explanations, rules, examples and details related to the concept in the source text;
[0127] (4) Use a clear output structure;
[0128] (5) Save the results as a Markdown file.
[0129] The extended content generation capability can supplement the reverse generation chain of knowledge units, outputting analytical, argumentative, and instructional structured content in addition to standard questions. For example, in the flashcards sample, the system uses "Universal Adaptation Syndrome" as the question on the front of the card, and outputs its origin, three stages, physiological manifestations at each stage, adaptation threshold, and application logic in periodic training on the back of the card. A similar approach can be extended to case study questions, such as those focusing on a client's training stagnation, environmental changes, or insufficient recovery, requiring the model to provide a comprehensive analysis. In other words, the same knowledge unit can generate not only standard questions but also argumentative and analytical content.
[0130] It should be noted that by combining target prompts containing constraints to guide the model processing and obtain the output results, the accuracy of the obtained output results can be improved, thereby improving the training effect of the target question answering model.
[0131] Optionally, in the method for generating answer content provided in this application embodiment, the target prompt word and text block are processed by a question generation model to obtain the output result corresponding to the text block, including: processing the target prompt word and text block by a question generation model to obtain the initial output result corresponding to the text block, wherein the initial output result includes an initial sample question and an initial sample answer; if the initial output result contains target language text, determining the translation method corresponding to the text format of the initial output result; and performing text translation processing on the initial output result based on the translation method corresponding to the text format to obtain the output result.
[0132] In an optional embodiment, after obtaining multiple text blocks corresponding to each reference, each text block is processed separately using a title generation model, and the content output by the title generation model is used as the initial output result.
[0133] If the initial output contains target language text, determine the translation method corresponding to the text format of the initial output. Optionally, the target language text can be English. The text format of the initial output can be JSON (JavaScript Object Notation), Markdown, or other formats.
[0134] The target processing system can pre-define the relationships between different text formats and translation methods, thereby determining the corresponding translation method for the initial output text format based on these relationships. For example, for JSON format, the corresponding translation method preserves the keys, boolean values, numbers, and mathematical expressions in the JSON during translation. For Markdown format, the corresponding translation method preserves the formatting tags, headings, and mathematical expressions in the Markdown during translation. The translation method is used to translate the target language text in the initial output, for example, translating it into Chinese.
[0135] After determining the translation method corresponding to the text format, the initial output result is translated based on the translation method corresponding to the text format to obtain the output result.
[0136] Optionally, the process of determining the output result described above is illustrated by example. Assuming the text block represents a chapter, after the chapter-level result (i.e., the initial output result) is generated, the system performs multilingual post-processing on the result, for example, translating from English to Simplified Chinese. Specifically, for results in JSON format, at least one of the following constraints must be satisfied during translation:
[0137] (1) Translate only string values;
[0138] (2) Do not translate JSON key names;
[0139] (3) Retain Boolean values;
[0140] (4) Retain digits;
[0141] (5) Retain mathematical expressions;
[0142] (6) Retain the original JSON hierarchical structure.
[0143] For example, translating JSON-formatted results preserves the key names, boolean values, numbers, and mathematical expressions, and only translates the string values to obtain the final output.
[0144] For Markdown formatted results, at least one of the following constraints must be satisfied during translation:
[0145] (1) Retain Markdown formatting for headings, bold text, lists, tables, etc.;
[0146] (2) Retain the question number and option labels;
[0147] (3) Retain mathematical expressions;
[0148] (4) Only translate the main text.
[0149] For example, when translating the Markdown format results, keep the titles, lists, tables, question number tags, and mathematical expressions unchanged, and only translate the body content to obtain the final output result.
[0150] When the translation fails, the system can fallback to the original content to avoid interruption of the overall process. Through structure-preserving translation, the system can directly obtain reusable Chinese results without manual format repair again. For example, in the actual translation result, the mathematical expression "$\\dot{V}_{O_2\\text{max}}$" in the English title remains unchanged in the Chinese JSON output, while the question stem and analysis are translated into Chinese; the title of the question "Fitness Quiz" is translated into "Fitness Quiz", but the JSON key name structures such as questions, answerOptions, and isCorrect are not damaged. Thus, through the structure-preserving translation mechanism, the translation result can be directly reused without damaging the structure, so that both the structure stability and content readability can be maintained during the translation process.
[0151] It should be noted that by translating the content generated by the question generation model, the language adopted by the finally determined output result can more effectively adapt to the training requirements and application requirements of the target Q&A model, thereby improving the model training effect and further improving the accuracy of the generated answer content.
[0152] In an optional embodiment, assuming that the text block is a chapter, the system can perform chapter-level and book-level structured output. Save the chapter-level results (i.e., the initial output results) in at least two output formats, and further merge the outputs of multiple chapters into a book-level total file, while outputting the total number of chapters and the total number of questions. For example, the system saves at least two types of output files for each chapter: (1) machine-readable files; (2) human-readable files.
[0153] Optionally, the machine-readable file is quiz.json, and the human-readable file is quiz.md. After the translation is completed, the system further generates quiz_zh.json and quiz_zh.md. In the book-level summary stage, the system scans all chapter subdirectories under the book directory, and splices the Markdown results of each chapter in the chapter order into the total Markdown file of the whole textbook; at the same time, it merges the JSON results of each chapter into the total JSON file of the whole textbook. The book-level JSON summary structure can include: the total number of chapters, the total number of questions, and the question list of each chapter. When the translation result exists, the system also generates the corresponding Chinese total Markdown file and Chinese total JSON file respectively. This application enables the coexistence of chapter-level output and book-level output, thus supporting both single-chapter review and direct use of the whole textbook as a unit.
[0154] For example, in the Chinese summary output of a certain textbook, the book-level master JSON file records a total of 14 chapters and 146 questions, with the questions for each chapter organized in chapter order under the chapter field. Similarly, the system can also generate corresponding files in other textbook directories.
[0155] It should be noted that by simultaneously outputting machine-readable and human-readable formats, both the needs of subsequent automated processing and manual review can be met. Automatic book-level aggregation reduces manual integration costs.
[0156] In an optional embodiment, the model structure of the large language model involved in this embodiment is illustrated by way of example. The large language model involved in this embodiment includes, but is not limited to, the target question answering model and the question generation model described above. For example, the large language model may include an input embedding layer, a multi-layer decoder, and an output layer. The input embedding layer is used to perform word embedding processing on the input lexical units (e.g., target question, text block), and the input embedding layer outputs vectors to the multi-layer decoder.
[0157] The decoder in a multi-layer decoder may include a self-attention mechanism module, a layer normalization module, and a feedforward neural network. The decoder layer receives the output of the input embedding layer or the output of the previous decoder layer as input, and then the self-attention mechanism processes the input to capture long-distance dependencies between words. Subsequently, the output of the self-attention mechanism is processed through residual connections and layer normalization, and the output of the layer normalization is passed to the feedforward neural network, which may include a fully connected network. Then, the output obtained from the feedforward neural network is processed through residual connections and layer normalization to obtain the output of the decoder layer. Optionally, the output of the multi-layer decoder is processed through an output layer to obtain the output of the large language model; the output layer may include a linear projection layer.
[0158] It should be noted that the model structure of the large language model involved in this embodiment may not be exactly the same, and can be implemented with reference to the model structure in related technologies.
[0159] Therefore, the method provided in this application achieves the goal of using a question generation model to generate a training sample set based on references, and using the target answer model trained on the training sample set to answer user questions. This achieves the technical effect of improving the accuracy of the answer and solves the technical problem that the question answering model used in related technologies relies on manually constructed training sample sets during training, resulting in poor training effect and low answer accuracy when the question answering model is applied.
[0160] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0161] Example 2
[0162] This application also provides an apparatus for generating answer content. It should be noted that the apparatus for generating answer content in this application can be used to execute the method for generating answer content provided in this application. The apparatus for generating answer content provided in this application will be described below.
[0163] According to embodiments of this application, an apparatus for implementing the above-described method for generating answer content is also provided, such as... Figure 3 As shown, the device includes:
[0164] The first acquisition module 301 is used to acquire the target problem of the target object;
[0165] The first processing module 302 is used to process the target question through the target question answering model to obtain the answer content for the target question. The target question answering model is trained through a training sample set, where the training samples in the training sample set are sample questions and the real labels are the sample answers corresponding to the sample questions. The training sample set is generated by the question generation model based on references.
[0166] In this application, a training sample set is generated based on references using a question generation model. This enables the generation of a training sample set based on relevant knowledge within the domain, thereby improving the knowledge coverage and accuracy of the generated training sample set. This avoids the issue that the quality of the training sample set is easily affected by the professional ability of the writer when relying on manual construction of the training sample set. Therefore, when training the target question answering model using the training sample set in this application, the model training effect can be improved, and the accuracy of the answer can be improved when the target answering model processes the target question.
[0167] Therefore, the method provided in this application achieves the goal of using a question generation model to generate a training sample set based on references, and using the target answer model trained on the training sample set to answer user questions. This achieves the technical effect of improving the accuracy of the answer and solves the technical problem that the question answering model used in related technologies relies on manually constructed training sample sets during training, resulting in poor training effect and low answer accuracy when the question answering model is applied.
[0168] Optionally, in the answer content generation apparatus provided in the embodiments of this application, the answer content generation apparatus further includes: a second acquisition module, used to acquire at least one reference; a segmentation module, used to segment each reference into text to obtain multiple text blocks corresponding to each reference; a second processing module, used to process each text block separately through a question generation model to obtain an output result corresponding to each text block, wherein the output result includes sample questions and sample answers; and a generation module, used to generate a training sample set based on the output results corresponding to the multiple text blocks.
[0169] Optionally, in the answer content generation device provided in the embodiments of this application, the segmentation module further includes: a first determining submodule, used to determine the text structure of each reference; a second determining submodule, used to determine the text segmentation method corresponding to the reference based on the text structure of the reference; and a segmentation submodule, used to segment the reference based on the text segmentation method to obtain multiple text blocks corresponding to the reference.
[0170] Optionally, in the answer content generation apparatus provided in this application embodiment, the second determining submodule further includes: a first determining unit, configured to determine the first segmentation method as the text segmentation method corresponding to the reference when the text structure represents that the reference has table of contents metadata and the table of contents does not have a multi-level nested structure, wherein the first segmentation method is used to segment the reference text according to the chapter range in the table of contents metadata; and a second determining unit, configured to determine the second segmentation method as the text segmentation method corresponding to the reference when the text structure represents that the reference has table of contents metadata and the table of contents has a multi-level nested structure, wherein the second segmentation method is used to segment the reference text according to the entry range in the target level in the table of contents metadata. The document undergoes text segmentation; a third determining unit is used to determine the third segmentation method as the text segmentation method corresponding to the reference when the text structure indicates that the reference does not have table of contents metadata and there is no target type page in the reference. The third segmentation method is used to determine the entry range based on the entry starting page number indicated by the operation object, and to segment the reference text based on the entry range; a fourth determining unit is used to determine the fourth segmentation method as the text segmentation method corresponding to the reference when the text structure indicates that the reference does not have table of contents metadata and there is a target type page in the reference. The fourth segmentation method is used to segment the reference text based on the entry range indicated by the operation object.
[0171] Optionally, in the answer content generation device provided in the embodiments of this application, the segmentation module further includes: a first segmentation unit, used to segment the reference text based on the text segmentation method to obtain multiple initial text blocks corresponding to the reference; and a second segmentation unit, used to segment each initial text block according to the target text segmentation method to obtain multiple text blocks corresponding to the initial text block.
[0172] Optionally, in the answer content generation device provided in the embodiments of this application, the second processing module further includes: a third determining submodule, used to determine a target prompt word from multiple prompt words for each text block, wherein each prompt word includes at least one of the following constraints: question generation constraint, domain constraint, question type constraint; and a processing submodule, used to process the target prompt word and text block through a question generation model to obtain the output result corresponding to the text block.
[0173] Optionally, in the answer content generation apparatus provided in this application embodiment, the processing submodule further includes: a first processing unit, used to process the target prompt word and text block through a question generation model to obtain an initial output result corresponding to the text block, wherein the initial output result includes an initial sample question and an initial sample answer; a fifth determining unit, used to determine the translation method corresponding to the text format of the initial output result when the target language text exists in the initial output result; and a second processing unit, used to perform text translation processing on the initial output result based on the translation method corresponding to the text format to obtain an output result.
[0174] It should be noted that the first acquisition module 301 and the first processing module 302 mentioned above correspond to steps S201 to S202 in Embodiment 1. The two modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware components or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also be part of the device and run in the computer terminal 10 provided in Embodiment 1.
[0175] Example 3
[0176] Embodiments of this application may provide an electronic device. Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 4 As shown, the electronic device may include: one or more ( Figure 4(Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0177] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0178] The processor can access information and applications stored in the memory via a transmission device to perform the following steps: obtaining the target question of the target object; processing the target question through a target question-answering model to obtain the answer content for the target question, wherein the target question-answering model is trained through a training sample set, the training samples in the training sample set are sample questions, and the real labels are the sample answers corresponding to the sample questions, and the training sample set is generated by the question generation model based on references.
[0179] The processor can also access information and applications stored in the memory via a transmission device to perform the following steps: acquiring at least one reference; segmenting each reference into multiple text blocks corresponding to each reference; processing each text block separately using a question generation model to obtain the output result corresponding to each text block, wherein the output result includes sample questions and sample answers; and generating a training sample set based on the output results corresponding to multiple text blocks.
[0180] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: for each reference, determine the text structure of the reference; determine the text segmentation method corresponding to the reference based on the text structure of the reference; and segment the reference into multiple text blocks based on the text segmentation method to obtain multiple text blocks corresponding to the reference.
[0181] The processor can also invoke information and applications stored in memory via a transmission device to perform the following steps: When the text structure represents a reference with table of contents metadata and the table of contents does not have a multi-level nested structure, a first segmentation method is determined as the text segmentation method corresponding to the reference, wherein the first segmentation method is used to segment the reference text according to the chapter scope in the table of contents metadata; when the text structure represents a reference with table of contents metadata and the table of contents has a multi-level nested structure, a second segmentation method is determined as the text segmentation method corresponding to the reference, wherein the second segmentation method is used to segment the reference text according to the entry scope in the target level of the table of contents metadata. The document is segmented into text. If the text structure indicates that the reference does not have table of contents metadata and there are no pages of the target type in the reference, the third segmentation method is determined as the text segmentation method corresponding to the reference. This third segmentation method is used to determine the scope of the entry based on the starting page number indicated by the operation object, and then segment the reference into text based on the scope of the entry. If the text structure indicates that the reference does not have table of contents metadata and there are pages of the target type in the reference, the fourth segmentation method is determined as the text segmentation method corresponding to the reference. This fourth segmentation method is used to segment the reference into text based on the scope of the entry indicated by the operation object.
[0182] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: segment the references based on the text segmentation method to obtain multiple initial text blocks corresponding to the references; for each initial text block, segment the initial text block according to the target text segmentation method to obtain multiple text blocks corresponding to the initial text block.
[0183] The processor can also invoke information and applications stored in the memory via the transmission device to perform the following steps: for each text block, determine the target prompt word from multiple prompt words, wherein each prompt word includes at least one of the following constraints: question generation constraint, domain constraint, question type constraint; process the target prompt word and text block through the question generation model to obtain the output result corresponding to the text block.
[0184] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: process the target prompt words and text blocks through the question generation model to obtain the initial output result corresponding to the text block, wherein the initial output result includes the initial sample question and the initial sample answer; if the target language text exists in the initial output result, determine the translation method corresponding to the text format of the initial output result; perform text translation processing on the initial output result based on the translation method corresponding to the text format to obtain the output result.
[0185] Those skilled in the art will understand that Figure 4 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 4 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 4 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 4 The different configurations shown.
[0186] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0187] Example 4
[0188] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the method for generating the answer content provided in Embodiment 1.
[0189] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0190] This application also provides a computer program product, which, when executed on a data processing device, is adapted to perform the steps of a method for generating response content.
[0191] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0192] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0193] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0194] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0195] Furthermore, the functional units in the various embodiments of this application can be integrated into one 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 hardware or as a software functional unit.
[0196] If the integrated unit is implemented as 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 technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0197] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for generating answer content, characterized in that, include: The target problem is to obtain the target object; The target question is processed by a target question answering model to obtain the answer content for the target question. The target question answering model is trained on a training sample set, where the training samples are sample questions and the real labels are the sample answers corresponding to the sample questions. The training sample set is generated by a question generation model based on references.
2. The method according to claim 1, characterized in that, The training sample set was obtained in the following way: Obtain at least one reference; Each reference is segmented into multiple text blocks corresponding to each reference. The question generation model processes each text block separately to obtain the output result corresponding to each text block, wherein the output result includes sample questions and sample answers; The training sample set is generated based on the output results corresponding to the multiple text blocks.
3. The method according to claim 2, characterized in that, Each reference is segmented into multiple text blocks, including: For each reference, determine the text structure of that reference; The text segmentation method corresponding to the reference is determined based on the text structure of the reference; The references are segmented using the aforementioned text segmentation method to obtain multiple text blocks corresponding to the references.
4. The method according to claim 3, characterized in that, Determining the text segmentation method corresponding to the reference based on its text structure includes: When the text structure indicates that the reference has table of contents metadata and the table of contents does not have a multi-level nested structure, the first segmentation method is determined as the text segmentation method corresponding to the reference, wherein the first segmentation method is used to segment the reference text according to the chapter range in the table of contents metadata; When the text structure indicates that the reference has catalog metadata and the catalog has a multi-level nested structure, the second segmentation method is determined as the text segmentation method corresponding to the reference. The second segmentation method is used to segment the reference text according to the scope of entries in the target level in the catalog metadata. When the text structure indicates that the reference does not have directory metadata and there is no target type page in the reference, the third segmentation method is determined as the text segmentation method corresponding to the reference. The third segmentation method is used to determine the entry range according to the entry start page number indicated by the operation object, and to perform text segmentation on the reference according to the entry range. When the text structure indicates that the reference does not have directory metadata and the reference contains a target type page, the fourth segmentation method is determined as the text segmentation method corresponding to the reference. The fourth segmentation method is used to segment the reference according to the entry range indicated by the operation object.
5. The method according to claim 3, characterized in that, The references are segmented using the aforementioned text segmentation method to obtain multiple text blocks corresponding to the references, including: Based on the text segmentation method, the reference is segmented into multiple initial text blocks corresponding to the reference. For each initial text block, the initial text block is segmented according to the target text segmentation method to obtain multiple text blocks corresponding to the initial text block.
6. The method according to claim 2, characterized in that, The question generation model processes each text block separately to obtain the output results corresponding to each text block, including: For each text block, a target prompt word is determined from multiple prompt words, wherein each prompt word includes at least one of the following constraints: question generation constraint, domain constraint, and question type constraint; The target prompt and the text block are processed by the question generation model to obtain the output result corresponding to the text block.
7. The method according to claim 6, characterized in that, The target prompt and the text block are processed by a question generation model to obtain the output result corresponding to the text block, including: The target prompt and the text block are processed by a question generation model to obtain the initial output result corresponding to the text block, wherein the initial output result includes an initial sample question and an initial sample answer; If the target language text is present in the initial output, determine the translation method corresponding to the text format of the initial output; The initial output result is translated based on the translation method corresponding to the text format to obtain the output result.
8. An apparatus for generating answer content, characterized in that, include: The first acquisition module is used to acquire the target problem of the target object; The first processing module is used to process the target question through a target question-answering model to obtain the answer content for the target question. The target question-answering model is trained through a training sample set, where the training samples in the training sample set are sample questions and the real labels are the sample answers corresponding to the sample questions. The training sample set is generated by a question generation model based on references.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the computer-readable storage medium is located to perform the method for generating the answer content as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, performs the method for generating the answer content as described in any one of claims 1 to 7.