Document-oriented question-answering method, device, electronic device, storage medium and product

By calculating the semantic similarity between user query statements and source document identification information, obtaining candidate document identification information and identifying target documents, the matching failure problem caused by document name abbreviation and so on in the prior art is solved, and the success rate of question and answer and semantic understanding are improved ability.

CN118760759BActive Publication Date: 2025-02-18ALIBABA CLOUD FEITIAN (HANGZHOU) CLOUD COMPUTING TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411252009.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2025-02-18
Estimated Expiration
2044-09-06

AI Technical Summary

Technical Problem

When the existing intelligent Q&A system querys the target document from the knowledge base, it is difficult to deal with matching failures caused by the abbreviation and abbreviation of the document name, resulting in a low success rate of Q&A.

Method used

By obtaining the semantic feature vector of the user query statement and the semantic feature vector of the document identification information of the source document, the semantic similarity is calculated to obtain the candidate document identification information, and to identify whether it contains the target document identification information, thereby obtaining the target document with high similarity Paragraphs to generate answers.

Benefits of technology

It improves the Q&A success rate of the Q&A system, can more accurately match and query the target document, and enhances the system's semantic understanding ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760759B_ABST
    Figure CN118760759B_ABST
Patent Text Reader

Abstract

The present application provides a document-oriented question-answering method, device, electronic device, storage medium and product, which belongs to the field of artificial intelligence technology. The method includes: obtaining a first semantic feature vector corresponding to a query statement and multiple second semantic feature vectors corresponding to document identification information of multiple source documents; obtaining at least one third semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a first preset threshold from the multiple second semantic feature vectors; obtaining at least one candidate document identification information corresponding to the at least one third semantic feature vector; when at least one candidate document identification information includes target document identification information, obtaining at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold from the target document corresponding to the target document identification information; and generating an answer corresponding to the query statement based on at least one target document paragraph. The present application can improve the success rate of question-answering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a document-oriented question-answering method, device, electronic device, storage medium and product. Background Art

[0002] With the development of artificial intelligence technology and natural language processing technology, intelligent question-answering systems have been widely used. Usually, intelligent question-answering systems maintain a knowledge base that stores multiple documents and their document names. However, some users want to answer questions from only one or several specific documents when using them, and do not want to introduce irrelevant documents in the knowledge base. After obtaining the query statement containing the target document name input by the user, in the traditional intelligent question-answering system, the target document name is identified from the query statement, and then the target document name is matched with each document name stored in the knowledge base. If any document name matches the target document name, the corresponding target document is obtained from the knowledge base based on the document name that matches the target document name, and then the answer corresponding to the query statement is generated based on the target document.

[0003] However, the document names and questions in the query statements are combined in various grammatical forms, which are difficult to extract directly and accurately. In addition, since the document names stored in the knowledge base and the document names in the query statements may have abbreviations, when the document names in the knowledge base or the document names in the query statements are abbreviated or rewritten, the above-mentioned direct document name matching method cannot be used to query the target document from the knowledge base, and it is even more impossible to generate the answer corresponding to the query statement based on the target document, resulting in a low question and answer success rate. Summary of the invention

[0004] The embodiments of the present application provide a document-oriented question-answering method, device, electronic device, storage medium and product, which can improve the success rate of question-answering. The technical solution is as follows:

[0005] In a first aspect, a document-oriented question-answering method is provided, the method comprising:

[0006] Acquire a first semantic feature vector corresponding to a user's query statement, and acquire a plurality of second semantic feature vectors corresponding to document identification information of a plurality of source documents, wherein the query statement includes target document identification information;

[0007] Acquire, from the plurality of second semantic feature vectors, at least one third semantic feature vector having a semantic similarity with the first semantic feature vector greater than a first preset threshold;

[0008] Obtaining at least one candidate document identification information corresponding to the at least one third semantic feature vector;

[0009] Identifying whether the at least one candidate document identification information includes the target document identification information;

[0010] When the at least one candidate document identification information includes the target document identification information, obtaining, from the target document corresponding to the target document identification information, at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold;

[0011] Based on the at least one target document paragraph, an answer corresponding to the query statement is generated.

[0012] In a second aspect, a document-oriented question-answering method is provided, the method comprising:

[0013] Acquire a first semantic feature vector corresponding to a user's query statement for the electric power field, and acquire a plurality of second semantic feature vectors corresponding to document identification information of a plurality of source documents in the electric power field, wherein the query statement includes target document identification information;

[0014] Acquire, from the plurality of second semantic feature vectors, at least one third semantic feature vector having a semantic similarity with the first semantic feature vector greater than a first preset threshold;

[0015] Obtaining at least one candidate document identification information corresponding to the at least one third semantic feature vector;

[0016] Identifying whether the at least one candidate document identification information includes the target document identification information;

[0017] When the at least one candidate document identification information includes the target document identification information, obtaining, from the target document corresponding to the target document identification information, at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold;

[0018] Based on the at least one target document paragraph, an answer corresponding to the query statement is generated.

[0019] In a third aspect, a document-oriented question-answering device is provided, the device comprising:

[0020] A first acquisition module, configured to acquire a first semantic feature vector corresponding to a user's query statement, and to acquire a plurality of second semantic feature vectors corresponding to document identification information of a plurality of source documents, wherein the query statement includes target document identification information;

[0021] A second acquisition module, configured to acquire, from the plurality of second semantic feature vectors, at least one third semantic feature vector having a semantic similarity with the first semantic feature vector greater than a first preset threshold;

[0022] A third acquisition module, used to acquire at least one candidate document identification information corresponding to the at least one third semantic feature vector;

[0023] an identification module, used to identify whether the at least one candidate document identification information includes the target document identification information;

[0024] A fourth acquisition module, configured to acquire, from a target document corresponding to the target document identification information, at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold value when the at least one candidate document identification information includes the target document identification information;

[0025] A generation module is used to generate an answer corresponding to the query statement based on the at least one target document paragraph.

[0026] In a fourth aspect, a document-oriented question-answering device is provided, the device comprising:

[0027] A first acquisition module is used to acquire a first semantic feature vector corresponding to a user's query statement for the electric power field, and to acquire a plurality of second semantic feature vectors corresponding to document identification information of a plurality of source documents in the electric power field, wherein the query statement includes target document identification information;

[0028] A second acquisition module, configured to acquire, from the plurality of second semantic feature vectors, at least one third semantic feature vector having a semantic similarity with the first semantic feature vector greater than a first preset threshold;

