A question and answer processing method and apparatus

CN117972048BActive Publication Date: 2026-08-11QI-ANXIN LEGENDSEC INFORMATION TECH (BEIJING) INC +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-12
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0003]为此,本发明提供一种问答处理方法及装置,以解决现有技术中存在的问答处理方案局限性较高,导致实际的问答处理精度和效率较差的缺陷

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117972048B_ABST
    Figure CN117972048B_ABST
Patent Text Reader

Abstract

This invention provides a question-and-answer processing method and apparatus. The method includes: obtaining a text vector corresponding to input question information; inputting the text vector into a preset vector database for vector similarity association matching to find at least one associated text corresponding to the question information; wherein the vector database is obtained by pre-traversing a document semantic tree corresponding to the text to be retrieved; the text to be retrieved is obtained by segmentation based on semantic relationships between texts; the document semantic tree is constructed based on the association relationships between the texts to be retrieved; and generating corresponding answer information based on the associated text. The question-and-answer processing method provided by this invention can quickly generate accurate answer information, effectively improving the efficiency and accuracy of question-and-answer processing, thereby greatly enhancing the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, specifically to a question-answering processing method and apparatus. It also relates to an electronic device and a processor-readable storage medium. Background Technology

[0002] In recent years, with the rapid development of artificial intelligence (AI) technology, various document-based intelligent question-answering (CQA) solutions have become increasingly widely used in people's production and daily lives. Document-based intelligent question-answering solutions are an important manifestation of AI applications. Especially with the arrival of the big data era, more and more traditional business systems are facing the pressure of integrating data dimensions and business function dimensions. Currently, existing document-based intelligent question-answering solutions typically extract the text content of a document, segment the text according to two parameters: block size and block overlap size, vectorize the segmented text, and then store it in a vector database. When answering a question, the question is first vectorized, and then text with high matching degree is found from the vector database. However, existing document-based intelligent question-answering solutions segment text by a fixed length, without considering semantic relationships between texts, which has significant limitations, resulting in poor accuracy and efficiency in actual question-answering processing. Summary of the Invention

[0003] To address this, the present invention provides a question-and-answer processing method and apparatus to overcome the shortcomings of existing question-and-answer processing schemes, which have high limitations and result in poor actual question-and-answer processing accuracy and efficiency.

[0004] In a first aspect, the present invention provides a question-and-answer processing method, comprising:

[0005] Obtain the text vector corresponding to the input question information;

[0006] The text vector is input into a preset vector database for vector similarity association matching to find at least one associated text corresponding to the question information; wherein, the vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved; the text to be retrieved is obtained by segmenting based on the semantic relationship between texts; the document semantic tree is constructed based on the association relationship between the texts to be retrieved;

[0007] The corresponding answer information is generated based on the associated text.

[0008] Furthermore, the step of inputting the text vector into a preset vector database for vector similarity association matching to find at least one related text corresponding to the question information specifically includes:

[0009] The text vector is input into the vector database for vector similarity matching to obtain initial associated text that meets the preset similarity conditions with the text vector;

[0010] Based on the first node corresponding to the initial associated text, at least one second node with an association relationship with the first node is determined from the document semantic tree, and the initial associated text and the text corresponding to the second node are used as at least one associated text corresponding to the question information; wherein, both the first node and the second node are used to represent the text after semantic relationship segmentation.

[0011] Furthermore, before obtaining the text vector corresponding to the input question information, the process also includes:

[0012] The semantic relationships between the texts to be retrieved are parsed to construct a document semantic tree;

[0013] The semantic tree of the document is traversed and parsed to obtain the semantic summary information corresponding to each text in the text to be retrieved.

[0014] Based on each text in the text to be retrieved and its corresponding semantic summary information, a corresponding set of text blocks is obtained; the set of text blocks is input into a preset embedding vector model to obtain a corresponding set of vectors output by the embedding vector model.

[0015] The vector set and the text block set are stored in the initial vector database to obtain the vector database.

[0016] Furthermore, the step of generating corresponding answer information based on the associated text specifically includes: obtaining an input prompt template; wherein the prompt template is an information template input by the user to limit the current question-and-answer background and question-and-answer identity;

