Question and answer generation method, electronic equipment and storage medium
By sorting and retrieving in the document and Q&A group summary vector library of the Q&A system, combining paragraphs and Q&A vector library, the accuracy problem when asking questions from multiple documents is solved, the priority strategy of Q&A pair is realized, and the user is improved Experience.
Patent Information
- Application Number
- CN202411110003.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-26
AI Technical Summary
When existing Q&A technology uploads multiple documents, the accuracy of paragraph search ranking is reduced, and it cannot effectively provide background knowledge, affects the user experience, and cannot implement the answer strategy of the question-answer priority of the Q&A code is higher than the knowledge document.
By searching and sorting questions in the preset document summary vector library and question-answer group summary vector library, obtaining the sorted document summary and question-answer group summary, and searching and sorting the vector library in the paragraph vector library and question-answer group summary vector library. Extract relevant paragraphs and question-and-answer pairs, splice them to form replies, and ensure that the big model can effectively answer questions.
When users upload multiple documents, the accuracy and response speed of the Q&A system are improved, and the answer strategy of the priority of the Q&A pair is higher than that of the knowledge document, ensuring that users receive high-quality replies.
Smart Images

Figure CN119025648A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of question and answer, and in particular relates to a question and answer generating method, an electronic device and a storage medium. Background Art
[0002] Existing similar technologies mainly include document question-answering technology based on the reading comprehension ability of large models, and customized task-based dialogue solutions based on vector retrieval and large models. These existing technical methods are to parse the single or multiple documents uploaded by users into texts, and split the parsed texts into multiple small paragraphs according to a certain strategy; vectorize the split paragraphs for feature identification (or other methods for feature identification) for later use; search the user's current question in all the feature-identified paragraphs and rank the retrieved paragraphs according to the scores; within the limit of the number of context tokens in the large model, select the top-ranked paragraphs and merge them as background knowledge for the large model to read and understand and answer the user's questions.
[0003] In the prior art, when users upload a large number of documents to ask questions, the number of documents and paragraphs after splitting is too large, which will greatly reduce the accuracy of paragraph retrieval ranking. According to the existing method of selecting the top-ranked paragraphs, the large model will not be able to obtain relatively effective background knowledge for reading comprehension, and thus will not be able to accurately answer user questions, affecting the user experience. In actual scenarios, users will also have some pre-prepared question-and-answer pairs that need to be combined with knowledge documents to ask questions. Generally, the priority of question-and-answer pairs will be higher than that of knowledge documents. In the above method, the question-and-answer pairs can only be placed in the document as knowledge points and processed together with other knowledge documents, and it is impossible to implement an answer strategy in which the priority of question-and-answer pairs is higher than that of knowledge documents.
[0004] The inventors found that in the prior art, when users upload a large number of documents to ask questions, the accuracy of the model answering user questions is greatly reduced. When users upload a large number of question-answer pair merged documents to ask questions, it is impossible to implement the answer strategy that the question-answer pair has a higher priority than the knowledge document. Summary of the invention
[0005] The embodiments of the present invention aim to solve at least one of the above technical problems.
[0006] In a first aspect, an embodiment of the present invention provides a question and answer generation method, comprising: obtaining a question raised by a user, searching for the question in a preset document summary vector library and a preset question and answer group summary vector library respectively, and sorting the retrieved document summaries and question and answer group summaries respectively, wherein the document summary vector library includes summaries of multiple documents, each document has multiple paragraphs, and the question and answer group summary vector library includes summaries of multiple question and answer groups, each question and answer group has multiple question and answer pairs; obtaining at least one sorted document summary and at least one question and answer group summary, and searching for the at least one document summary and the at least one question and answer group summary in a preset paragraph vector library and a question and answer pair vector library respectively, wherein the paragraph vector library includes multiple paragraphs of multiple documents, and the question and answer pair vector library includes multiple question and answer pairs of multiple question and answer groups; sorting the retrieved paragraphs and question and answer pairs respectively, extracting at least one sorted paragraph and at least one question and answer pair; splicing the at least one paragraph and the at least one question and answer pair with the question to obtain a reply corresponding to the question.
[0007] In a second aspect, an embodiment of the present invention provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the above-mentioned question and answer generation methods of the present invention.
[0008] In a third aspect, an embodiment of the present invention provides a storage medium, in which one or more programs including execution instructions are stored. The execution instructions can be read and executed by an electronic device (including but not limited to a computer, a server, or a network device, etc.) to execute any of the above-mentioned question and answer generation methods of the present invention.
[0009] In a fourth aspect, an embodiment of the present invention further provides a computer program product, wherein the computer program product comprises a computer program stored on a storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer executes any one of the above-mentioned question and answer generation methods.
[0010] The embodiment of the present invention ranks document summaries, and ranks and selects document paragraphs and question-answer pairs separately, so that when users upload all documents and ask questions, the large model can effectively answer them. This application asks questions about multiple documents at the same time, and can effectively and accurately answer users' questions. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0012] Figure 1 A flowchart of an embodiment of the question and answer generating method of the present invention;
[0013] Figure 2 A flowchart of another embodiment of the question and answer generating method of the present invention;
[0014] Figure 3 A flowchart of another embodiment of the question and answer generating method of the present invention;
[0015] Figure 4 is an example flow chart of the question and answer generating method of the present invention;
[0016] Figure 5 A flow chart of a question and answer generation process provided by an embodiment of the present invention;
[0017] Figure 6 It is a schematic structural diagram of an embodiment of an electronic device of the present invention. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.
[0020] The present invention may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0021] In the present invention, "module", "device", "system" and the like refer to related entities applied to computers, such as hardware, a combination of hardware and software, software or software in execution, etc. In detail, for example, an element can be, but is not limited to, a process, a processor, an object, an executable element, an execution thread, a program and / or a computer running on a processor. In addition, an application or script program running on a server, a server can all be an element. One or more elements can be in an execution process and / or thread, and an element can be localized on a computer and / or distributed between two or more computers, and can be operated by various computer-readable media. An element can also communicate through local and / or remote processes according to a signal with one or more data packets, for example, a signal from a data that interacts with another element in a local system, a distributed system, and / or a network on the Internet through a signal to interact with other systems.
[0022] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include" and "comprise" include not only those elements, but also other elements that are not explicitly listed, or also include elements inherent to such processes, methods, articles or equipment. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or equipment that includes the elements.
[0023] The embodiment of the present invention provides a question-answer generation method, which can be applied to an electronic device. The electronic device can be a computer, a server, or other electronic products, etc., which is not limited in the present invention.
[0024] Please refer to Figure 1 , which shows a question and answer generation method provided by an embodiment of the present invention.
[0025] like Figure 1 As shown, in step 101, a question raised by a user is obtained, the question is retrieved in a preset document summary vector library and a preset question-answer group summary vector library respectively, and the retrieved document summaries and question-answer group summaries are sorted respectively, wherein the document summary vector library includes summaries of multiple documents, each document has multiple paragraphs, and the question-answer group summary vector library includes summaries of multiple question-answer groups, each question-answer group has multiple question-answer pairs;
[0026] In step 102, at least one sorted document summary and at least one question-answer group summary are obtained, and the at least one document summary and the at least one question-answer group summary are respectively searched in a preset paragraph vector library and a question-answer pair vector library, wherein the paragraph vector library includes multiple paragraphs of multiple documents, and the question-answer pair vector library includes multiple question-answer pairs of multiple question-answer groups;
[0027] In step 103, the retrieved paragraphs and question-answer pairs are sorted respectively, and at least one sorted paragraph and at least one question-answer pair are extracted;
[0028] In step 104, the at least one paragraph and the at least one question-answer pair are concatenated with the question to obtain a reply corresponding to the question.
[0029] In this embodiment, for step 101, the question raised by the user is obtained, and the way of asking questions includes that the user uploads one or more documents corresponding to the question. After obtaining one or more documents corresponding to the user's question, the documents corresponding to the question are retrieved in the preset document summary vector library and the preset question and answer group summary vector library respectively. After the retrieval is completed, the retrieved document summary and question and answer group summary are sorted respectively. The document summary vector library includes summaries of multiple documents, each document has multiple paragraphs, and the question and answer group summary vector library includes summaries of multiple question and answer groups, each question and answer group has multiple question and answer pairs. According to the user's question, the summary of the document and the question and answer group are retrieved and ranked respectively. This step is mainly sorted according to the vector algorithm. The summary represents the core meaning of the document to a certain extent. According to the summary ranking, it can be regarded as the relevance ranking of these documents or question and answer groups with the user's question. The retrieval in the document and the question and answer group is performed synchronously, so a part of the retrieval time can be saved, and the response speed is almost unaffected.
[0030] Afterwards, for step 102, after sorting the retrieved document summaries and question-answer group summaries respectively, obtain at least one sorted document summary and at least one question-answer group summary. Among them, the number of sorted document summaries and the number of question-answer group summaries are obtained according to actual use requirements. For example, the top n documents and top n question-answer groups are selected as the background knowledge sources after narrowing the scope according to the summary ranking. Among them, n can be set according to actual conditions. The smaller n represents the smaller the scope, which may result in the loss of key documents. The larger n represents the larger the scope, which may result in too much interference information. After obtaining at least one sorted document summary and at least one question-answer group summary, retrieve at least one document summary and at least one question-answer group summary in the preset paragraph vector library and question-answer pair vector library, respectively, wherein the paragraph vector library includes multiple paragraphs of multiple documents, and the question-answer pair vector library includes multiple question-answer pairs of multiple question-answer groups. According to the user's questions, the paragraphs and question-answer pairs are retrieved and ranked in the selected documents and question-answer groups respectively. This step is mainly sorted according to the vector algorithm, which can be regarded as the relevance ranking of these paragraphs or question-answer pairs with the user's questions. Retrieval in paragraphs and question-answer pairs is also performed synchronously, and the response speed is almost unaffected.
[0031] Then, for step 103, after searching the document summary and the question-answer group summary in the paragraph vector library and the question-answer pair vector library respectively, the paragraphs and question-answer pairs obtained after the retrieval are sorted respectively, and at least one paragraph and at least one question-answer pair after sorting are extracted. For example, the top n question-answer pairs and the top n paragraphs are selected and merged as the final background knowledge fragments according to the ranking. This operation is to finally select the question-answer pairs and paragraphs with the highest relevance to the question. Among them, n can be set according to the actual situation, which to a certain extent represents the tolerance for interference information. The larger n is, the more interference information may be brought, and the smaller n is, some useful information may be missed.
[0032] Finally, for step 104, the paragraphs and question-answer pairs extracted after sorting and the questions raised by the user are concatenated, and finally the final question answer is obtained through reading comprehension through the large model.
[0033] The method of the embodiment of the present application ranks document summaries, and ranks and selects document paragraphs and question-answer pairs separately, so that when users upload all documents and ask questions, the large model can effectively answer them. The present application asks questions about multiple documents at the same time, and can effectively and accurately answer users' questions.
[0034] Please refer to Figure 2 , which shows another question-answer generation method provided by an embodiment of the present invention. Figure 1A flowchart of the steps further limited by "retrieving the question in a preset document summary vector library and a preset question-and-answer group summary vector library respectively" in step 101.
[0035] like Figure 2 As shown, in step 201, it is confirmed whether the document summary corresponding to the document exists in the document summary vector library;
[0036] In step 202, if the document summary does not exist in the document summary vector library, a document summary corresponding to the document is generated and stored in the document summary vector library.
[0037] In this embodiment, for step 201, it is first necessary to search for document summaries corresponding to the document in the document summary vector library. If some document summaries corresponding to the document are found, the document summaries are directly sorted. Then, for step 202, if the document summary corresponding to the document is not found in the document summary vector library, a document summary corresponding to the document is generated by the large model, and the document summary generated by the large model is stored in the document summary vector library.
[0038] The method of the embodiment of the present application determines whether there is an abstract and supports the generation of an abstract, and uses the ability of a large model to generate abstracts to extract abstracts from documents, thereby saving manual time in reading and summarizing the abstracts.
[0039] Please refer to Figure 3 , which shows another question-answer generation method provided by an embodiment of the present invention. Figure 2 A flow chart of further defined steps.
[0040] like Figure 3 As shown, in step 301, it is confirmed whether the question and answer group summary corresponding to the question and answer group exists in the question and answer group summary vector library;
[0041] In step 302, if the question and answer group summary does not exist in the question and answer group summary vector library, a question and answer group summary corresponding to the question and answer group is added by a manager, and the question and answer group summary is stored in the question and answer group summary vector library.
[0042] In this embodiment, for step 301, it is first necessary to search for the question and answer group summary corresponding to the question and answer group in the question and answer group summary vector library. If some question and answer group summaries corresponding to the question and answer group are found, the question and answer group summaries are directly sorted. Afterwards, for step 202, if the question and answer group summary corresponding to the question and answer group is not found in the question and answer group summary vector library, the question and answer group summary corresponding to the question and answer group is added through the big model or the management personnel, and the question and answer group summary added by the management personnel is stored in the question and answer group summary vector library. The summary is generally automatically generated by the big model first, and can also be added manually when the user does not generate it through the big model. Usually, when the big model generation effect is not good, manual modification and optimization are required.
[0043] The method of the embodiment of the present application determines whether there is a question-answer group summary, and if not, manually adds the question-answer group summary. The ability of the large model to generate summaries is used to extract the question-answer group summary, saving manual time in reading and summarizing the summary.
[0044] In some optional embodiments, after generating a document summary corresponding to a document and after the administrator adds a question-and-answer group summary corresponding to a question-and-answer group, it is necessary to perform vectorized feature identification on the document summary and vectorized feature identification on the question-and-answer group summary. If no summary is added, it is supported to automatically generate or manually add a summary through a large model, and the summary information should be as accurate as possible. The added summary will also be vectorized feature identified. The vectorized feature identification of the added summary will facilitate subsequent retrieval.
[0045] In some optional embodiments, the sorting of the retrieved document summaries and question-answer group summaries is based on a vector algorithm. The retrieved document summaries and question-answer group summaries are sorted by a vector algorithm, wherein the higher the similarity between the document summaries and the question-answer group summaries is, the higher the front is. The sorting of the retrieved paragraphs and question-answer pairs is also based on a vector algorithm. The vector algorithm sorts the retrieved paragraphs and question-answer pairs, wherein the higher the similarity between the paragraphs and the question-answer pairs is, the higher the front is. According to the summary ranking, it can be regarded as the relevance ranking of these documents or question-answer groups to user questions. The retrieval in the document and question-answer group is carried out synchronously, so a part of the retrieval time can be saved, and the response speed is almost unaffected. The retrieval and ranking of the paragraphs and question-answer pairs is sorted according to the vector algorithm, which can be regarded as the relevance ranking of these paragraphs or question-answer pairs to user questions. The retrieval in the paragraphs and question-answer pairs is also carried out synchronously, and the response speed is almost unaffected.
[0046] It should be noted that the summary of the document and question-answer group is searched, ranked, and selected respectively. Ranking in the summary first can filter out some documents and question-answer groups that are not very relevant to the question, and prevent some interfering paragraphs and question-answer pairs in these documents and question-answer groups from occupying the final ranking, which is equivalent to a preliminary screening. Then, in the selected documents and question-answer groups, the paragraphs and question-answer pairs are searched, ranked, and selected respectively. Separate ranking and selection can avoid the biased ranking caused by the large difference in the number of words in the question-answer pairs and paragraphs. This strategy can ensure that both a certain number of paragraphs and a certain number of question-answer pairs are selected. Prevent the loss of key information.
[0047] In some optional embodiments, after at least one paragraph and at least one question-answer pair are spliced with the question, a reply corresponding to the question is obtained through large model reading comprehension processing. After at least one paragraph and at least one question-answer pair are spliced with the question, the question-answer pair is set before the paragraph to give the question-answer pair a higher priority. The final selected paragraph and question-answer pair are adjusted and spliced with the user's question to put the question-answer pair before the paragraph, which can achieve a strategy of higher priority for the question-answer pair.
[0048] It should be noted that the big model involved in this application refers to a generative general basic big language model, which has the capabilities of natural language understanding and logical reasoning, and is mainly used in the field of human-computer text dialogue. After passing through the big model, the general big model will understand and reason based on the provided paragraphs and question-answer pairs as additional background knowledge to respond to user questions more accurately.
[0049] After using the above method, the general large model will understand and reason based on the provided paragraphs and question-answer pairs as additional background knowledge to respond to user questions more accurately.
[0050] Please refer to Figure 4 , which shows an example flow chart of the question and answer generation method of the present invention.
[0051] like Figure 4 As shown, the document scope is first indexed according to the abstract, and then sorted among the 8 paragraphs after the scope is narrowed; a new question-answer group is added, which is first indexed according to the abstract to narrow the scope, and then sorted among the 4 question-answer pairs after the scope is narrowed.
[0052] It is assumed that the knowledge point information actually related to the user's question in the example is still distributed in the two paragraphs B-1 and B-4, and the question-answer pair F-0 is added to provide a direct answer to the user's question.
[0053] First, the user questions in the example are searched and sorted in the summary vector libraries of the three documents and the summary vector libraries of the three question-answer groups at the same time. The sorting is as follows:
[0054] B-0,A-0,C-0
[0055] F-0,E-0,D-0
[0056] This ranking represents the order of documents and question-answer groups that are relevant to the user's question. In order to narrow the scope, only the first two documents and the first question-answer group are selected as samples, namely document B, document A, and question-answer group F.
[0057] Next, the user questions are searched and sorted in the paragraph vector library of document B and document A and the question-answer pair vector library of question-answer group F respectively. The sorting is as follows:
[0058] B-1,B-4,A-1,B-2,A-4,A-2,B-3,A-3
[0059] F-1, F-4, F-2, F-3
[0060] Similarly, due to the limitation of the context token of the large model, it is assumed that only the first three paragraphs and the first question-answer pair can be selected as background knowledge. In this case, the selected paragraphs and question-answer pairs are:
[0061] B-1,B-4,A-1
[0062] F-1
[0063] In summary, the background knowledge finally selected is paragraph B-1, paragraph B-4, paragraph A-1, and question-answer pair F-1. Considering that the big model gives higher priority to the background knowledge that is relatively early in the prompt, the question-answer pair is placed before the paragraph to achieve the effect of higher priority for the question-answer pair. The final order of background knowledge sent to the big model is:
[0064] Questions and answers for F-1, paragraph B-1, paragraph B-4, paragraph A-1
[0065] Among them, question and answer pairs F-1, paragraph B-1, and paragraph B-4 are all valid information, so the response of the large model will most likely be in line with expectations.
[0066] The example in the principle still uploads 3 documents, but in addition to splitting each document into 4 paragraphs, an additional summary will be generated, totaling 3 document summaries and 12 paragraphs, and finally 3 paragraphs are selected from the 12 paragraphs; the example in the principle creates 3 question-and-answer groups, each of which adds 1 summary and contains 4 question-and-answer pairs, totaling 3 question-and-answer group summaries and 12 question-and-answer pairs.
[0067] Please refer to Figure 5 , which shows the implementation flow chart of the question and answer generation method of the present invention.
[0068] like Figure 5 As shown, the user begins to ask questions.
[0069] Step 1: Determine whether to enable summary indexing. You can choose whether to enable summary indexing based on the actual situation. After enabling, the summary indexing will be prioritized to narrow the scope.
[0070] Step 2: Determine whether there is an abstract. If no abstract has been added, it is supported to automatically generate or manually add an abstract through the large model. The abstract information should be as accurate as possible. The added abstract will also be vectorized and marked.
[0071] Step 3: Search and rank the documents and Q&A summaries based on the user's question. This step is mainly based on the sorting of vector algorithms. The summary represents the core meaning of the document to a certain extent. The ranking of the summary can be regarded as the relevance ranking of these documents or Q&A groups to the user's question. The search in the document and Q&A group is performed synchronously, so some search time can be saved and the response speed is almost unaffected.
[0072] Step 4: Select the top n documents and top n question-answer groups as the background knowledge sources after narrowing down the scope according to the summary ranking. n can be set according to the actual situation. The smaller n is, the smaller the scope is, which may result in missing key documents. The larger n is, the larger the scope is, which may result in too much interference information.
[0073] Step 5: Retrieve and rank the paragraphs and question-answer pairs in the selected documents and question-answer groups according to the user's question. This step is mainly based on the sorting of vector algorithms, which can be regarded as the relevance ranking of these paragraphs or question-answer pairs to the user's question. The retrieval in paragraphs and question-answer pairs is also performed synchronously, and the response speed is almost unaffected.
[0074] Step 6: Select the top n question-answer pairs and top n paragraphs according to the ranking and merge them as the final background knowledge fragment. This operation is to finally select the question-answer pairs and paragraphs with the highest relevance to the question. n can be set according to the actual situation, which to a certain extent represents the tolerance for interference information. The larger n is, the more interference information it may bring, and the smaller n is, some useful information may be missed.
[0075] Step 7: Combine the background knowledge fragments and user questions into a complete prompt and provide it to the large model for reading comprehension. This operation regularizes the final background knowledge and places the question-answer pair at the beginning of the paragraph.
[0076] Step 8: The big model responds to user questions.
[0077] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of combined actions, but those skilled in the art should be aware that the present invention is not limited by the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention. In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0078] In some embodiments, an embodiment of the present invention provides a non-volatile computer-readable storage medium, which stores one or more programs including execution instructions, and the execution instructions can be read and executed by an electronic device (including but not limited to a computer, a server, or a network device, etc.) to execute any of the above-mentioned question and answer generation methods of the present invention.
[0079] In some embodiments, an embodiment of the present invention further provides a computer program product, comprising a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer executes any one of the above-mentioned question and answer generation methods.
[0080] In some embodiments, an embodiment of the present invention also provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the question and answer generation method.
[0081] Figure 6 is a schematic diagram of the hardware structure of an electronic device for executing a question-answer generation method provided by another embodiment of the present application, such as Figure 6 As shown, the device includes:
[0082] One or more processors 610 and memory 620, Figure 6 A processor 610 is taken as an example.
[0083] The device for executing the question and answer generating method may further include: an input device 630 and an output device 640 .
[0084] The processor 610, the memory 620, the input device 630 and the output device 640 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0085] The memory 620, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the question and answer generation method in the embodiment of the present application. The processor 610 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 620, that is, the question and answer generation method in the above method embodiment is implemented.
[0086] The memory 620 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created according to the use of the question and answer generation device, etc. In addition, the memory 620 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 620 may optionally include a memory remotely arranged relative to the processor 610, and these remote memories may be connected to the question and answer generation device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0087] The input device 630 can receive input digital or character information and generate signals related to user settings and function control of the question and answer generating device. The output device 640 can include a display device such as a display screen.
[0088] The one or more modules are stored in the memory 620, and when executed by the one or more processors 610, the question and answer generating method in any of the above method embodiments is executed.
[0089] The above-mentioned product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.
[0090] The electronic devices of the embodiments of the present application exist in various forms, including but not limited to:
[0091] (1) Mobile communication equipment: This type of equipment is characterized by having mobile communication functions and its main purpose is to provide voice and data communications. This type of terminal includes: smart phones, multimedia phones, functional phones, and low-end phones.
[0092] (2) Ultra-mobile personal computer devices: These devices belong to the category of personal computers, have computing and processing functions, and generally also have mobile Internet access features. These terminals include: PDA, MID and UMPC devices, etc.
[0093] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players, handheld game consoles, e-books, smart toys, and portable car navigation devices.
[0094] (4) Other onboard electronic devices with data interaction functions, such as on-board devices installed in vehicles.
[0095] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0096] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A question-answer generation method, comprising: Obtaining a question raised by a user, searching for the question in a preset document summary vector library and a preset question-answer group summary vector library respectively, and sorting the retrieved document summaries and question-answer group summaries respectively, wherein the document summary vector library includes summaries of multiple documents, each document has multiple paragraphs, and the question-answer group summary vector library includes summaries of multiple question-answer groups, each question-answer group has multiple question-answer pairs; Obtaining at least one sorted document summary and at least one question-answer group summary, and searching for the at least one document summary and the at least one question-answer group summary in a preset paragraph vector library and a question-answer pair vector library, respectively, wherein the paragraph vector library includes multiple paragraphs of multiple documents, and the question-answer pair vector library includes multiple question-answer pairs of multiple question-answer groups; sorting the retrieved paragraphs and question-answer pairs respectively, and extracting at least one sorted paragraph and at least one question-answer pair; The at least one paragraph and the at least one question-answer pair are concatenated with the question to obtain a reply corresponding to the question.
2. The method according to claim 1, wherein: The searching of the question in the preset document summary vector library and the question-answer group summary vector library respectively includes: Confirming whether a document summary corresponding to the document exists in the document summary vector library; If the document summary does not exist in the document summary vector library, a document summary corresponding to the document is generated and stored in the document summary vector library.
3. The method according to claim 2, wherein: The method further comprises: Confirming whether the question and answer group summary corresponding to the question and answer group exists in the question and answer group summary vector library; If the question and answer group summary does not exist in the question and answer group summary vector library, a question and answer group summary corresponding to the question and answer group is added by a manager, and the question and answer group summary is stored in the question and answer group summary vector library.
4. The method according to claim 2 or 3, wherein: After a document summary corresponding to the document is generated and a manager adds a question-and-answer group summary corresponding to the question-and-answer group, the method includes: Vectorized feature identification is performed on the document summary and vectorized feature identification is performed on the question and answer group summary.
5. The method according to claim 1, wherein: The sorting of the retrieved document summaries and question-answer group summaries comprises: The retrieved document summaries and question-answer group summaries are sorted based on a vector algorithm, wherein the document summaries or question-answer group summaries with higher similarity to the question are ranked higher.
6. The method according to claim 1, wherein: The sorting of the retrieved paragraphs and question-answer pairs comprises: The retrieved paragraphs and question-answer pairs are sorted based on a vector algorithm, wherein the paragraphs or question-answer pairs with higher similarity to the question are ranked higher.
7. According to the method of claim 1, after the at least one paragraph and the at least one question-answer pair are spliced with the question, a large model reading comprehension process is performed to obtain a response corresponding to the question.
8. The method according to claim 7, wherein: After the at least one paragraph and the at least one question-answer pair are concatenated with the question, the method further comprises: The question-answer pair is set before the paragraph to give the question-answer pair a higher priority.
9. An electronic device, comprising: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the method described in any one of claims 1 to 8.
10. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
System, apparatus and method for document query
CN115004175A
System and method for hierarchical acquisition of semantic-based chapters in deep learning
CN117581223A
Language output method, system and equipment based on knowledge graph and storage medium
CN118332134A
Auto-solving multiple-choice questions
US12057032B1
Semantic cluster formation in deep learning intelligent assistants
US20210374168A1
Cited By
Multi-document abstract generation quality evaluation method
CN119782464A
Document processing method, document question and answer method and computer program product
CN121561092A