[0029] A third acquisition module, used to acquire at least one candidate document identification information corresponding to the at least one third semantic feature vector;

[0030] an identification module, used to identify whether the at least one candidate document identification information includes the target document identification information;

[0031] A first acquisition module is configured to, when the at least one candidate document identification information includes the target document identification information, acquire, from the target document corresponding to the target document identification information, at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold;

[0032] A generation module is used to generate an answer corresponding to the query statement based on the at least one target document paragraph.

[0033] In a fifth aspect, an electronic device is provided, comprising a processor and a memory; the memory stores at least one program code; the at least one program code is used to be called and executed by the processor to implement the document-oriented question-and-answer method described in the first aspect, or the document-oriented question-and-answer method described in the second aspect.

[0034] In a sixth aspect, a computer-readable storage medium is provided, wherein at least one computer program is stored in the computer-readable storage medium, and when the at least one computer program is executed by a processor, the document-oriented question-and-answer method described in the first aspect or the document-oriented question-and-answer method described in the second aspect can be implemented.

[0035] In a seventh aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the document-oriented question-answering method described in the first aspect or the document-oriented question-answering method described in the second aspect can be implemented.

[0036] The beneficial effects of the technical solution provided by the embodiment of the present application are:

[0037] Based on the first semantic feature vector corresponding to the user's query statement and the second semantic feature vector corresponding to the document identification information of the source document, the semantic similarity between the first semantic feature vector and the second semantic feature vector is calculated, and then the candidate document identification information is selected based on the calculated semantic similarity. Since the semantic similarity can reflect the degree of semantic similarity between the query statement and the document identification information, even if the document name of the source document or the document name in the query statement is abbreviated or rewritten, the document name of the source document and the query statement are still similar in semantics. Therefore, the method provided by the embodiment of the present application can query the candidate document identification information that is semantically similar to the query statement, thereby improving the success rate of question and answer. In addition, the user's query statement will carry the target document identification information, and the number of candidate document identification information obtained based on the semantic similarity is often large. In order to improve the efficiency of question and answer and user satisfaction, after obtaining at least one candidate document identification information, the embodiment of the present application will also identify whether the target document identification information is included in the at least one candidate document identification information, and when the target document identification information is included in the at least one candidate document identification information, the target document corresponding to the target document identification information is obtained. Taking into account that the target document still includes a large number of document paragraphs, in order to further improve question-answering efficiency and user satisfaction, the similarity between each document paragraph of the target document and the query statement will be calculated, and then at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold will be selected from the various document paragraphs included in the target document, and then based on the at least one target document paragraph, an answer corresponding to the query statement will be generated. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0039] Figure 1 is a schematic diagram of a RAG link provided in an embodiment of the present application;

[0040] Figure 2 It is an architecture diagram of an intelligent question-answering system provided in an embodiment of the present application;

[0041] Figure 3 is a flowchart of a document-oriented question-answering method provided in an embodiment of the present application;

[0042] Figure 4 is a flowchart of another document-oriented question-answering method provided in an embodiment of the present application;

[0043] Figure 5 is a flowchart of another document-oriented question-answering method provided in an embodiment of the present application;

[0044] Figure 6 It is a structural diagram of a document-oriented question-answering device provided in an embodiment of the present application;

[0045] Figure 7 It is a structural diagram of a document-oriented question-answering device provided in an embodiment of the present application;

[0046] Figure 8 A structural block diagram of an electronic device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

[0047] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0048] It can be understood that the terms "each", "multiple", and "any" used in the embodiments of the present application include two or more, each refers to each of the corresponding multiple, and any refers to any one of the corresponding multiple. For example, the multiple words include 10 words, and each word refers to each of the 10 words, and any word refers to any one of the 10 words.

[0049] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0050] Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain better results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.

[0051] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0052] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, autonomous driving, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role. The solution provided in the embodiment of the present application involves natural language processing, machine learning / deep learning and other technologies of artificial intelligence, and is mainly used in intelligent question-answering systems using the RAG (Retrieval-Augmented Generation) framework. Among them, RAG refers to retrieving relevant information from an external knowledge base before using a large language model to answer questions, and prompting the large model based on the retrieved relevant information for answering questions. RAG improves the accuracy of the reasoning results of the large language model by combining information retrieval with the large language model.

[0053] Figure 1 The intelligent question answering process of the intelligent question answering system using the RAG framework is shown in FIG. Figure 1The intelligent question-answering system obtains documents in a certain field (such as electricity, medicine, etc.) in advance, identifies and parses the obtained documents, and then divides them into multiple document paragraphs, and then stores each document paragraph in the knowledge base. After obtaining the question entered by the user, the knowledge base database is searched for document paragraphs related to the question entered by the user, and then the question, related document paragraphs and prompt templates are provided to the large language model, so that the large language model can accurately answer the question entered by the user based on these document fragments, and return the answer to the user.

[0054] Figure 2 The architecture diagram of the intelligent question answering system used in the embodiment of the present application is shown in FIG. Figure 2 , the intelligent question answering system includes: a terminal 201 and a server 202.

[0055] Among them, the terminal 201 can be a smart phone, a laptop computer, a tablet computer, etc., and the embodiment of the present application does not specifically limit the product type of the terminal 201. The terminal 201 can be installed with an intelligent question and answer application, based on which a conversation between a person and a machine can be completed. Among them, the intelligent question and answer application can be an application specifically used for human-computer conversation, or it can be other applications with intelligent question and answer functions, such as social applications, browser applications, search engines, etc. with intelligent question and answer functions, and the embodiment of the present application does not specifically limit this.

[0056] Server 202 is the background server of the intelligent question and answer application. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. The embodiment of the present application does not make specific limitations on this. In order to realize intelligent question and answer, the server 202 calls and maintains a knowledge base, which can store document identification information of source documents in a certain field (such as document name, field standard name, etc.), and can also store each document paragraph segmented by the source document and its corresponding semantic feature vector, etc. The server 202 can call multiple models such as embedded models and large language models. These models can be deployed directly on the server 202 or on other servers. The server 202 can call these models by interacting with other servers.