[0017] Based on the associated text and the prompt template, a prompt is generated, and the prompt is input into a preset semantic question-answering model to generate corresponding answer information.

[0018] Furthermore, the step of traversing and parsing the document semantic tree to obtain semantic summary information corresponding to each text in the text to be retrieved specifically includes:

[0019] A preset semantic question-answering model is invoked to traverse and parse the document semantic tree, obtain the semantic summary information corresponding to each text in the text to be retrieved, and add the semantic summary information to the node of the document semantic tree.

[0020] Furthermore, obtaining the text vector corresponding to the input question information specifically includes:

[0021] Obtain the input question information, input the question information into a preset embedding vector model, and obtain the text vector output by the embedding vector model.

[0022] Secondly, the present invention also provides a question-and-answer processing device, characterized in that it comprises:

[0023] The text vector acquisition unit is used to obtain the text vector corresponding to the input question information;

[0024] The associated text determination unit is used to input the text vector into a preset vector database for vector similarity association matching to find at least one associated text corresponding to the question information; wherein, the vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved; the text to be retrieved is obtained by segmentation based on the semantic relationship between texts; the document semantic tree is constructed based on the association relationship between the texts to be retrieved;

[0025] The answer information generation unit is used to generate corresponding answer information based on the associated text.

[0026] Furthermore, the associated text determination unit is specifically used for:

[0027] The text vector is input into the vector database for vector similarity matching to obtain initial associated text that meets the preset similarity conditions with the text vector;

[0028] Based on the first node corresponding to the initial associated text, at least one second node with an association relationship with the first node is determined from the document semantic tree, and the initial associated text and the text corresponding to the second node are used as at least one associated text corresponding to the question information; wherein, both the first node and the second node are used to represent the text after semantic relationship segmentation.

[0029] Furthermore, before obtaining the text vector corresponding to the input question information, it also includes: a vector database construction unit, used for:

[0030] The semantic relationships between the texts to be retrieved are parsed to construct a document semantic tree;

[0031] The semantic tree of the document is traversed and parsed to obtain the semantic summary information corresponding to each text in the text to be retrieved.

[0032] Based on each text in the text to be retrieved and its corresponding semantic summary information, a corresponding set of text blocks is obtained; the set of text blocks is input into a preset embedding vector model to obtain a corresponding set of vectors output by the embedding vector model.

[0033] The vector set and the text block set are stored in the initial vector database to obtain the vector database.

[0034] Furthermore, the answer information generation unit is specifically used to: obtain an input prompt template; wherein the prompt template is an information template input by the user to limit the current question-and-answer background and question-and-answer identity;

[0035] Based on the associated text and the prompt template, a prompt is generated, and the prompt is input into a preset semantic question-answering model to generate corresponding answer information.

[0036] Furthermore, the step of traversing and parsing the document semantic tree to obtain semantic summary information corresponding to each text in the text to be retrieved specifically includes:

[0037] A preset semantic question-answering model is invoked to traverse and parse the document semantic tree, obtain the semantic summary information corresponding to each text in the text to be retrieved, and add the semantic summary information to the node of the document semantic tree.

[0038] Furthermore, the text vector acquisition unit is specifically used for:

[0039] Obtain the input question information, input the question information into a preset embedding vector model, and obtain the text vector output by the embedding vector model.

[0040] Thirdly, the present invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the question-and-answer processing method as described in any of the preceding claims.

[0041] Fourthly, the present invention also provides a processor-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the question-and-answer processing method as described in any of the preceding claims.

[0042] The question-answering method provided by this invention obtains the text vector corresponding to the input question information, inputs the text vector into a preset vector database for vector similarity association matching, and finds at least one associated text corresponding to the question information. The vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved, where the text to be retrieved is segmented based on the semantic relationships between texts, and the document semantic tree is constructed based on the association relationships between the texts to be retrieved. Based on the associated text, corresponding answer information is generated. This method can quickly generate accurate answer information, effectively improving the efficiency and accuracy of question-answering processing, thereby greatly enhancing the user experience. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a flowchart illustrating the question-and-answer processing method provided in an embodiment of the present invention;

[0045] Figure 2 This is a schematic diagram of the document semantic tree of the question-and-answer processing method provided in the embodiments of the present invention;