[0057] The intelligent question-answering process based on the terminal 201 and the server 202 can be as follows: the user can input a query statement (question) on the terminal 201, and send a query request carrying the query statement through the terminal 201. After receiving the query request, the server 202 obtains the user's query statement, calls the embedding model, performs vectorization processing on the user's query statement, obtains a first semantic feature vector corresponding to the query statement, and then, based on the first semantic feature vector and the second semantic feature vector corresponding to the document identification information of each document in the knowledge base, calculates the similarity between the first semantic feature vector and the second semantic feature vector corresponding to the document identification information of each document, and obtains a second semantic feature vector corresponding to the first semantic feature vector from multiple second semantic feature vectors. The method further comprises: determining at least one third semantic feature vector whose semantic similarity between the two quantities is greater than a first preset threshold, and then identifying whether at least one candidate document identification information corresponding to the at least one third semantic feature vector includes the target document identification information in the query statement; if at least one candidate document identification information includes the target document identification information, obtaining at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold from the target document corresponding to the target document identification information, and then providing the query statement and the at least one target document paragraph to the large language model, so that the large language model summarizes the answer to the query statement from the at least one target document paragraph, and then sending the answer to the terminal 201, which provides it to the user.

[0058] For the intelligent question-answering system using the RAG framework, the accuracy of the document content in the knowledge base directly affects the question-answering results. At present, source documents obtained from different sources or at different times are added to the knowledge base, and the document names of these source documents obtained from different sources or at different times may have abbreviations, abbreviations, etc., and the target document names included in the query statements entered by the user may also have abbreviations, abbreviations, etc. When asking questions about a certain document, if the document name in the knowledge base or the document name in the query statement is abbreviated or rewritten, the above-mentioned method of direct matching of document names cannot be used to query specific documents from the knowledge base, resulting in the inability to answer specific documents, and the question-answering success rate is low. In addition, due to the large amount of redundant and erroneous information in the knowledge base, the answers may be wrong or inaccurate, and the question-answering results are not accurate enough.

[0059] To this end, an embodiment of the present application provides a document-oriented question-answering method, which identifies the user's query intent, and then finds the corresponding specific document based on the user's query intent, thereby answering the specific document. The embodiment of the present application vectorizes the user's query statement to obtain a first semantic feature vector corresponding to the query statement, and vectorizes the document identification information of the source document when constructing the knowledge base to obtain a second semantic feature vector corresponding to the document identification information of the source document. Through the vectorized processing method, the problem of mismatching due to differences in character strings such as text rewriting and abbreviations is avoided. In addition, for the candidate document identification information that is semantically related to the query statement, three paths are designed to determine the final target document, ensuring the accuracy and efficiency of the target document determination. The three designed paths can be used simultaneously, or some of the paths can be selected for use, which can be determined according to different application scenarios.

[0060] The present application embodiment provides a document-oriented question-answering method. Figure 2 The server in the smart question-answering system shown in the figure executes the embodiment of the present application as an example, see Figure 3 , the method flow provided in the embodiment of the present application includes:

[0061] 301. Obtain a first semantic feature vector corresponding to a user's query statement, and obtain multiple second semantic feature vectors corresponding to document identification information of multiple source documents.

[0062] When a user wants to get the answer to a question, the user can enter a query statement on the terminal of the intelligent question-answering system. After the terminal obtains the query statement, it sends the query statement to the server of the intelligent question-answering system. Based on the query statement, the server obtains the document paragraph related to the query statement from the knowledge base to answer, thereby providing the answer to the user. Among them, the user's query statement can be in text form or voice form. In order to enable the intelligent question-answering system to answer more accurately, the query statement may include target document identification information, which is used to find a specific document from the knowledge base. The target document identification information can be a document name, a field standard name, etc. The field standard name refers to the specifications and criteria of a certain field. For example, if a certain field is the power field, the field standard name can be a power dispatching procedure document, etc. The semantic feature vector is used to indicate the semantic attributes of a sentence, document identification information or document paragraph, which can avoid deviations caused by rewriting, abbreviation, abbreviation, etc.

[0063] After receiving the user's query statement, the first semantic feature vector corresponding to the user's query statement can be obtained by processing the query statement. In one possible implementation, the server can call the embedding model to vectorize the query statement to obtain the first semantic feature vector. By directly vectorizing the query statement, the first semantic feature vector obtained contains richer information, which improves the accuracy of subsequent matching. In another possible implementation, the server can identify the query statement, obtain the target document identification information, and then call the embedding model to process the target document identification information to obtain the first semantic feature vector. By identifying the query statement, not only can the interference of other information in the query statement be eliminated, but also the amount of calculation can be reduced and the speed of question answering can be improved. Among them, the embedding model is an embedding model, which is a model that represents high-dimensional data (such as text, pictures, videos, etc.) as points (i.e., vectors) in a continuous numerical space. The embedding model can not only reduce the dimensionality of high-dimensional data and improve the computing efficiency, but also the converted low-dimensional vector captures the semantic information of high-dimensional data, which is more meaningful than high-dimensional data. The embedding model is the core of RAG technology and the key to the application of large language models.

[0064] In the embodiment of the present application, the knowledge base is the basis of intelligent question and answer, and is the knowledge source of the answers generated by the intelligent question and answer system for user questions. To implement intelligent question and answer, the server can pre-build the knowledge base. Specifically, the construction process of the knowledge base is as follows:

[0065] 3011. Obtain multiple source documents, each source document including document identification information.

[0066] Among them, the source document is an unprocessed initial document. There are many sources of source documents, which can be obtained from the search network or from professional websites such as journals and newspapers. Each source document includes document identification information, etc. The document identification information includes the document name and can also include the name of the field standard, etc. The source document in the knowledge base can be for a certain field or for multiple fields. When the source document in the knowledge base is for a certain field, each source document can have the same field label. When the source document in the knowledge base is for multiple fields, each source document can have different field labels. Generally speaking, there can be multiple field standards in the same field. For example, documents in the power field have a common power field label, but the power generation types in the power field include thermal power generation, wind power generation, nuclear power generation, etc. Each power generation type has at least one field standard, and each field standard has different versions. Therefore, documents in the power field have different field standard names.

[0067] 3012. Call the embedding model to perform vectorization processing on the document identification information of each source document to obtain a second semantic feature vector corresponding to the document identification information of the source document.

[0068] After obtaining any source document, the embedding model can be called to vectorize the document identification information of the source document to obtain the second semantic feature vector corresponding to the document identification information of the source document. When the document identification information is the document name, the embedding model is called to vectorize the document name of the source document to obtain the second semantic feature vector corresponding to the document name of the source document, and the second semantic feature vector is used to represent the document name at the semantic level; when the document identification information is the domain standard name, the embedding model is called to vectorize the document name of the source document to obtain the second semantic feature vector corresponding to the domain standard name of the source document, and the second semantic feature vector is used to represent the domain standard name at the semantic level.