[0046] Figure 3 This is a flowchart illustrating an existing question-and-answer processing method provided in an embodiment of the present invention;

[0047] Figure 4 This is a schematic diagram of the question-and-answer processing device provided in an embodiment of the present invention;

[0048] Figure 5 This is a schematic diagram of the physical structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0050] It should be noted that the terms "first," "second," etc., in the specification and accompanying drawings of this application are used to distinguish similar users 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.

[0051] Currently, the main process of existing document-based intelligent question answering solutions includes extracting the document's text content, segmenting the text according to two parameters: text block size and block overlap; vectorizing the segmented text and storing it in a vector database; when answering a question, first vectorizing the question, then finding text with high matching degree from the vector database; generating prompts based on the matched text and prompt templates, and then feeding the prompts to a large model to produce the answer. Existing document segmentation methods are relatively simple, losing semantic information between texts, resulting in poor accuracy of the answers.

[0052] The following is a detailed description of embodiments of the question-and-answer processing method described in this invention. Figure 1 The diagram shown is a flowchart of the question-and-answer processing method provided in an embodiment of the present invention. The specific process includes the following steps:

[0053] Step 101: Obtain the text vector corresponding to the input question information.

[0054] Specifically, the system can acquire user-input question information, input the question information into a preset embedding vector model, and obtain a set of text vectors output by the embedding vector model. The embedding vector model is a preset embedding model that can convert the input question information into a corresponding vector, i.e., a text vector.

[0055] It should be noted that, in this embodiment of the invention, before obtaining the text vector corresponding to the input question information, a corresponding vector database, i.e., document storage, needs to be pre-constructed. The process of constructing the vector database includes: parsing the semantic relationships between the pre-input texts to be retrieved, generating a corresponding document semantic tree; calling a preset semantic question-answering model to traverse and parse the document semantic tree, obtaining semantic summary information (i.e., a summary) corresponding to each text in the text to be retrieved, and adding the semantic summary information to the nodes of the document semantic tree; further, based on each text in the text to be retrieved and its corresponding semantic summary information, obtaining a corresponding set of text blocks; inputting the set of text blocks into a preset embedding vector model to obtain the corresponding vector set output by the embedding vector model. Finally, storing the vector set and the set of text blocks in the initial vector database to obtain the vector database. The set of text blocks includes texts and their corresponding semantic summary information.

[0056] It should be further explained that the Embedding model has a context window size. If the text length exceeds the window limit, the text needs to be segmented to generate text chunks. The main attributes of a text chunk include: text chunk ID, text chunk content, and text chunk type; the text chunk type includes: title, paragraph, title summary, and chapter summary; the node ID to which it belongs (node: paragraph or chapter node); the offset of the text chunk in its parent text; and the length of the text chunk. The text to be retrieved can refer to a user-internal, unpublished document, and the hierarchical structure of the document generally consists of chapters, sub-chaps, and paragraphs. A chapter can include multiple paragraphs and multiple sub-chaps. Therefore, in this embodiment of the invention, the specific process of constructing the vector database (i.e., the document entry process) may include: receiving and parsing the document to generate a document semantic tree; traversing the document semantic tree, calling the large model (i.e., the semantic question answering model) interface from bottom to top based on the paragraph and chapter content to generate paragraph and chapter summaries; adding the generated summaries to the document semantic tree; traversing the document semantic tree, segmenting the text into titles, paragraphs, title summaries, paragraph summaries, etc., to obtain a set of text chunks. A set of text blocks is processed through an embedding model to obtain a set of vectors. The text block set and vector set are then stored in a vector database, and the document semantic tree is stored in a relational database. The summary refers to semantic summary information. The semantic summary information corresponding to each text in the text to be retrieved includes title summaries, paragraph summaries, etc. This vector database is specifically designed for storing, querying, and managing large-scale high-dimensional vector data. Embedding, or embedding, transforms data into a continuous, low-dimensional, dense vector form. These vectors capture certain semantic relationships or patterns in the original data.