[0069] 3013. Segment each source document to obtain multiple document paragraphs of each source document.

[0070] When any source document is obtained, the source document is identified to determine the positions of multiple document paragraphs in the source document, and then the source document is segmented based on the position of each document paragraph to obtain multiple document paragraphs of the source document.

[0071] 3014. Call the embedding model to perform vectorization processing on each document paragraph of each source document to obtain a fourth semantic feature vector corresponding to each document paragraph of each source document.

[0072] 3015. Build a target knowledge base based on the document identification information of multiple source documents and their corresponding second semantic feature vectors, and the document paragraph of each source document and its corresponding fourth semantic feature vector.

[0073] By storing the document identification information of each source document and its corresponding second semantic feature vector, and the document paragraph of each source document and its corresponding fourth semantic feature vector, a target knowledge base can be constructed.

[0074] Based on the constructed target knowledge base, after obtaining the user's query statement, the second semantic feature vector corresponding to the document identification information of multiple source documents can be obtained from the knowledge base.

[0075] 302. Obtain, from the plurality of second semantic feature vectors, at least one third semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a first preset threshold.

[0076] After obtaining the first semantic feature vector and multiple second semantic feature vectors corresponding to the user's query statement, the semantic similarity between the first semantic feature vector and each second semantic feature vector can be calculated, and then based on the calculation result, at least one third semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a first preset threshold is obtained from the multiple second semantic feature vectors. The first preset threshold can be set by a technician and can be 0.6, 0.7, etc. When calculating the semantic similarity between the first semantic feature vector and any second semantic feature vector, the cosine value between the first semantic feature vector and the second semantic feature vector can be calculated, the Hamming distance between the first semantic feature vector and the second semantic feature vector can be calculated, the edit distance between the first semantic feature vector and the second semantic feature vector can be calculated, and so on.

[0077] 303. Obtain at least one candidate document identification information corresponding to at least one third semantic feature vector.

[0078] After obtaining at least one third semantic feature vector, the document identification information corresponding to each third semantic feature vector can be obtained from the knowledge base based on each third semantic feature vector as candidate document identification information. The candidate document identification information has a high semantic similarity with the query statement, but since the number of subsequent document identification information obtained is often large and the target document that the user wants to query is not located, it is necessary to determine the target document identification information from at least one candidate document identification information through subsequent steps 304~305, and then obtain the target document in a targeted manner based on the target document identification information. Optionally, in order to facilitate the management of at least one candidate document identification information, the server can add at least one candidate document identification information to a specified document list, and the subsequent identification of at least one candidate document identification information can be based on the specified document list.

[0079] 304. Identify whether at least one candidate document identification information includes target document identification information.

[0080] In the embodiment of the present application, multiple approaches can be used to identify whether at least one candidate document identification information includes the target document identification information. The specific process is as follows:

[0081] The first approach is to identify based on semantic similarity

[0082] After calculating the semantic similarity between at least one first semantic feature vector and each second semantic feature vector, at least one third semantic feature vector may be sorted in descending order of semantic similarity with the first semantic feature vector, and then the maximum semantic similarity is obtained, and the maximum semantic similarity is compared with a third preset threshold, and when the maximum semantic similarity is greater than the third preset threshold, the third semantic feature vector corresponding to the maximum semantic similarity is used as the target document identification information. The third preset threshold is greater than the first preset threshold, and the third preset threshold may be 0.8, 0.9, etc.

[0083] This approach is relatively simple to implement and easy to use. By setting a higher threshold and then filtering based on the higher threshold, the target document identification information obtained is more accurate than other candidate document identification information, which can ensure the accuracy of the question and answer.

[0084] The second approach: recognition based on a large language model

[0085] The embodiment of the present application can pre-train the first large language model and the first prompt template with training data, and the first prompt template includes a first position and a second position, and the first position and the second position are used to fill in the query statement and the document identification information respectively, to obtain the first prompt information to indicate whether the document identification information recognized by the first large language model includes the specified document identification information. With the help of the prompt engineering and the large language model, the server fills at least one candidate document identification information and the query statement into the corresponding position of the first prompt template. Specifically, the query statement can be filled into the first position of the first prompt template, and at least one candidate document identification information can be filled into the second position of the first prompt template to obtain the first prompt information, and then the first prompt information is input into the first large language model so that the first large language model can recognize whether the target document identification information is included in at least one candidate document identification information to obtain the recognition result.

[0086] For example, the first prompt template is: "You are a document name recognition expert. Based on the user's question and the provided document name, determine whether a certain document is specified in the question. If yes, output the document name, otherwise return None. + first position + second position", the question is: "According to the power dispatching regulations document, what are the principles of power grid operation?", and the candidate document names are: East Power Grid Dispatching Regulations, Shandong Wind Power Management Regulations, Shandong Power Ten Management Regulations. By filling the query statement into the first position and the candidate document name into the second position, the first prompt information is obtained as follows:

[0087] You are an expert in document name recognition. Based on the user's question and the document name provided, determine whether a certain document is specified in the question. If so, output the document name; if not, return None.

[0088] Question: "According to the power dispatching regulations document, what are the principles of power grid operation?"

[0089] The candidate document names are: "East China Power Grid Dispatching Regulations, Shandong Wind Power Management Regulations, and Shandong Electricity Ten Management Regulations."

[0090] The first prompt information obtained is input into the first language model. The first language model follows the instruction of the first prompt information and identifies "East China Power Grid Dispatching Regulations, Shandong Wind Power Management Regulations, and Shandong Electric Power Ten Management Regulations" according to the user's question "According to the electric power dispatching regulations document, what are the principles of power grid operation?" and identifies that the candidate document names do not include the target document name in the query statement.

[0091] The third approach: interacting with users

[0092] By interacting with the user, the server can enable the user to identify whether the target document identification information is included in at least one candidate document identification information, and return the identification result. Specifically, the server can send an identification request to the terminal, the identification request including at least one target document identification information, the identification request is used to request the terminal side user to identify whether the target document identification information is included in at least one candidate document identification information, and if it is included, the target document identification information is selected. As the inquiring party, the user accurately grasps the target document information to be queried. By interacting with the user, the identification result is more accurate, and the answer summarized based on the target document corresponding to the identified target identification information can better meet the user's needs, and the user satisfaction is higher.