[0057] Furthermore, due to the limited context window size of the large model, it is necessary to use high-level semantics of the document to improve the accuracy of answers to summary-type questions. This means using the large model to pre-generate summaries for chapters and paragraphs, forming high-level semantics (i.e., semantic summaries of each text in the text to be retrieved). These individual texts include chapters and paragraphs within the text to be retrieved. Correspondingly, such as... Figure 2As shown, the document semantic tree in this embodiment of the invention includes two types of nodes: chapters and paragraphs. A chapter node can contain paragraphs and chapters; paragraphs are leaf nodes; the root chapter: in the diagram, chapter 0 represents a document. The main attributes of a chapter include: chapter ID; chapter title; chapter summary; chapter level (0: representing the document root node); parent chapter ID; set of paragraph IDs; and set of child chapter IDs. The main attributes of a paragraph include: paragraph ID; paragraph content; paragraph summary; and the chapter ID it belongs to. The large model is referred to as LLM (Large Language Model): a deep learning model in the field of natural language processing, especially those models with a large number of parameters. These models are designed to capture, understand, and generate human language.

[0058] Step 102: Input the text vector into a preset vector database for vector similarity association matching to find at least one associated text corresponding to the question information; wherein, the vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved; the text to be retrieved is obtained by segmenting based on the semantic relationship between texts; the document semantic tree is constructed based on the association relationship between the texts to be retrieved.

[0059] In this embodiment of the invention, the text vector can be input into the vector database for vector similarity matching. It is then matched with each vector in the association relationships stored in the vector database to obtain multiple texts that satisfy a preset similarity matching condition. These multiple texts satisfying the preset similarity matching condition are used as multiple initial associated texts corresponding to the question information. Based on the first node corresponding to the initial associated text, at least one second node with an association relationship to the first node is determined from the document semantic tree. The initial associated text and the text corresponding to the second node are used as at least one associated text corresponding to the question information. The node represents text segmented based on semantic relationships. The node includes the first node and the second node. The vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved, generating a vector set. The text to be retrieved is segmented based on the semantic relationships between texts, specifically segmented according to the content structure of the text. Specifically: as shown... Figure 2As shown, the text can be divided into multiple chapters, sub-chaps, and paragraphs according to its content structure, such as Chapter 1, Chapter 2, Chapter 1.1, Chapter 1.2, Chapter 1.2.1, Chapter 1.2.2, and paragraphs. Therefore, it can be segmented according to the content structure of Chapter 1, Chapter 2, Chapter 1.1, Chapter 1.2, Chapter 1.2.1, Chapter 1.2.2, and paragraphs to obtain the text to be retrieved. The document semantic tree is constructed based on the relationships between the texts to be retrieved. Nodes in the document semantic tree represent texts with semantic relationships, such as Chapter 1, Chapter 2, Chapter 1.1, Chapter 1.2, Chapter 1.2.1, Chapter 1.2.2, and paragraphs. Specifically, this step is a text retrieval process, which may include: finding the 10 text chunks with the highest matching degree from the vector database; finding the nodes of these text chunks in the document semantic tree, and selecting text from the semantic tree according to a strategy; if the text length of a text chunk exceeds the context window size of the large model, discarding lower-ranking text chunks as needed; if multiple text chunks belong to the same paragraph, taking the text of the largest interval covered by the chunks in that paragraph. For example, text chunk1 and text chunk2 belong to the same paragraph. Text chunk1 has an offset of 100 and a length of 50. Text chunk2 has an offset of 150 and a length of 50. Taking the text with offsets from 100 to 200 in that paragraph as associated text. The text chunks contain text segmented based on semantic relationships, therefore associated text can be determined based on similarity analysis between text chunks.

[0060] Step 103: Generate corresponding answer information based on the associated text.

[0061] In this step, the input prompt template must first be obtained. The associated text and the prompt template are then merged to generate a prompt, which is then input into a preset semantic question-answering model to generate corresponding answer information. The prompt template is an information template input by the user to define the current question-answering context and the question-answering identity.