[0093] 305. When at least one candidate document identification information includes target document identification information, obtain at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold from the target document corresponding to the target document identification information.

[0094] When it is determined through the above step 304 that at least one candidate document identification information includes the target document identification information, the server can recall the target document from the documents stored in the knowledge base based on the target document identification information. Considering that the target document includes multiple document paragraphs, some of these document paragraphs are related to the user's query statement, and some are irrelevant to the user's query statement. The document paragraphs irrelevant to the query statement are not only unhelpful for answering, but also waste computing resources and affect the speed of question answering. For this reason, after obtaining the target document, the embodiment of the present application will also recall the document paragraphs related to the query statement from the target document. When recalling the document paragraphs related to the query statement from the target document, the fourth semantic feature vector corresponding to each document paragraph of the target document can be obtained, and then the semantic similarity between the fourth semantic feature vector corresponding to each document paragraph and the first semantic feature vector is calculated. When the semantic similarity between any fourth semantic feature vector and the first semantic feature vector is higher than the second preset threshold, the document paragraph corresponding to the fourth semantic feature vector is used as the target document paragraph. By screening out at least one target document paragraph related to the query statement from the target document, the answering process is more targeted, the computing power consumption is reduced, and the speed of question answering is improved.

[0095] 306. Generate an answer corresponding to the query statement based on at least one target document paragraph.

[0096] The embodiment of the present application can pre-train the second largest language model and the second prompt template based on the training data, and the second prompt template includes a first position and a second position, the first position is used to fill in the query statement input by the user, and the second position is used to fill in the document paragraph to be summarized by the second largest language model. After the query statement and the document paragraph are filled in the corresponding positions, prompt information can be obtained, and the prompt information is used to instruct the second largest language model to summarize the answer corresponding to the query statement from the filled document paragraph. Based on the trained second largest language model and the second prompt template, after obtaining at least one target document paragraph from the target document, the server generates an answer corresponding to the query statement based on the at least one target document paragraph, including the following steps:

[0097] 3061. Sort at least one target document paragraph in descending order of similarity with the query statement.

[0098] 3062. Fill the query statement and at least one sorted target document paragraph into a second prompt template to obtain second prompt information.

[0099] The second prompt information can be obtained by filling the query statement into the first position of the second prompt template and filling at least one target document paragraph into the second position of the second prompt template. For example, the second prompt information can be: You are an answer summary expert, please summarize the answer from the target document paragraph according to the user's question.

[0100] Question: According to the power dispatching regulations, what are the principles of power grid operation?

[0101] Target document paragraph 1: The principles of power grid operation mainly include ensuring the safe, high-quality and economical operation of the power grid, promoting plant-grid coordination, and safeguarding the legitimate rights and interests of power companies.

[0102] Objective document paragraph 2: The regulations and rules governing the operation of the power grid are intended to ensure stable and reliable operation of the power system, taking into account economic efficiency and fairness.

[0103] 3063. Input the second prompt information into the second largest language model, so that the second largest language model summarizes the answer corresponding to the query statement from the sorted at least one target document paragraph.

[0104] The obtained second prompt information is input into the second largest language model. Under the instruction of the second prompt information, the second largest language model summarizes the at least one sorted target paragraph to obtain an answer corresponding to the query statement.

[0105] In another embodiment of the present application, when at least one candidate document identification information does not include the target document identification information, the server will further use the following method to obtain the answer corresponding to the query statement from each document paragraph included in the multiple source documents:

[0106] In the first step, the server obtains at least one reference document paragraph whose similarity with the query statement is higher than a third preset threshold.

[0107] The server calculates the semantic similarity between the first semantic feature vector corresponding to the query statement and the second semantic feature vector corresponding to each document paragraph of each source document included in the knowledge base, selects, in descending order of semantic similarity, a preset number of at least one second semantic feature vector whose semantic similarity with the first semantic feature vector corresponding to the query statement is higher than a third preset threshold, and based on the at least one second semantic feature vector, obtains at least one document paragraph from the knowledge base as at least one reference document paragraph.

[0108] In the second step, the server ranks at least one reference document paragraph.

[0109] The server sorts the at least one reference document paragraph in descending order of similarity with the query statement.

[0110] In the third step, the server fills the query statement and at least one sorted reference document paragraph into the second prompt template to obtain third prompt information.

[0111] The server fills the query statement into the first position of the second prompt template, and fills at least one sorted reference document paragraph into the second position of the second prompt template to obtain third prompt information.

[0112] In the fourth step, the server inputs the third prompt information into the second largest language model, so that the second largest language model summarizes the answer corresponding to the query statement from the at least one sorted reference document paragraph.

[0113] The server inputs the third prompt information into the second largest language model. Under the instruction of the third prompt information, the second largest language model summarizes the at least one sorted reference document paragraph to obtain an answer corresponding to the query statement.

[0114] The method provided in the embodiment of the present application, when the target document identification information is not included in at least one candidate document identification information, recalls reference document paragraphs with high similarity to the query statement from each document segment of each source document included in the knowledge base, and then uses prompt engineering based on these reference document paragraphs to summarize these reference document paragraphs by calling the second largest language model to obtain the answer corresponding to the query statement. Therefore, regardless of whether the document corresponding to the target document identification information is stored in the knowledge base, the answer can be provided to the user, thereby improving the question and answer success rate and user satisfaction.

[0115] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0116] Figure 4A complete document-oriented question-answering process provided by an embodiment of the application is shown. Taking the document identification information as the document name as an example, the process includes: the knowledge base includes N source documents, each of which has a document name, namely document name 1, document name 2, document name 3, ..., document name N. The document corresponding to document name 1 includes document paragraph 1, document paragraph 2 and document paragraph 3, and document name 1 and document paragraph 1, document paragraph 2 and document paragraph 3 included therein all have corresponding semantic feature vectors; the document corresponding to document name 2 includes document paragraph 1, document paragraph 2 and document paragraph 3, and document name 2 and document paragraph 1, document paragraph 2 and document paragraph 3 included therein all have corresponding semantic feature vectors; ...; the document corresponding to document name N includes document paragraph 1, document paragraph 2 and document paragraph 3, and document name N and document paragraph 1, document paragraph 2 and document paragraph 3 included therein all have corresponding semantic feature vectors. When receiving a user's question, the user's question is vectorized to obtain a semantic feature vector corresponding to the question, and then based on the semantic feature vector corresponding to the question and the semantic feature vector corresponding to each document name in the knowledge base, candidate document names whose semantic similarity between the semantic feature vector corresponding to the question is greater than a first preset threshold are recalled from the knowledge base, including document name 1, document name 2 and document name K, and then any one of path 1, path 2 and path 3 is used to identify whether the candidate document includes the specified document name. Among them, path 1 is: sorting each semantic feature vector whose semantic similarity between the semantic feature vector corresponding to the question is greater than the first preset threshold, and selecting the document name corresponding to the semantic feature vector with the maximum semantic similarity as the specified document name. Path 2: filling the question and the candidate document name into the prompt template to obtain prompt information, and then inputting the prompt information into the large language model to output the recognition result. Path 3: providing the candidate document name to the user, through interaction with the user, the user identifies whether the candidate document name includes the specified document name, and returns the recognition result. When it is determined based on any one of path 1, path 2, and path 3 that the candidate document names include the specified document name, the specified document is obtained from the knowledge base based on the specified document name, and then the similarity between the semantic feature vector corresponding to the question and the semantic feature vectors of each document paragraph included in the specified document is calculated, and based on the similarity calculation result, the specified paragraphs whose similarity with the question is greater than a second preset threshold are selected from the specified document, the specified paragraphs are sorted, and then the large language model is called to summarize the sorted specified paragraphs to obtain the answer corresponding to the question.When it is determined based on any one of path 1, path 2, and path 3 that the candidate document names do not include the specified document name, the similarity between the semantic feature vector corresponding to the question and the semantic feature vectors corresponding to the document paragraphs of each source document in the knowledge base is calculated based on the semantic feature vector corresponding to the question, and the specified paragraphs whose similarity with the question is greater than a third preset threshold are sorted, and then the large language model is called to summarize the sorted specified paragraphs to obtain the answer corresponding to the question.

[0117] The method provided in the embodiment of the present application can be applied to question-answering scenarios in various fields, and can be applied to question-answering scenarios in the power field in particular. Figure 2 The server in the smart question-answering system shown in the figure executes the embodiment of the present application as an example, see Figure 5 , the method flow provided in the embodiment of the present application includes:

[0118] 501. Obtain a first semantic feature vector corresponding to a user's query statement in the electric power field, and obtain multiple second semantic feature vectors corresponding to document identification information of multiple source documents in the electric power field.

[0119] The query statement includes target document identification information and the like.

[0120] 502. Obtain, from the plurality of second semantic feature vectors, at least one third semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a first preset threshold.

[0121] 503. Obtain at least one candidate document identification information corresponding to at least one third semantic feature vector.

[0122] 504. Identify whether at least one candidate document identification information includes target document identification information.

[0123] 505. When at least one candidate document identification information includes target document identification information, obtain at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold from the target document corresponding to the target document identification information.

[0124] 506. Generate an answer corresponding to the query statement based on at least one target document paragraph.

[0125] Although the application examples are aimed at the power field, the overall question-and-answer process can be referred to Figure 3 The embodiments shown will not be described in detail here.

[0126] Please refer to Figure 6, which shows a schematic diagram of the structure of a document-oriented question-answering device provided in an embodiment of the present application. The device can be implemented by software, hardware, or a combination of both, and becomes the whole or part of an electronic device. The device includes:

[0127] A first acquisition module 601 is used to acquire a first semantic feature vector corresponding to a user's query statement, and to acquire a plurality of second semantic feature vectors corresponding to document identification information of a plurality of source documents, wherein the query statement includes target document identification information;

[0128] A second acquisition module 602 is used to acquire, from the plurality of second semantic feature vectors, at least one third semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a first preset threshold;

[0129] A third acquisition module 603 is used to acquire at least one candidate document identification information corresponding to at least one third semantic feature vector;

[0130] An identification module 604, used to identify whether at least one candidate document identification information includes target document identification information;

[0131] A fourth acquisition module 605 is configured to acquire, from a target document corresponding to the target document identification information, at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold value when at least one candidate document identification information includes the target document identification information;

[0132] The generating module 606 is used to generate an answer corresponding to the query statement based on at least one target document paragraph.

[0133] In another embodiment of the present application, the first acquisition module 601 is used to identify the query statement, obtain the target document identification information, call the embedding model, process the target document identification information, and obtain the first semantic feature vector; or,

[0134] The first acquisition module 601 is used to call the embedding model to vectorize the query statement to obtain a first semantic feature vector.

[0135] In another embodiment of the present application, the device further includes:

[0136] The fifth acquisition module 607 is used to acquire multiple source documents, each source document includes document identification information; call the embedding model to vectorize the document identification information of each source document to obtain a second semantic feature vector corresponding to the document identification information of the source document.

[0137] In another embodiment of the present application, the identification module 604 is used to sort at least one third semantic feature vector in descending order of similarity with the first semantic feature vector; when the maximum semantic similarity is greater than a third preset threshold, the third semantic feature vector corresponding to the maximum semantic similarity is obtained, and the document identification information corresponding to the third semantic feature vector is used as the target document identification information.

[0138] In another embodiment of the present application, the recognition module 604 is used to fill at least one candidate document identification information and a query statement into the corresponding position of the first prompt template to obtain first prompt information; input the first prompt information into the first large language model so that the first large language model recognizes whether the at least one candidate document identification information includes the target document identification information to obtain a recognition result.

[0139] In another embodiment of the present application, the identification module 604 is used to send a recognition request to the user, where the recognition request includes at least one candidate document identification information, and the recognition request is used to request the user to identify whether the at least one candidate document identification information includes the target document identification information, and return the recognition result.

[0140] In another embodiment of the present application, the fourth acquisition module 605 is used to obtain the fourth semantic feature vector corresponding to each document paragraph of the target document; calculate the semantic similarity between the fourth semantic feature vector corresponding to each document paragraph and the first semantic feature vector; when the semantic similarity between any fourth semantic feature vector and the first semantic feature vector is higher than the second preset threshold, the document paragraph corresponding to the fourth semantic feature vector is used as the target document paragraph.

[0141] In another embodiment of the present application, a generation module 606 is used to sort at least one target document paragraph in descending order of similarity with the query statement; fill the query statement and the sorted at least one target document paragraph into a second prompt template to obtain second prompt information; input the second prompt information into the second largest language model so that the second largest language model summarizes the answer corresponding to the query statement from the sorted at least one target document paragraph.