[0062] Specifically, the answer generation process described in this step may include, for example, generating prompts (i.e., question-and-answer information) based on the selected related text and prompt template. The prompts mainly include: the expected role of the large model, such as playing a high school Chinese teacher; background information and context provided to the large model; requirements for the large model, such as only answering questions based on given text; examples provided to the large model, etc., etc., which are not specifically limited here. Then, the large model interface is called to obtain the answer information. The prompt, or "Promot," refers to the relevant text input into the large model; when interacting with the large model, the given question or instruction is a "prompt." The prompt template is a predefined template for generating prompts for the language model (i.e., the semantic question-and-answer model). This template may include explanations, a few examples, and specific contexts and questions suitable for a particular task. The large model is the preset semantic question-and-answer model.

[0063] For example, if the input question is: "What document types can this Q&A system upload?", the matching text includes: "Title: Upload Document; Paragraph: Supports intelligent Q&A for PDF and DOCX documents." However, considering the effectiveness of document parsing, it prefers uploading PDF documents, and limits uploads to 10 documents per session. If you have a large amount of document data, it is recommended to contact the developer directly to upload documents via the API. Failures may occur during document parsing. The system provides a retry function; clicking the retry icon will re-analyze the uploaded document. If multiple retries fail, the system will follow up and resolve the issue on a one-to-one basis. Document sets can be created to meet the needs of multi-document Q&A. If many documents have already been uploaded to the document directory, the system also provides a document movement function, allowing you to copy and move individual documents to different folders. PS1. Larger documents may take some time to parse; please be patient. PS2. You can drag and drop documents to any position on the interface to complete the upload.

[0064] The top 5 related texts found from the vector database: (1) If you have already uploaded many documents in the document directory, the system also provides the function of moving documents. You can copy a single document and move it to a different folder. PS1. Larger documents will take some time to parse. Please wait patiently. PS2. You can drag and drop the document to any position on the interface to complete the upload. (2) Finally, you can call POST / documents / {id} / queries to ask and answer questions for the document. Folder upload docanswer supports uploading multiple documents to a folder and asking and answering questions based on the folder content. This use case requires calling multiple interfaces to implement. (3) Upload document\nSupports intelligent question and answering for PDF and DOCX documents. However, considering the effect of document parsing, the system prefers to upload PDF documents and limits the upload to 10 documents each time. If you have a large amount of document data, it is recommended to contact the developer directly to complete the document upload through the interface. (4) Key use case document upload The interface to be called for document upload is POST / groups / {id} / documents. When id=0, it means that the document is uploaded to the root folder. Other folders must be created by POST / groups. (5) Upload documents using POST / groups / {id} / documents, using the group_id value from the previous step as {id}, and repeat until all files are uploaded. Save the id of the returned result after each upload as the document_id for the next document status query. The document refers to the text file.

[0065] The content generated based on the document semantic tree includes: if chunk1 and chunk3 belong to the same paragraph, then the entire paragraph will be retrieved. Uploaded documents include: "Intelligent question answering is supported for PDF and DOCX documents, but considering the effectiveness of document parsing, the system prefers to upload PDF documents, and limits uploads to 10 documents at a time. If you have a large amount of document data, it is recommended to contact the developer directly to complete the document upload via the interface. Failures may occur during document parsing; the system provides a retry function. Clicking the retry icon will re-analyze the uploaded document. If multiple retries fail, it is recommended to contact the developer; the system will follow up and resolve the issue one-on-one. Document sets can be created to meet the needs of multi-document question answering. If many documents have already been uploaded to the document directory, the system also provides a document moving function, allowing you to copy and move individual documents to different folders. PS1. Larger documents require some time to parse; please be patient. PS2. You can drag and drop documents to any position on the interface to complete the upload." After a document is uploaded, it's necessary to repeatedly call `GET / groups / {id} / documents / {document_id}` to query the status of each uploaded document until the document's status is "Indexed," indicating that the document indexing is complete. Finally, for that document, you can call `POST / documents / {id} / queries` to perform a question-and-answer session. The folder upload function `docanswer` supports uploading multiple documents to a folder and performing question-and-answer sessions based on the folder's contents. This use case requires calling multiple APIs to implement. The steps are as follows:

[0066] (1) Call POST / groups to generate a new folder, and record the id in the returned result as the group_id for subsequent upload actions. curl –X POST https: / / docanswer.address / login-H"Content-Type:application / json"-d