[0142] In another embodiment of the present application, the device further includes:

[0143] A sixth acquisition module 608 is used to acquire, from each document paragraph included in the plurality of source documents, at least one reference document paragraph whose similarity with the query statement is higher than a third preset threshold value when at least one candidate document identification information does not include the target document identification information;

[0144] A sorting module, used for sorting at least one reference document paragraph;

[0145] A filling module, used to fill the query statement and at least one sorted reference document paragraph into the second prompt template to obtain third prompt information;

[0146] The input module is used to input the third prompt information into the second largest language model, so that the second largest language model summarizes the answer corresponding to the query statement from the at least one sorted reference document paragraph.

[0147] In another embodiment of the present application, the document identification information includes any one of a document name and a field standard name.

[0148] Please refer to Figure 7 , which shows a schematic diagram of the structure of a document-oriented question-answering device provided in an embodiment of the present application. The device can be implemented by software, hardware, or a combination of both, and becomes the whole or part of an electronic device. The device includes:

[0149] The first acquisition module 701 is used to acquire a first semantic feature vector corresponding to a user's query statement in the electric power field, and acquire multiple second semantic feature vectors corresponding to document identification information of multiple source documents in the electric power field, wherein the query statement includes target document identification information;

[0150] A second acquisition module 702 is used to acquire, from the plurality of second semantic feature vectors, at least one third semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a first preset threshold;

[0151] The third acquisition module 703 is used to acquire at least one candidate document identification information corresponding to at least one third semantic feature vector;

[0152] An identification module 704, configured to identify whether at least one candidate document identification information includes target document identification information;

[0153] A first acquisition module 705 is configured to acquire, from a target document corresponding to the target document identification information, at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold value when at least one candidate document identification information includes target document identification information;

[0154] The generating module 706 is used to generate an answer corresponding to the query statement based on at least one target document paragraph.

[0155] Figure 8 The structure block diagram of an electronic device 800 provided by an exemplary embodiment of the present application is shown. Generally, the electronic device 800 includes: a processor 801 and a memory 802 .

[0156] The processor 801 can be implemented in at least one of the following hardware forms: DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor, wherein the main processor is a processor for processing data in an awake state; and the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may also include an artificial intelligence processor, which is used to process computing operations related to machine learning.

[0157] The memory 802 may include one or more computer-readable storage media, which may be non-temporary computer-readable storage media, for example, the non-temporary computer-readable storage media may be CD-ROM (Compact Disc Read-Only Memory), ROM, RAM (Random Access Memory), magnetic tape, floppy disk and optical data storage device, etc. The computer-readable storage medium stores at least one computer program, which can implement the document-oriented question-answering method when executed.

[0158] Of course, the above electronic device may also include other components, such as input / output interface, communication component, etc. The input / output interface provides an interface between the processor and the peripheral interface module, and the above peripheral interface module may be an output device, an input device, etc. The communication component is configured to facilitate wired or wireless communication between the electronic device and other devices.

[0159] Those skilled in the art will understand that Figure 8 The structure shown in the figure does not constitute a limitation on the electronic device 800, and may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.

[0160] An embodiment of the present application provides a computer-readable storage medium, in which at least one computer program is stored. When the at least one computer program is executed by a processor, the above-mentioned document-oriented question-and-answer method can be implemented.

[0161] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it can implement the above-mentioned document-oriented question and answer method.

[0162] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0163] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that 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 document-oriented question-answering method, characterized in that: The method comprises: Acquire a first semantic feature vector corresponding to a user's query statement, and acquire multiple second semantic feature vectors corresponding to document identification information of multiple source documents from a knowledge base, wherein the query statement includes target document identification information, the knowledge base corresponds to at least one field, each source document has a field label, and the document identification information includes a field standard name; Acquire, from the plurality of second semantic feature vectors, at least one third semantic feature vector having a semantic similarity with the first semantic feature vector greater than a first preset threshold; Obtaining at least one candidate document identification information corresponding to the at least one third semantic feature vector; Identifying whether the at least one candidate document identification information includes the target document identification information; When the at least one candidate document identification information includes the target document identification information, obtaining at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold from the target document corresponding to the target document identification information; and generating an answer corresponding to the query statement based on the at least one target document paragraph; When the at least one candidate document identification information does not include the target document identification information, obtaining at least one reference document paragraph whose similarity with the query statement is higher than a third preset threshold from each document paragraph included in the multiple source documents; sorting the at least one reference document paragraph; filling the query statement and the at least one sorted reference document paragraph into a second prompt template to obtain third prompt information; and inputting the third prompt information into a second large language model so that the second large language model summarizes the answer corresponding to the query statement from the at least one sorted reference document paragraph.

2. The method according to claim 1, characterized in that The step of obtaining a first semantic feature vector corresponding to the user's query statement includes: Identify the query statement to obtain the target document identification information, call the embedding model, process the target document identification information, and obtain the first semantic feature vector; or, The embedding model is called to vectorize the query statement to obtain the first semantic feature vector.

3. The method according to claim 1, characterized in that Before obtaining a plurality of second semantic feature vectors corresponding to the document identification information of a plurality of source documents, the method further includes: Acquire multiple source documents, each source document including document identification information; The embedding model is called to perform vectorization processing on the document identification information of each source document to obtain a second semantic feature vector corresponding to the document identification information of the source document.

4. The method according to claim 1, characterized in that The identifying whether the at least one candidate document identification information includes the target document identification information comprises: sorting the at least one third semantic feature vector in descending order of similarity with the first semantic feature vector; When the maximum semantic similarity is greater than a third preset threshold, a third semantic feature vector corresponding to the maximum semantic similarity is obtained, and document identification information corresponding to the third semantic feature vector is used as the target document identification information.

5. The method according to claim 1, characterized in that The identifying whether the at least one candidate document identification information includes the target document identification information comprises: Filling the at least one candidate document identification information and the query statement into corresponding positions of the first prompt template to obtain first prompt information; The first prompt information is input into a first large language model, so that the first large language model identifies whether the at least one candidate document identification information includes the target document identification information, and obtains a recognition result.

6. The method according to claim 1, characterized in that The identifying whether the at least one candidate document identification information includes the target document identification information comprises: A recognition request is sent to the user, the recognition request including the at least one candidate document identification information, the recognition request being used to request the user to identify whether the at least one candidate document identification information includes the target document identification information, and return a recognition result.

7. The method according to claim 1, characterized in that The step of acquiring, from the target document corresponding to the target document identification information, at least one target document paragraph having a similarity with the query statement higher than a second preset threshold, comprises: Obtaining a fourth semantic feature vector corresponding to each document paragraph of the target document; Calculating the semantic similarity between the fourth semantic feature vector corresponding to each document paragraph and the first semantic feature vector; When the semantic similarity between any fourth semantic feature vector and the first semantic feature vector is higher than a second preset threshold, the document paragraph corresponding to the fourth semantic feature vector is used as the target document paragraph.

8. The method according to claim 1, characterized in that The step of generating an answer corresponding to the query statement based on the at least one target document paragraph includes: Sorting the at least one target document paragraph in descending order of similarity with the query statement; Filling the query statement and at least one sorted target document paragraph into a second prompt template to obtain second prompt information; The second prompt information is input into the second largest language model, so that the second largest language model summarizes the answer corresponding to the query statement from the sorted at least one target document paragraph.

9. The method according to any one of claims 1 to 8, characterized in that The document identification information also includes a document name.

10. A document-oriented question-answering method, characterized in that: The method comprises: Acquire a first semantic feature vector corresponding to a user's query statement for the electric power field, and acquire multiple second semantic feature vectors corresponding to document identification information of multiple source documents in the electric power field from a knowledge base, wherein the query statement includes target document identification information, the knowledge base corresponds to at least one field, each source document has a field label, and the document identification information includes a field standard name; Acquire, from the plurality of second semantic feature vectors, at least one third semantic feature vector having a semantic similarity with the first semantic feature vector greater than a first preset threshold; Obtaining at least one candidate document identification information corresponding to the at least one third semantic feature vector; Identifying whether the at least one candidate document identification information includes the target document identification information; When the at least one candidate document identification information includes the target document identification information, obtaining at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold from the target document corresponding to the target document identification information; and generating an answer corresponding to the query statement based on the at least one target document paragraph; When the at least one candidate document identification information does not include the target document identification information, obtaining at least one reference document paragraph whose similarity with the query statement is higher than a third preset threshold from each document paragraph included in the multiple source documents; sorting the at least one reference document paragraph; filling the query statement and the at least one sorted reference document paragraph into a second prompt template to obtain third prompt information; and inputting the third prompt information into a second large language model so that the second large language model summarizes the answer corresponding to the query statement from the at least one sorted reference document paragraph.

11. A document-oriented question-answering device, characterized in that: The device comprises: A first acquisition module is used to acquire a first semantic feature vector corresponding to a user's query statement, and acquire a plurality of second semantic feature vectors corresponding to document identification information of a plurality of source documents from a knowledge base, wherein the query statement includes target document identification information, the knowledge base corresponds to at least one field, each source document has a field label, and the document identification information includes a field standard name; A second acquisition module, configured to acquire, from the plurality of second semantic feature vectors, at least one third semantic feature vector having a semantic similarity with the first semantic feature vector greater than a first preset threshold; A third acquisition module, used to acquire at least one candidate document identification information corresponding to the at least one third semantic feature vector; an identification module, used to identify whether the at least one candidate document identification information includes the target document identification information; A fourth acquisition module, configured to acquire, from a target document corresponding to the target document identification information, at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold value when the at least one candidate document identification information includes the target document identification information; A generating module, configured to generate an answer corresponding to the query statement based on the at least one target document paragraph; a sixth acquisition module, configured to acquire, from each document paragraph included in the plurality of source documents, at least one reference document paragraph whose similarity with the query statement is higher than a third preset threshold value when the at least one candidate document identification information does not include the target document identification information; A sorting module, used to sort the at least one reference document paragraph; A filling module, used to fill the query statement and at least one sorted reference document paragraph into the second prompt template to obtain third prompt information; An input module is used to input the third prompt information into the second largest language model, so that the second largest language model summarizes the answer corresponding to the query statement from at least one sorted reference document paragraph.

12. A document-oriented question-answering device, characterized in that: The device comprises: A first acquisition module is used to acquire a first semantic feature vector corresponding to a user's query statement for the electric power field, and to acquire a plurality of second semantic feature vectors corresponding to document identification information of a plurality of source documents in the electric power field from a knowledge base, wherein the query statement includes target document identification information, the knowledge base corresponds to at least one field, each source document has a field label, and the document identification information includes a field standard name; A second acquisition module, configured to acquire, from the plurality of second semantic feature vectors, at least one third semantic feature vector having a semantic similarity with the first semantic feature vector greater than a first preset threshold; A third acquisition module, used to acquire at least one candidate document identification information corresponding to the at least one third semantic feature vector; an identification module, used to identify whether the at least one candidate document identification information includes the target document identification information; A first acquisition module is configured to, when the at least one candidate document identification information includes the target document identification information, acquire, from the target document corresponding to the target document identification information, at least one target document paragraph whose similarity with the query statement is higher than a second preset threshold; A generating module, configured to generate an answer corresponding to the query statement based on the at least one target document paragraph; The device is also used to, when the at least one candidate document identification information does not include the target document identification information, obtain at least one reference document paragraph whose similarity with the query statement is higher than a third preset threshold from each document paragraph included in the multiple source documents; sort the at least one reference document paragraph; fill the query statement and the sorted at least one reference document paragraph into a second prompt template to obtain third prompt information; and input the third prompt information into a second large language model so that the second large language model summarizes the answer corresponding to the query statement from the sorted at least one reference document paragraph.

13. An electronic device, characterized in that: It comprises a processor and a memory; the memory stores at least one program code; the at least one program code is used to be called and executed by the processor to implement the document-oriented question-answering method as described in any one of claims 1 to 9, or the document-oriented question-answering method as described in claim 10.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and when the at least one computer program is executed by a processor, it can implement the document-oriented question-answering method as described in any one of claims 1 to 9, or the document-oriented question-answering method as described in claim 10.

15. A computer program product, characterized in that The computer program product includes a computer program, and when the computer program is executed by a processor, it can implement the document-oriented question-answering method according to any one of claims 1 to 9, or the document-oriented question-answering method according to claim 10.

Citation Information

Patent Citations

  • Document processing method, device and equipment in network disk

    CN116561255A

  • Question and answer method and device, equipment and medium

    CN117236340A

  • Knowledge question-answering method and device, equipment and storage medium

    CN117573821A

  • Document-oriented knowledge question and answer method, device and equipment and medium

    CN117786066A