[0067] '{"access_token":"your_access_token_here"}' Key Use Case: Document Upload. The interface to be called for document upload is POST / groups / {id} / documents. When id=0, it means that the document is uploaded to the root folder. Other folders must be created by POST / groups. (2) Call POST / groups / {id} / documents to upload the document, using the group_id value from the previous step as {id}, and loop until all files are uploaded. Save the id of the returned result after each upload as the document_id for the next document status query. (3) Call GET / groups / {id} / documents / {document_id} to query the status of each uploaded document until the status of all documents has been set to Indexed, indicating that the document indexing is complete. The generated answer information includes: Prompt: What document types can be uploaded? SystemMessage: Will act as a knowledge base to answer the user's questions based on the provided document content. The constraints (i.e., the prompt template) include: Please answer the questions in the format shown in the example below; Please be sure to include a citation "[]" in your answer, such as {answer1}[1]; Questions that exceed the given content do not need to be marked with a citation []; Only answer the necessary questions, no additional character output is required; Please answer in Chinese, etc. For large models: AIMessage: You can upload PDF and DOCX documents, but uploading a PDF document is recommended.

[0068] The question-answering method described in this embodiment of the invention obtains the text vector corresponding to the input question information, inputs the text vector into a preset vector database for vector similarity association matching, and finds at least one associated text corresponding to the question information. The vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved, where the text to be retrieved is segmented based on the semantic relationships between texts, and the document semantic tree is constructed based on the association relationships between the texts to be retrieved. Based on the associated text, corresponding answer information is generated. This method can improve the effect of intelligent question answering based on the document semantic tree, quickly generate accurate answer information, effectively improve the efficiency and accuracy of question-answering processing, and thus greatly enhance the user experience.

[0069] Corresponding to the question-and-answer processing method provided above, the present invention also provides a question-and-answer processing apparatus. Since the embodiments of this apparatus are similar to the method embodiments described above, the description is relatively simple. For relevant details, please refer to the description in the method embodiment section above. The embodiments of the question-and-answer processing apparatus described below are merely illustrative. Please refer to... Figure 4 As shown, it is a structural schematic diagram of a question-and-answer processing device provided in an embodiment of the present invention.

[0070] The question-and-answer processing device of the present invention specifically includes the following parts:

[0071] The text vector acquisition unit 401 is used to acquire the text vector corresponding to the input question information;

[0072] The associated text determination unit 402 is used to input the text vector into a preset vector database for vector similarity association matching to find at least one associated text corresponding to the question information; wherein, the vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved; the text to be retrieved is obtained by segmentation based on the semantic relationship between texts; the document semantic tree is constructed based on the association relationship between the texts to be retrieved;

[0073] The answer information generation unit 403 is used to generate corresponding answer information based on the associated text.

[0074] Furthermore, the associated text determination unit is specifically used for:

[0075] The text vector is input into the vector database for vector similarity matching to obtain initial associated text that meets the preset similarity conditions with the text vector;

[0076] Based on the first node corresponding to the initial associated text, at least one second node with an association relationship with the first node is determined from the document semantic tree, and the initial associated text and the text corresponding to the second node are used as at least one associated text corresponding to the question information; wherein, both the first node and the second node are used to represent the text after semantic relationship segmentation.

[0077] Furthermore, before obtaining the text vector corresponding to the input question information, it also includes: a vector database construction unit, used for:

[0078] The semantic relationships between the texts to be retrieved are parsed to construct a document semantic tree;

[0079] The semantic tree of the document is traversed and parsed to obtain the semantic summary information corresponding to each text in the text to be retrieved.

[0080] Based on each text in the text to be retrieved and its corresponding semantic summary information, a corresponding set of text blocks is obtained; the set of text blocks is input into a preset embedding vector model to obtain a corresponding set of vectors output by the embedding vector model.

[0081] The vector set and the text block set are stored in the initial vector database to obtain the vector database.

[0082] Furthermore, the answer information generation unit is specifically used to: obtain an input prompt template; wherein the prompt template is an information template input by the user to limit the current question-and-answer background and question-and-answer identity;

[0083] Based on the associated text and the prompt template, a prompt is generated, and the prompt is input into a preset semantic question-answering model to generate corresponding answer information.

[0084] Furthermore, the step of traversing and parsing the document semantic tree to obtain semantic summary information corresponding to each text in the text to be retrieved specifically includes:

[0085] A preset semantic question-answering model is invoked to traverse and parse the document semantic tree, obtain the semantic summary information corresponding to each text in the text to be retrieved, and add the semantic summary information to the node of the document semantic tree.

[0086] Furthermore, the text vector acquisition unit is specifically used for:

[0087] Obtain the input question information, input the question information into a preset embedding vector model, and obtain the text vector output by the embedding vector model.

[0088] The question-answering processing device described in this embodiment of the invention obtains the text vector corresponding to the input question information, inputs the text vector into a preset vector database for vector similarity association matching, and finds at least one associated text corresponding to the question information. The vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved, where the text to be retrieved is segmented based on the semantic relationships between texts, and the document semantic tree is constructed based on the association relationships between the texts to be retrieved. Finally, corresponding answer information is generated based on the associated text. This device can improve the effect of intelligent question answering based on the document semantic tree, quickly generate accurate answer information, effectively improve the efficiency and accuracy of question-answering processing, and thus greatly enhance the user experience.

[0089] Corresponding to the question-and-answer processing method provided above, the present invention also provides an electronic device. Since the embodiments of this electronic device are similar to the method embodiments described above, the description is relatively simple. For relevant details, please refer to the description in the method embodiment section above. The electronic device described below is merely illustrative. Figure 5The diagram shown is a schematic representation of the physical structure of an electronic device disclosed in an embodiment of the present invention. The electronic device may include a processor 501, a memory 502, and a communication bus 503. The processor 501 and the memory 502 communicate with each other via the communication bus 503 and communicate with external systems via a communication interface 504. The processor 501 can call logical instructions in the memory 502 to execute a question-and-answer processing method. This method includes: obtaining a text vector corresponding to the input question information; inputting the text vector into a preset vector database for vector similarity association matching to find at least one associated text corresponding to the question information; wherein the vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved; the text to be retrieved is obtained by segmentation based on the semantic relationships between texts; the document semantic tree is constructed based on the association relationships between the texts to be retrieved; and generating corresponding answer information based on the associated texts.

[0090] Furthermore, the logical instructions in the aforementioned memory 502 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a 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 the present invention. The aforementioned storage medium includes various media capable of storing program code, such as memory chips, USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0091] On the other hand, embodiments of the present invention also provide a computer program product, the computer program product including a computer program stored on a processor-readable storage medium, the computer program including program instructions, and when the program instructions are executed by a computer, the computer is able to execute the question-answering processing method provided in the above-described method embodiments. The method includes: obtaining a text vector corresponding to input question information; inputting the text vector into a preset vector database for vector similarity association matching to find at least one associated text corresponding to the question information; wherein the vector database is obtained by pre-traversing a document semantic tree corresponding to the text to be retrieved; the text to be retrieved is obtained by segmentation based on the semantic relationships between texts; the document semantic tree is constructed based on the association relationships between the texts to be retrieved; and generating corresponding answer information based on the associated text.

[0092] In another aspect, embodiments of the present invention also provide a processor-readable storage medium storing a computer program, which, when executed by a processor, implements the question-answering processing method provided in the above embodiments. The method includes: obtaining a text vector corresponding to input question information; inputting the text vector into a preset vector database for vector similarity association matching to find at least one associated text corresponding to the question information; wherein the vector database is obtained by pre-traversing a document semantic tree corresponding to the text to be retrieved; the text to be retrieved is obtained by segmentation based on semantic relationships between texts; the document semantic tree is constructed based on the association relationships between the texts to be retrieved; and generating corresponding answer information based on the associated text.

[0093] The processor-readable storage medium can be any available medium or data storage device that the processor can access, including but not limited to magnetic memory (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO)), optical memory (e.g., CD, DVD, BD, HVD), and semiconductor memory (e.g., ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)).

[0094] The device embodiments described above are merely illustrative. 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 modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0095] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A question-and-answer processing method, characterized in that, include: Obtain the text vector corresponding to the input question information; The text vector is input into a preset vector database for vector similarity association matching to find at least one associated text corresponding to the question information; wherein, the vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved; the text to be retrieved is obtained by segmenting based on the semantic relationship between texts; the document semantic tree is constructed based on the association relationship between the texts to be retrieved; Generate corresponding answer information based on the associated text; Before obtaining the text vector corresponding to the input question information, the method further includes: parsing the semantic relationships between the texts to be retrieved and constructing a document semantic tree; traversing and parsing the document semantic tree to obtain semantic summary information corresponding to each text in the text to be retrieved, and adding the semantic summary information to the nodes of the document semantic tree; obtaining a corresponding set of text blocks based on each text in the text to be retrieved and its corresponding semantic summary information; inputting the set of text blocks into a preset embedding vector model to obtain a corresponding set of vectors output by the embedding vector model; and storing the set of vectors and the set of text blocks in an initial vector database to obtain the vector database.

2. The question-and-answer processing method according to claim 1, characterized in that, The step of inputting the text vector into a preset vector database for vector similarity association matching to find at least one related text corresponding to the question information specifically includes: The text vector is input into the vector database for vector similarity matching to obtain initial associated text that meets the preset similarity conditions with the text vector; Based on the first node corresponding to the initial associated text, at least one second node with an association relationship with the first node is determined from the document semantic tree, and the initial associated text and the text corresponding to the second node are used as at least one associated text corresponding to the question information; wherein, both the first node and the second node are used to represent the text after semantic relationship segmentation.

3. The question-and-answer processing method according to claim 1, characterized in that, The process of generating corresponding answer information based on the associated text specifically includes: Obtain the input prompt template; wherein, the prompt template is an information template input by the user to limit the current question-and-answer background and question-and-answer identity; Based on the associated text and the prompt template, a prompt is generated, and the prompt is input into a preset semantic question-answering model to generate corresponding answer information.

4. The question-and-answer processing method according to claim 1, characterized in that, The step of traversing and parsing the document semantic tree to obtain semantic summary information corresponding to each text in the text to be retrieved specifically includes: A preset semantic question-answering model is invoked to traverse and parse the semantic tree of the document, thereby obtaining the semantic summary information corresponding to each text in the text to be retrieved.

5. The question-and-answer processing method according to claim 1, characterized in that, The text vector corresponding to the input question information obtained specifically includes: Obtain the input question information, input the question information into a preset embedding vector model, and obtain the text vector output by the embedding vector model.

6. A question-and-answer processing device, characterized in that, include: The text vector acquisition unit is used to obtain the text vector corresponding to the input question information; The associated text determination unit is used to input the text vector into a preset vector database for vector similarity association matching to find at least one associated text corresponding to the question information; wherein, the vector database is obtained by pre-traversing the document semantic tree corresponding to the text to be retrieved; the text to be retrieved is obtained by segmentation based on the semantic relationship between texts; the document semantic tree is constructed based on the association relationship between the texts to be retrieved; The answer information generation unit is used to generate corresponding answer information based on the associated text; The device is further configured to: parse the semantic relationships between the texts to be retrieved before obtaining the text vector corresponding to the input question information; construct a document semantic tree; traverse and parse the document semantic tree to obtain semantic summary information corresponding to each text in the text to be retrieved, and add the semantic summary information to the nodes of the document semantic tree; obtain a corresponding set of text blocks based on each text in the text to be retrieved and its corresponding semantic summary information; input the set of text blocks into a preset embedding vector model to obtain a corresponding set of vectors output by the embedding vector model; and store the set of vectors and the set of text blocks in an initial vector database to obtain the vector database.

7. The question-and-answer processing device according to claim 6, characterized in that, The associated text determination unit is specifically used for: The text vector is input into the vector database for vector similarity matching to obtain initial associated text that meets the preset similarity conditions with the text vector; Based on the first node corresponding to the initial associated text, at least one second node with an association relationship with the first node is determined from the document semantic tree, and the initial associated text and the text corresponding to the second node are used as at least one associated text corresponding to the question information; wherein, both the first node and the second node are used to represent the text after semantic relationship segmentation.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the question-and-answer processing method as described in any one of claims 1 to 5.

9. A processor-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the question-and-answer processing method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Text abstract generation method and device based on semantic chunks, equipment and storage medium

    CN113987169A

  • Document question and answer method based on multi-way tree and large-scale language model and related equipment

    CN116932730A