Document processing method, knowledge retrieval method and equipment for multiple knowledge bases
By training embedded models for multi-knowledge bases and generating document vectors and problem vectors, the problem of inaccuracy in cross-knowledge base queries is solved, and the accuracy and efficiency of retrieval is improved.
Patent Information
- Application Number
- CN202411998249.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-02-07
AI Technical Summary
In cross-knowledge base query, the information found is not accurate enough to effectively solve business problems. The main reasons include inaccurate data mapping, failure to distinguish the importance of the knowledge base, differences in scoring criteria, and insufficient vector similarity comparison.
By training corresponding embedding models for each knowledge base separately, and using these embedding models to generate document vectors and business problems for knowledge documents, we ensure the accuracy of vector similarity comparison.
Improve the accuracy of knowledge document retrieval and ensure that the retrieved knowledge document can effectively answer business questions.
Smart Images

Figure CN119396959A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a document processing method, a knowledge retrieval method and a device for multiple knowledge bases. Background Art
[0002] In order to effectively manage and utilize various types of data, different knowledge bases are usually built for different categories of data. For example, some large enterprises may have multiple knowledge bases such as product knowledge base, customer service knowledge base, technical document base, training material base, etc. Although this distributed data management method is conducive to the professional development of various fields, it also brings about the problem of information islands, resulting in the need for cross-knowledge base queries to solve a business problem in actual business scenarios. For example, when customer service staff handle customer inquiries, they need to query data from multiple knowledge bases such as product descriptions, troubleshooting solutions, and service data at the same time.
[0003] Currently, in this cross-knowledge base query solution, the queried information is not accurate enough, and after integrating the information queried from various knowledge bases, it cannot effectively solve business problems. Summary of the invention
[0004] In view of this, the present disclosure provides a document processing method, a knowledge retrieval method, an electronic device, a computer-readable storage medium and a computer program product for multiple knowledge bases, which can improve the retrieval accuracy.
[0005] In a first aspect, the present disclosure provides a document processing method for multiple knowledge bases, which is applied to an initialization module in a knowledge base retrieval system, wherein different knowledge bases in the multiple knowledge bases are used to store knowledge documents of different categories; the method comprises: In response to receiving the initialization instruction, selecting a corresponding embedding model for each of the knowledge bases, wherein, for any of the knowledge bases, the embedding model corresponding to the knowledge base is obtained by training based on knowledge documents of a specified category, the specified category is the same as the category of knowledge documents stored in the knowledge base, and different knowledge bases have different corresponding embedding models; For any of the knowledge bases, use the embedding model corresponding to the knowledge base to generate a document vector for the knowledge document in the knowledge base, and save the document vector.
[0006] In a second aspect, the present disclosure provides a knowledge retrieval method for multiple knowledge bases, which is applied to a retrieval module in a knowledge base retrieval system, wherein the knowledge documents in the multiple knowledge bases are processed based on the above document processing method; the method comprises: Receive business questions to be answered; For any of the knowledge bases, use the embedding model corresponding to the knowledge base to generate a question vector for the business question, and at least compare the question vector with the document vector in the knowledge base for vector similarity to obtain a relevance score between the business question and each knowledge document in the knowledge base; According to the relevance score, target knowledge documents for answering the business question are screened from each of the knowledge bases.
[0007] In a third aspect, the present disclosure provides a document processing device for multiple knowledge bases, the device comprising: A model selection module, configured to select corresponding embedding models for each of the knowledge bases in response to receiving an initialization instruction, wherein, for any of the knowledge bases, the embedding model corresponding to the knowledge base is obtained by training based on knowledge documents of a specified category, the specified category is the same as the category of knowledge documents stored in the knowledge base, and different knowledge bases have different corresponding embedding models; The vector generation module is used to generate a document vector for the knowledge document in any of the knowledge bases using the embedding model corresponding to the knowledge base, and save the document vector.
[0008] In a fourth aspect, the present disclosure provides a knowledge retrieval device for multiple knowledge bases, the device comprising: Question receiving module, receiving business questions to be answered; A relevance score calculation module, for generating a question vector for the business question using the embedding model corresponding to the knowledge base for any of the knowledge bases, and performing at least a vector similarity comparison between the question vector and the document vector in the knowledge base to obtain a relevance score between the business question and each knowledge document in the knowledge base; The document retrieval module is used to screen target knowledge documents for answering the business questions from each of the knowledge bases according to the relevance scores.
[0009] In a fifth aspect, the present disclosure provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the above method by executing the computer instructions.
[0010] In a sixth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the above method.
[0011] In a seventh aspect, the present disclosure provides a computer program product, including computer instructions, and the computer instructions are used to enable a computer to execute the above method.
[0012] In the technical solutions of some embodiments of the present disclosure, when cross-knowledge base retrieval is performed in multiple knowledge bases, on the one hand, the corresponding embedding models are trained for each knowledge base respectively, and the embedding models corresponding to each knowledge base are used to generate document vectors for knowledge documents in the corresponding knowledge base. In this way, there is no need to map the knowledge documents in all knowledge bases to the same vector space, thereby ensuring the accuracy of the generated document vectors; on the other hand, when receiving business questions, the corresponding embedding models of each knowledge base are used to generate question vectors for the business questions respectively, so that the question vector and the document vector are located in the same vector space, thereby ensuring the accuracy of the vector similarity comparison. When the document vector is relatively accurate and the vector similarity comparison accuracy is relatively high, the accuracy of knowledge document retrieval can be greatly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0014] Figure 1 is a flowchart of a document processing method provided by some embodiments of the present disclosure; Figure 2 is a flowchart of a knowledge retrieval method provided by an embodiment of the present disclosure; Figure 3 A document processing device for multiple knowledge bases provided by an embodiment of the present disclosure; Figure 4 A knowledge retrieval device for multiple knowledge bases provided by an embodiment of the present disclosure; Figure 5 It is a schematic diagram of the structure of an electronic device provided by some embodiments of the present disclosure. DETAILED DESCRIPTION
[0015] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0016] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0017] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.
[0018] Herein, unless explicitly stated, executing a step “in response to A” does not mean executing the step immediately after “A” but may include one or more intermediate steps.
[0019] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition, use, storage or deletion of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0020] It is understandable that before using the technical solutions disclosed in the various embodiments of the present disclosure, the types, scopes of use, usage scenarios, etc. of the information involved in the present disclosure should be informed to relevant users and their authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations. The relevant users may include any type of right holders, such as individuals, enterprises, and groups.
[0021] For example, in response to receiving an active request from a user, a prompt message is sent to the relevant user to clearly prompt the relevant user that the operation requested to be performed will require obtaining and using the information of the relevant user, so that the relevant user can independently choose whether to provide information to software or hardware such as an electronic device, application, server or storage medium that executes the operation of the technical solution of the present disclosure based on the prompt message.
[0022] As an optional but non-limiting implementation, in response to receiving an active request from a relevant user, a prompt message is sent to the relevant user, for example, in the form of a pop-up window, in which the prompt message may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to select "agree" or "disagree" to provide information to the electronic device.
[0023] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0024] In some cross-knowledge base query solutions, the data in all knowledge bases can be mapped to the same vector space in advance. When receiving a business question to be answered, the business question is mapped to the same vector space as the knowledge base data, and then the knowledge base data related to the business question is retrieved based on the vector similarity comparison results between the business question and the knowledge base data. Based on the retrieved knowledge base data, answers to business questions can be generated. At present, the problem with these technologies is that the retrieved knowledge base data is not accurate enough, resulting in the generated answers not being able to effectively answer business questions. After analysis, it was found that the reasons for this problem are as follows: 1) When mapping knowledge base data to vector space, all knowledge bases share the same embedding model (also known as Embedding model), which results in inaccurate data mapping. Specifically, in cross-knowledge base query scenarios, different knowledge bases store different categories of data, and different categories of data may have different data features. When all knowledge bases share the same embedding model, the embedding model is often trained based on data from general or specific fields. However, the data features of general or specific fields may not be able to represent the data features in each knowledge base. Therefore, when using the trained embedding model to map the data in each knowledge base to the vector space, there will be an inaccurate mapping problem, which in turn results in the retrieved knowledge base data being inaccurate when retrieving knowledge base data related to business problems.
[0025] 2) Failure to distinguish the importance of knowledge bases may result in the knowledge base data with high relevance to business problems being ignored, and the knowledge base data with low relevance to business problems being focused on. For example, suppose knowledge base A is used to store product descriptions, knowledge base B is used to store product troubleshooting solutions, and knowledge base C is used to store service data. If the business question is "What functions does the product have?", in the process of answering the business question, it may be necessary to use the data in knowledge base A as the key reference data, and the data in knowledge bases B and C as auxiliary reference data. For another example, if the business question is "What should I do if the product cannot be started?", in the process of answering the business question, it may be necessary to use the data in knowledge base B as the key reference data, and the data in knowledge bases A and C as auxiliary reference data. If the importance of knowledge bases is not distinguished, it is likely that the following situation will occur: insufficient data will be screened from knowledge bases that need to be focused on, and too much data will be screened from knowledge bases that only need to be used as auxiliary references. In this way, the retrieved knowledge base data is not accurate enough.
[0026] 3) Usually, when retrieving data related to business problems from various knowledge bases, the retrieved data will be scored. The score is used to characterize the relevance of the data to the business problem. For example, data with a high relevance to the business problem can have a high score, and data with a low relevance to the business problem can have a low score. Based on the score, data with a high relevance to the business problem can be filtered to generate answers to the business problem. However, in some technologies, the scoring criteria of different knowledge bases are different, resulting in different relevance of data with the same score filtered from different knowledge bases to the business problem. For example, the score of data a retrieved from knowledge base A and data b retrieved from knowledge base B are both 68 points, but the scoring criteria of knowledge base A and knowledge base B are different. Therefore, it is possible that the relevance of data a and data b to the business problem is not the same. This will also cause the problem that the retrieved knowledge base data is not accurate enough.
[0027] 4) Based on the vector similarity comparison between business problems and knowledge base data, among multiple data retrieved from the same knowledge base with the same relevance to business problems, different data have different reference values for solving business problems. For example, suppose that knowledge base A stores multiple versions of product descriptions. When the business problem is "What functions does the product have?", based on the vector similarity comparison between the business problem and the knowledge base data, these multiple versions of product descriptions may have the same relevance to the business problem, but in fact, the latest version of the product description should have a higher relevance to the business problem, and the historical version of the product description should have a lower relevance to the business problem. For another example, suppose that knowledge base B stores the official fault solution of the product and the fault solution discussed by users. When the business problem is "The product cannot be started, how to solve it?", based on the vector similarity comparison between the business problem and the knowledge base data, the official fault solution for the product cannot be started and the fault solution for the product cannot be started discussed by users may have the same relevance to the business problem, but in fact, the official fault solution should have a higher relevance to the business problem, and the fault solution discussed by users should have a lower relevance to the business problem. Therefore, the retrieved knowledge base data is not accurate enough based only on the vector similarity comparison between business questions and knowledge base data.
[0028] Based on the above reasons, in some cross-knowledge base query schemes, there are still situations where the retrieved knowledge base data is not accurate enough and cannot answer business questions. In view of this, the present disclosure first provides a document processing method for multiple knowledge bases, which can improve retrieval accuracy. Specifically, in multiple knowledge bases, different knowledge bases are used to save knowledge documents of different categories. For example, knowledge base A1 is used to save product description documents, knowledge base B1 is used to save product troubleshooting documents, and knowledge base C1 is used to save product daily maintenance documents. For another example, knowledge base A2 is used to save knowledge documents related to network communications, knowledge base B2 is used to save knowledge documents related to electronic circuits, and knowledge base C2 is used to save knowledge documents related to artificial intelligence. In actual applications, the categories of knowledge documents that need to be saved in each knowledge base can be divided according to actual conditions, and the present disclosure does not limit this.
[0029] It should be noted that in some embodiments of the present disclosure, knowledge documents may include documents in various forms such as text documents, pictures, videos, audios, etc., and are not limited to text documents.
[0030] The document processing method can be applied to the initialization module in the knowledge base retrieval system, or can be applied to the electronic device running the knowledge base retrieval system. The electronic device includes but is not limited to a tablet computer, a laptop computer, a desktop computer, a server, etc. Figure 1, which is a flowchart of a document processing method provided in some embodiments of the present disclosure. Figure 1 In the document processing method, the document processing method includes the following steps: Step S101, in response to receiving an initialization instruction, select a corresponding embedding model for each knowledge base, wherein, for any knowledge base, the embedding model corresponding to the knowledge base is trained based on knowledge documents of a specified category, the specified category is the same as the category of knowledge documents stored in the knowledge base, and different knowledge bases have different corresponding embedding models.
[0031] Specifically, the knowledge base retrieval system may include a human-computer interaction interface. An initialization instruction may be received through the human-computer interaction interface. For example, in response to an initialization button in the human-computer interaction interface being triggered, it indicates that the initialization instruction has been received.
[0032] In this embodiment, a suitable initial embedding model can be selected for each knowledge base based on the category of knowledge documents stored in each knowledge base. For example, assuming that knowledge base A2 is used to store knowledge documents related to network communication, and the knowledge documents in knowledge base A2 only include text documents, then an embedding model that supports text document processing can be selected as the initial embedding model corresponding to knowledge base A2. For another example, assuming that knowledge base B2 is used to store knowledge documents related to electronic circuits, and the knowledge documents in knowledge base B2 include pictures and text documents, then an embedding model that supports text document processing and picture processing can be selected as the initial embedding model corresponding to knowledge base B2.
[0033] After completing the selection of the initial embedding model, you can select appropriate training data for the initial embedding model corresponding to each knowledge base based on the knowledge document categories stored in each knowledge base to perform model training, and obtain the embedding model corresponding to each knowledge base. For example, for the initial embedding model corresponding to the above-mentioned knowledge base A2, you can select text documents related to network communication as the main training documents, train the initial embedding model, and obtain the embedding model corresponding to the knowledge base A2. For another example, for the initial embedding model corresponding to the above-mentioned knowledge base B2, you can select text documents and pictures related to electronic circuits as the main training documents, train the initial embedding model, and obtain the embedding model corresponding to the knowledge base B2.
[0034] In some other embodiments, a corresponding embedding model may be selected for each knowledge base from a plurality of trained embedding models.
[0035] Step S102: for any knowledge base, using the embedding model corresponding to the knowledge base, generating a document vector for the knowledge document in the knowledge base, and saving the document vector.
[0036] Specifically, each embedding model trained according to the method in step S101 can match the category of knowledge documents stored in the corresponding knowledge base, and different knowledge bases correspond to different embedding models. Therefore, the knowledge documents in different knowledge bases can be mapped to their respective corresponding vector spaces. Different knowledge bases can correspond to different vector spaces. In this way, the document vectors generated for the knowledge documents in the knowledge base can be relatively accurate. When the document vectors are relatively accurate, when the business problem and the knowledge document are compared for vector similarity, the retrieved knowledge documents related to the business problem can be relatively accurate, and then, the answers to the questions generated based on the retrieved knowledge documents can effectively solve the business problem.
[0037] Specifically, after each knowledge document in the knowledge base is processed by the embedding model, its corresponding document vector can be obtained. After being processed by the embedding model, the document can be obtained The corresponding document vector , the process can be shown as expression (1): (1) The document vector of each knowledge document can be saved in a specified database, such as the milvus database or the elasticsearch database.
[0038] Furthermore, in some embodiments, when saving a document vector, a vector index may be constructed for the document vector according to preset index construction parameters, wherein the index construction parameters are used to specify at least one of the following information: the type of the vector index and the dimension of the document vector.
[0039] Specifically, the vector index is an index structure with the document vector as the key. Based on the vector index, the document vector can be quickly found and located. In this way, when the business question is compared with the document vector for similarity, the comparison efficiency can be greatly improved.
[0040] In this embodiment, the database for storing document vectors may include a vector search engine. When the electronic device executing the document processing method of the present disclosure stores document vectors in the database, it may build a vector index by calling the vector search engine of the database.
[0041] In summary, in the technical solutions of some embodiments of the present disclosure, by training corresponding embedding models for each knowledge base respectively, knowledge documents in different knowledge bases can be mapped to their respective corresponding vector spaces, thereby ensuring the accuracy of the generated document vectors. In this way, when the business problem and the knowledge document are compared for vector similarity, the retrieved knowledge documents related to the business problem can be relatively accurate, thereby achieving the purpose of improving the retrieval accuracy.
[0042] According to Figure 1 After the document processing method shown in the figure processes the knowledge documents in the multiple knowledge bases, the knowledge retrieval method for the multiple knowledge bases provided by the present disclosure can be executed. The knowledge retrieval method can be applied to the retrieval module in the knowledge base retrieval system, or can be applied to the electronic device running the knowledge base retrieval system. The electronic device includes but is not limited to a tablet computer, a laptop computer, a desktop computer, a server, etc. Figure 2 , which is a flow chart of a knowledge retrieval method provided by an embodiment of the present disclosure. Figure 2 In the knowledge retrieval method, the following steps are included: Step S201: receiving a business question to be answered.
[0043] Specifically, the electronic device executing the knowledge retrieval method of the present disclosure may display a question input interface through which a business question to be answered input by a user may be received.
[0044] Alternatively, the electronic device executing the knowledge retrieval method of the present disclosure may be connected to other devices for communication, and may receive business questions that need to be answered and are sent by other devices.
[0045] Of course, the manner of receiving business questions may not be limited to the above two manners, and the present disclosure does not limit the specific manner of receiving business questions.
[0046] Step S202, for any knowledge base, use the embedding model corresponding to the knowledge base to generate a question vector for the business problem, and at least compare the question vector with the document vector in the knowledge base for vector similarity to obtain the relevance score between the business problem and each knowledge document in the knowledge base.
[0047] For example, assume that knowledge base A1 corresponds to embedding model a1, and knowledge base B1 corresponds to embedding model b1. Then, embedding model a1 can be used to generate question vector q11 for the business problem, and then the question vector q11 is compared with the document vectors of each knowledge document in knowledge base A1 for vector similarity, and the obtained similarity score is used as the relevance score between the business problem and each knowledge document in knowledge base A1. Also, embedding model b1 can be used to generate question vector q12 for the business problem, and then the question vector q12 is compared with the document vectors of each knowledge document in knowledge base B1 for vector similarity, and the obtained similarity score is used as the relevance score between the business problem and each knowledge document in knowledge base B1. By using the embedding model corresponding to each knowledge base to generate a question vector for the business problem, and then comparing the question vector with the document vector in the corresponding knowledge base for vector similarity, it can be ensured that the question vector and the document vector are in the same vector space, thereby improving the reliability and accuracy of the similarity comparison.
[0048] Specifically, the vector similarity between the question vector and the document vector can be measured by the cosine similarity between the question vector and the document vector. The higher the cosine similarity score between the question vector and the document vector, the higher the vector similarity between the question vector and the document vector. The lower the cosine similarity score between the question vector and the document vector, the lower the vector similarity between the question vector and the document vector. The calculation formula of cosine similarity can be shown as expression (2): (2) in, is the document vector, is the problem vector, is the modulus of the document vector, is the modulus of the problem vector, Score the cosine similarity between the question vector and the document vector.
[0049] In this embodiment, the cosine similarity score between the question vector and the document vector may be used as the relevance score between the business question and the knowledge document.
[0050] Step S203: Filter target knowledge documents for answering business questions from various knowledge bases based on the relevance scores.
[0051] In this embodiment, for any knowledge document in any knowledge base, if the relevance score of the knowledge document to the business problem is higher than the score threshold, the knowledge document can be used as a target knowledge document.
[0052] After the target knowledge document is obtained, content for answering the business question may be extracted from at least part of the target knowledge document.
[0053] In summary, in the technical solutions of some embodiments of the present disclosure, when cross-knowledge base retrieval is performed in multiple knowledge bases, on the one hand, the corresponding embedding models are trained for each knowledge base respectively, and the embedding models corresponding to each knowledge base are used to generate document vectors for the knowledge documents in the corresponding knowledge base. In this way, there is no need to map the knowledge documents in all knowledge bases to the same vector space, thereby ensuring the accuracy of the generated document vectors; on the other hand, when receiving business questions, the embedding models corresponding to each knowledge base are used to generate question vectors for the business questions respectively, so that the question vector and the document vector are located in the same vector space, thereby ensuring the accuracy of the vector similarity comparison. When the document vector is relatively accurate and the vector similarity comparison accuracy is relatively high, the accuracy of knowledge document retrieval can be greatly improved.
[0054] The knowledge retrieval method is further introduced below in conjunction with other embodiments of the present disclosure.
[0055] In some embodiments, at least performing vector similarity comparison between the question vector and the document vector in the knowledge base in step S202 to obtain the relevance score between the business question and each knowledge document in the knowledge base may include: The result of the vector similarity comparison is used as the first relevance score between the business question and each knowledge document in the knowledge base; Compare the business problem with each knowledge document in the knowledge base according to one or more other comparison dimensions except the vector similarity comparison to obtain one or more second relevance scores between the business problem and each knowledge document in the knowledge base; The first relevance score and the second relevance score are integrated to obtain the relevance score between the business question and each knowledge document in the knowledge base.
[0056] In these embodiments, in addition to comparing the business questions with the knowledge base by vector similarity, one or more other comparison dimensions are also included. By integrating the relevance scores under multiple comparison dimensions, the shortcomings of vector similarity comparison can be compensated and the retrieval accuracy of knowledge documents can be improved.
[0057] Specifically, in some embodiments, other comparison dimensions may include a question keyword comparison dimension and a document attribute comparison dimension. In the keyword comparison dimension, the one or more second relevance scores between the business question and each knowledge document in the knowledge base may include: Extract key words from business problems; The question keywords are searched in each knowledge document in the knowledge base, and a second relevance score between the business question and each knowledge document in the knowledge base is obtained according to the search result.
[0058] Specifically, the problem keywords can be searched in each knowledge document based on algorithms such as TF-IDF or BM25, and the second relevance score between the business problem and each knowledge document can be determined based on the search results. For example, the more problem keywords appear in a knowledge document, the higher the relevance to the business problem can be, and the corresponding second relevance score can also be higher.
[0059] In the document attribute comparison dimension, the one or more second relevance scores between the business question and each knowledge document in the knowledge base may include: Obtain document attribute information of each knowledge document in the knowledge base; According to the preset matching logic, the matching degree between the document attribute information and the business question is determined, and a second relevance score between the business question and each knowledge document in the knowledge base is obtained.
[0060] Specifically, the document attribute information may include but is not limited to metadata, document tags, timestamps, etc. of the knowledge document. For any knowledge document, if the document attribute information of the knowledge document meets the preset matching logic with the business question, the knowledge document may have a higher relevance to the business question, and the corresponding second relevance score may also be higher.
[0061] For example, document attribute information may include the document version of a knowledge document, and the corresponding matching logic may be: for any knowledge document, the higher the document version of the knowledge document, the higher the relevance of the knowledge document to the business problem. In this way, when there are multiple versions of knowledge documents in the knowledge base, the relevance of the old version of the knowledge document to the business problem can be effectively reduced, and the relevance of the new version of the knowledge document to the business problem can be increased.
[0062] For another example, the document attribute information may include the document tag of the knowledge document, and the corresponding matching logic may be: for any knowledge document, if the knowledge category represented by the document tag of the knowledge document matches the problem category of the business problem, then the relevance of the knowledge document to the business problem may be higher; conversely, if the knowledge category represented by the document tag of the knowledge document does not match the problem category of the business problem, then the relevance of the knowledge document to the business problem may be lower.
[0063] The above is only an exemplary description of the matching logic. In practical applications, the matching logic can be configured according to actual needs, and this application does not limit this.
[0064] In some embodiments, the first relevance score and each second relevance score have their own corresponding score weights, where the score weights can be understood as the weights of the comparison dimensions, for example, the score weight of the first relevance score obtained based on the vector similarity comparison can be 0.7, the score weight of the second relevance score obtained based on the question keyword comparison can be 0.1, and the score weight of the second relevance score obtained based on the document attribute comparison dimension can be 0.2.
[0065] The above fusion of the first relevance score and the second relevance score to obtain the relevance score between the business question and each knowledge document in the knowledge base may include: Modifying the first relevance score according to the score weight corresponding to the first relevance score, and modifying the second relevance score according to the score weight corresponding to the second relevance score; Based on the corrected first relevance score and the second relevance score, a relevance score between the business question and each knowledge document in the knowledge base is obtained.
[0066] Specifically, each relevance score can be multiplied by the corresponding score weight to obtain a modified relevance score, and then the modified relevance scores can be added together to obtain the final relevance score between the business question and each knowledge document in the knowledge base. This process can be shown as expression (3): (3) in, represents the final relevance score between the business question and the i-th knowledge document, represents the second relevance score between the business question and the i-th knowledge document based on the comparison of the question keywords. represents the second relevance score between the business question and the i-th knowledge document based on the document attributes. represents the first relevance score obtained by comparing the business problem with the i-th knowledge document based on vector similarity. express The score weight of express The score weight of express The score weight of .
[0067] According to the score weights, the relevance scores of business problems and knowledge documents in different comparison dimensions are corrected. The weights of different comparison dimensions can be adjusted so that the final relevance scores are more in line with actual needs.
[0068] Furthermore, as mentioned above, in cross-knowledge base retrieval, there must be some knowledge bases that are highly relevant to business problems, and other knowledge bases that are less relevant to business problems. For example, suppose knowledge base A is used to store product descriptions, knowledge base B is used to store product troubleshooting solutions, and knowledge base C is used to store service data. If the business question is "What functions does the product have?", then in the process of answering the business question, it may be necessary to use the data in knowledge base A as key reference data, and the data in knowledge bases B and C as auxiliary reference data. In the present disclosure, the knowledge base with a higher relevance to the business problem is called the main library, and the knowledge base with a lower relevance to the business problem is called the auxiliary library. In some technologies, when retrieving knowledge documents from the main library and the auxiliary library, the relevance score of the knowledge document to the business problem is evaluated according to the same scoring criteria, which may result in some knowledge documents with a high relevance to the business problem being ignored, and knowledge documents with a low relevance to the business problem being focused on.
[0069] In view of this, in some embodiments, in multiple knowledge bases, each knowledge base may have its own corresponding knowledge base weight. The knowledge base weight can be used to evaluate the importance of the knowledge documents retrieved from each knowledge base to the business problem. For any knowledge base, if the corresponding knowledge base weight of the knowledge base is larger, it means that the knowledge documents retrieved from the knowledge base are more important to the business problem. When generating answers to business problems, the knowledge documents retrieved from the knowledge base can be referred to. Anyway, if the corresponding knowledge base weight of the knowledge base is smaller, it means that the knowledge documents retrieved from the knowledge base are not important to the business problem. When generating answers to business problems, the reference to the knowledge documents retrieved from the knowledge base can be reduced. In this way, based on the knowledge base weight, the importance of the knowledge base can be distinguished, thereby solving the problem of being unable to distinguish the importance of the knowledge base in some technologies. Of course, based on the knowledge base weight, the scores of knowledge documents from different knowledge bases (i.e., the relevance scores of knowledge documents and business problems) can also be adjusted to avoid the problem of different scoring standards for different knowledge bases. In summary, after obtaining the relevance scores between the business question and each knowledge document in the knowledge base, the method disclosed herein may further include: The relevance score is modified according to the knowledge base weight corresponding to the knowledge base where each knowledge document is located.
[0070] For example, assuming that the relevance score of knowledge document d11 retrieved from knowledge base A1 to the business problem is S11, and the relevance score of knowledge document d12 retrieved from knowledge base B1 to the business problem is S12, the knowledge base weight corresponding to knowledge base A1 is 0.8, and the knowledge base weight corresponding to knowledge base B1 is 0.3, then the relevance score of knowledge document d11 to the business problem can be corrected based on expression (4), and the relevance score of knowledge document d12 to the business problem can be corrected based on expression (5).
[0071] (4) (5) in, This is the relevance score between the corrected knowledge document d11 and the business problem. It is the relevance score between the modified knowledge document d12 and the business problem.
[0072] Similar to the principle of knowledge base weight, in some embodiments, each knowledge base may have its own corresponding number of documents. In step S203, based on the relevance score, the target knowledge documents for answering business questions from each knowledge base may include: Sort the knowledge documents in each knowledge base in descending order of relevance scores; For any knowledge base, according to the number of target documents corresponding to the knowledge base, among the sorted knowledge documents of the knowledge base, the knowledge documents with the target number of documents at the front are used as the target knowledge documents screened out from the knowledge base.
[0073] Specifically, the number of documents corresponding to the main database can be relatively large, and the number of documents corresponding to the auxiliary database can be relatively small. In this way, as many knowledge documents as possible with high relevance to the business problem can be screened, thereby improving the accuracy of answering the business problem.
[0074] Similar to the number of documents, in some embodiments, each knowledge base has its own corresponding score threshold. The step S203 of selecting target knowledge documents for answering business questions from each knowledge base based on the relevance score may include: For any knowledge base, according to the target score threshold corresponding to the knowledge base, knowledge documents in the knowledge base with a relevance score higher than the target score threshold are used as target knowledge documents screened out from the knowledge base.
[0075] Specifically, the score threshold corresponding to the main database can be lower than the score threshold corresponding to the auxiliary database. In this way, as many knowledge documents as possible with high relevance to the business problem can be screened, thereby improving the accuracy of answering the business problem.
[0076] In some embodiments, considering different types of business problems, the corresponding main libraries and auxiliary libraries may be different. For example, suppose that knowledge base A is used to store product descriptions, knowledge base B is used to store product troubleshooting solutions, and knowledge base C is used to store service data. If the business problem is "What functions does the product have?", then knowledge base A needs to be used as the main library, and knowledge base B and knowledge base C need to be used as auxiliary libraries. If the business problem is "The product cannot be started, how to solve it?", then knowledge base B needs to be used as the main library, and knowledge base A and knowledge base C need to be used as auxiliary libraries. It can be seen that the main library and auxiliary library can change dynamically due to business problems, and one knowledge base cannot be fixed as the main library, or another knowledge base cannot be fixed as the auxiliary library. In view of this, in some embodiments of the present disclosure, the method of the present disclosure may also include: According to the type of business problem, determine the first knowledge base that needs to be used as the main base and the second knowledge base that needs to be used as the auxiliary base; Obtaining main database configuration parameters and auxiliary database configuration parameters, wherein the main database configuration parameters represent the knowledge base weight, document quantity, and score threshold corresponding to the knowledge base as the main database, and the auxiliary database configuration parameters represent the knowledge base weight, document quantity, and score threshold corresponding to the knowledge base as the auxiliary database; The target knowledge document is retrieved from the first knowledge base according to the configuration parameters of the main base, and the target knowledge document is retrieved from the second knowledge base according to the configuration parameters of the auxiliary base. In this way, the main base and the auxiliary base can be dynamically determined based on the specific type of the business problem, which is more accurate.
[0077] In some embodiments, after the target knowledge document is obtained through screening, the method of the present disclosure may further include: Based on the ranking model, re-determine the relevance score of each target knowledge document to the business problem; Based on the re-determined relevance scores, knowledge documents that do not meet the relevance requirements for the business problem are removed from the target knowledge documents.
[0078] Specifically, the ranking model may be a Rerank model. Based on the ranking model, the relevance between the retrieved target knowledge documents and the business questions may be re-analyzed more accurately, thereby obtaining more accurate relevance scores between each target knowledge document and the business question, thereby improving the accuracy of document retrieval.
[0079] In some embodiments, based on the relevance scores re-determined by the ranking model, the top K target knowledge documents with the highest relevance scores may be used as reference documents for ultimately answering the business question.
[0080] In some embodiments, the step S201 of using the embedding model corresponding to the knowledge base to generate a question vector for the business question may specifically include the following steps 11) to 14): 11) Perform word segmentation on the business problem to obtain the vocabulary set Q={q1,q2,…,qn} of the business problem.
[0081] Specifically, word segmentation refers to dividing the business problem into a series of separate words (i.e., q1, q2, ..., qn) based on a specified word segmentation algorithm or word segmentation model. In the word segmentation process, operations such as removing stop words may also be involved. Stop words refer to words that contribute little to the text semantic content of the business problem, such as prepositions, articles, conjunctions, pronouns, etc.
[0082] For example, suppose the business question is "How to browse videos on a mobile phone?" Then the vocabulary set Q = {mobile phone, browse, video} is obtained after word segmentation of the business question.
[0083] 12) Identify entities and keywords in business problems and obtain the entity keyword set E of business problems Q ={e1,e2,…,e m}.
[0084] Entities refer to words or objects with specific meanings in business problems, such as names of people, companies, products, time, etc. Keywords refer to words in business problems that can summarize, reflect or represent the core content and theme of the problem.
[0085] Specifically, entities of business problems can be extracted based on a specified entity extraction algorithm or entity extraction model, and keywords of business problems can be extracted based on a specified keyword extraction algorithm or keyword extraction model. Entity extraction algorithms may include but are not limited to LEAR (Label knowledge EnhAncedRepresentation) algorithms, etc. Keyword extraction algorithms may include but are not limited to TF-IDF (Term Frequency-Inverse Document Frequency) algorithms, Word2Vec word clustering algorithms, etc. Entity extraction models and keyword extraction models may include but are not limited to neural network models, models based on statistical learning, etc.
[0086] For example, assuming the business question is "How to browse videos on a mobile phone?", then the extracted entity keyword set E Q ={mobile phone, video}.
[0087] 13) Extract the relationships between different entities and obtain the entity relationship set R of the business problem EQ .
[0088] Specifically, for the entities extracted in step 12), after matching based on the pre-established knowledge graph, the relationship between each entity and other entities can be established to obtain an entity relationship set. For example, assuming that the entities extracted in step 12 include mobile phones and videos, and after matching the knowledge graph, the mobile phone can be linked to the application store and the video player software, and the video can be linked to the video player software, then the obtained entity relationship set R EQ =[{'start': 'Mobile phone', 'end': 'Video', 'path': ['Mobile phone', 'Video player software', 'Video']}].
[0089] 14) Use the embedding model to convert the vocabulary set, entity keyword set, and entity relationship set into vectors, and use the converted vectors as question vectors.
[0090] Specifically, the vocabulary set Q and the entity keyword set E can be Q and entity relationship set R EQ Combined into an extended query M (i.e. M=Q+E Q +R EQ), and then input the extended query M into the embedding model corresponding to the knowledge base to obtain the question vector of the business problem.
[0091] In the above embodiments, through technical means such as word segmentation, entity and keyword extraction, redundant information in business problems can be reduced, which is conducive to extracting semantic key information in business problems and enhancing the semantic understanding of business problems, so that the converted problem vector can have a higher quality.
[0092] In summary, the entire description of the method disclosed in this disclosure is completed. The method disclosed in this disclosure can achieve the following beneficial effects: 1) It can improve the accuracy of cross-knowledge base retrieval. Specifically, in the method disclosed in the present invention, each knowledge base has its own corresponding embedding model (such as BERT, Word2Vec, etc.). Therefore, knowledge documents are retrieved from different knowledge bases based on different vector spaces, thereby improving the accuracy of retrieval results. At the same time, by merging results and weighted sorting, it is ensured that knowledge bases in different fields or categories can work together to achieve higher retrieval accuracy.
[0093] 2) It can ensure the diversity of search results. Specifically, by integrating search results from different knowledge bases, the limitations of a single model or a single library are avoided. The multi-library-based search mechanism can include different perspectives and supplementary information in the results, thereby improving the diversity of search results. For example, if the user's query involves multiple fields (such as medicine and technology), relevant information can be obtained from both the medical and technology knowledge bases to provide a more comprehensive answer.
[0094] 3) Through weighted fusion, the quality of search results can be optimized. Specifically, the search results of each knowledge base are weighted and fused according to the preset knowledge base weights, so that the search results of the main base will be displayed first, ensuring that the most relevant results are presented first.
[0095] 4) The weights can be adjusted dynamically and flexibly. Specifically, users or system administrators can flexibly adjust the weights of different knowledge bases according to actual business needs to ensure that the advantages of each knowledge base can be maximized in different application scenarios. For example, in a news recommendation system, a current affairs knowledge base can be set as the main base, while the historical knowledge base is used as an auxiliary base to only provide supplementary information.
[0096] 5) It can improve the retrieval efficiency. Specifically, based on the strategy of multi-dimensional comparison, it is possible to perform retrieval in parallel between multiple knowledge bases, significantly reducing the delay in the retrieval process. At the same time, the weighted fusion mechanism combines the multi-channel recall results and performs efficient sorting, thereby reducing the interference of irrelevant data and improving the quality of the final retrieval results. By parallelizing and optimizing the process, the method disclosed in the present invention significantly improves the response speed and processing efficiency of the system while ensuring accuracy.
[0097] 6) It can improve the ability of cross-language retrieval. Specifically, the method disclosed in the present invention can support cross-language retrieval scenarios by using different embedding models for knowledge bases in different languages. For example, the Chinese and English knowledge bases are vectorized using Chinese BERT and English BERT respectively, and the cross-language retrieval results can be effectively integrated by using the multi-way recall mechanism to provide relevant cross-language answers. This is very valuable for multi-language application scenarios (such as global search engines or cross-border e-commerce).
[0098] 7) It can enhance the interpretability of search results. Specifically, by assigning weights to the search results of each knowledge base, it can provide the matching degree and relevance score between each knowledge document and the business question. Then, by re-evaluating the relevance score between each knowledge document and the business question through the re-ranking module, the search results with explanatory information can be output in the end, so that users can clearly understand why each search result ranks high. This not only helps to improve users' trust in the search results, but also makes it easier for the system to correct errors in the search.
[0099] 8) It can strengthen the supplement of information. Specifically, by setting up the main database and the auxiliary database, the information of the auxiliary database can be supplemented on the basis of the main database results. For example, when querying a medical question, the main database may be a medical knowledge base, and the auxiliary database may be a related encyclopedia or common sense database. The search results of the auxiliary database can provide more background information for the content of the main database, enhancing the comprehensiveness of the search results, especially for complex and multi-dimensional query problems.
[0100] 9) It can reduce the risk of data bias. Specifically, the retrieval method based on multiple knowledge bases, multiple comparison dimensions and weighted fusion can effectively avoid the bias of a single knowledge base. For example, if the embedding model or data of a knowledge base is biased (for example, there are errors or outdated information in the training data), it can be corrected through the supplementary information of other knowledge bases to ensure that the final retrieval results are more accurate and comprehensive.
[0101] 10) The scalability of the model can be enhanced. Specifically, in the technical solution of the present disclosure, when a new knowledge base is introduced, the knowledge base weight of the new knowledge base can be configured according to actual needs, and the corresponding embedding model can be trained for the new knowledge base. Through this modular design, the new knowledge base can be quickly integrated into the existing retrieval system without the need for large-scale reconstruction of the entire system.
[0102] 11) It can support cross-database retrieval of multimodal data. Specifically, the technical solution disclosed in the present invention is not limited to text data, but can also support the retrieval of multimodal data. For example, it can process image, text and audio data at the same time. In this way, cross-modal retrieval results can be provided, thereby adapting to knowledge retrieval in the fields of multimedia retrieval, video search, etc.
[0103] 12) Reduced need for manual intervention. Specifically, the present disclosure greatly reduces the need for manual intervention through automated retrieval, weighted fusion and re-ranking processes. In actual applications, administrators only need to set basic parameters according to requirements, and the system can automatically learn and adjust the weights and configurations of each knowledge base, and autonomously optimize the retrieval results. In this way, the system can adapt to changes in dynamically changing application scenarios, improving the system's automation and operating efficiency.
[0104] 13) Improved personalization of query results. Specifically, the method disclosed in the present invention can achieve more personalized search results by combining the user's historical query behavior, preferences and feedback. Specifically, the user's query history can be used to dynamically adjust the weight of each knowledge base, and optimize the relevance of search results according to different user needs. For example, some users pay more attention to a certain field (such as finance, education), and the system will give a higher weight to the knowledge base in this field based on historical behavior, and return results that better meet the user's needs.
[0105] Combined with reference Figure 3 , which is a document processing device for multiple knowledge bases provided by an embodiment of the present disclosure. Figure 3 In the document processing device, the document processing device comprises: A model training module 301 is used to select corresponding embedding models for each knowledge base in response to receiving an initialization instruction, wherein for any knowledge base, the embedding model corresponding to the knowledge base is obtained by training based on knowledge documents of a specified category, the specified category is the same as the category of knowledge documents stored in the knowledge base, and different knowledge bases have different corresponding embedding models; The vector generation module 302 is used to generate a document vector for a knowledge document in any knowledge base using the embedding model corresponding to the knowledge base, and save the document vector.
[0106] In some embodiments, when saving the document vector, the method further includes: A vector index is constructed for the document vector according to preset index construction parameters, wherein the index construction parameters are used to specify at least one of the following information: a type of the vector index and a dimension of the document vector.
[0107] Combined with reference Figure 4 , which is a knowledge retrieval device for multiple knowledge bases provided by an embodiment of the present disclosure. Figure 4In the invention, the knowledge retrieval device comprises: The question receiving module 401 receives the business question to be answered; A relevance score calculation module 402 is used to generate a question vector for a business question using an embedding model corresponding to the knowledge base for any knowledge base, and at least compare the question vector with the document vector in the knowledge base for vector similarity to obtain a relevance score between the business question and each knowledge document in the knowledge base; The document retrieval module 403 is used to filter target knowledge documents for answering business questions from various knowledge bases based on relevance scores.
[0108] In some embodiments, the relevance score calculation module 402 is specifically used to: The result of the vector similarity comparison is used as the first relevance score between the business question and each knowledge document in the knowledge base; Compare the business problem with each knowledge document in the knowledge base according to one or more other comparison dimensions except the vector similarity comparison to obtain one or more second relevance scores between the business problem and each knowledge document in the knowledge base; The first relevance score and the second relevance score are integrated to obtain the relevance score between the business question and each knowledge document in the knowledge base.
[0109] In some embodiments, the relevance score calculation module 402 is specifically used to: Extract key words from business problems; The question keywords are searched in each knowledge document in the knowledge base, and a second relevance score between the business question and each knowledge document in the knowledge base is obtained according to the search result.
[0110] In some embodiments, the relevance score calculation module 402 is specifically used to: Obtain document attribute information of each knowledge document in the knowledge base; According to the preset matching logic, the matching degree between the document attribute information and the business question is determined, and a second relevance score between the business question and each knowledge document in the knowledge base is obtained.
[0111] In some embodiments, the first relevance score and each second relevance score have respective corresponding score weights; the relevance score calculation module 402 is specifically used to: Modifying the first relevance score according to the score weight corresponding to the first relevance score, and modifying the second relevance score according to the score weight corresponding to the second relevance score; Based on the corrected first relevance score and the second relevance score, a relevance score between the business question and each knowledge document in the knowledge base is obtained.
[0112] In some embodiments, in multiple knowledge bases, each knowledge base has a corresponding knowledge base weight; After obtaining the relevance scores between the business question and each knowledge document in the knowledge base, the relevance score calculation module 402 is specifically used to: The relevance score is modified according to the knowledge base weight corresponding to the knowledge base where each knowledge document is located.
[0113] In some embodiments, each knowledge base has a corresponding number of documents; the document retrieval module 403 is specifically used to: Sort the knowledge documents in each knowledge base in descending order of relevance scores; For any knowledge base, according to the number of target documents corresponding to the knowledge base, among the sorted knowledge documents of the knowledge base, the knowledge documents with the target number of documents at the front are used as the target knowledge documents screened out from the knowledge base.
[0114] In some embodiments, each knowledge base has its own corresponding score threshold; the document retrieval module 403 is specifically used to: For any knowledge base, according to the target score threshold corresponding to the knowledge base, knowledge documents in the knowledge base with a relevance score higher than the target score threshold are used as target knowledge documents screened out from the knowledge base.
[0115] In some embodiments, after the target knowledge document is obtained through screening, the document retrieval module 403 is specifically used to: Based on the ranking model, re-determine the relevance score of each target knowledge document to the business problem; Based on the re-determined relevance scores, knowledge documents that do not meet the relevance requirements for the business problem are removed from the target knowledge documents.
[0116] In some embodiments, the relevance score calculation module 402 is specifically used to: Perform word segmentation on business problems to obtain a vocabulary set of business problems; Identify entities and keywords in business problems and obtain entity keyword sets of business problems; Extract the relationships between different entities and obtain the entity relationship set of the business problem; Use the embedding model to convert the vocabulary set, entity keyword set, and entity relationship set into vectors, and use the converted vectors as question vectors.
[0117] Combined with reference Figure 5 , is a schematic diagram of the structure of an electronic device provided by some embodiments of the present disclosure. Figure 5As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0118] The processor 10 may be a first PCIe device, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0119] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0120] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0121] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0122] The electronic device further comprises a communication interface 30 for the electronic device to communicate with other devices or a communication network.
[0123] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0124] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0125] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A document processing method for multiple knowledge bases, characterized in that: An initialization module applied to a knowledge base retrieval system, wherein different knowledge bases in the multiple knowledge bases are used to store knowledge documents of different categories; the method comprises: In response to receiving the initialization instruction, selecting a corresponding embedding model for each of the knowledge bases, wherein, for any of the knowledge bases, the embedding model corresponding to the knowledge base is obtained by training based on knowledge documents of a specified category, the specified category is the same as the category of knowledge documents stored in the knowledge base, and different knowledge bases have different corresponding embedding models; For any of the knowledge bases, using the embedding model corresponding to the knowledge base, generate a document vector for the knowledge document in the knowledge base, and save the document vector.
2. The method according to claim 1, characterized in that When saving the document vector, the method further includes: A vector index is constructed for the document vector according to preset index construction parameters, wherein the index construction parameters are used to specify at least one of the following information: a type of the vector index and a dimension of the document vector.
3. A knowledge retrieval method for multiple knowledge bases, characterized in that: A retrieval module applied to a knowledge base retrieval system, wherein the knowledge documents in the multiple knowledge bases are processed based on the method in claim 1 or 2; the method comprises: Receive business questions to be answered; For any of the knowledge bases, use the embedding model corresponding to the knowledge base to generate a question vector for the business question, and at least compare the question vector with the document vector in the knowledge base for vector similarity to obtain a relevance score between the business question and each knowledge document in the knowledge base; According to the relevance score, target knowledge documents for answering the business question are screened from each of the knowledge bases.
4. The method according to claim 3, characterized in that The at least performing vector similarity comparison between the question vector and the document vector in the knowledge base to obtain the relevance score between the business question and each knowledge document in the knowledge base includes: Using the result of the vector similarity comparison as the first relevance score between the business question and each knowledge document in the knowledge base; Comparing the business problem with each knowledge document in the knowledge base according to one or more other comparison dimensions except the vector similarity comparison, to obtain one or more second relevance scores between the business problem and each knowledge document in the knowledge base; The first relevance score and the second relevance score are integrated to obtain a relevance score between the business question and each knowledge document in the knowledge base.
5. The method according to claim 4, characterized in that The obtaining of one or more second relevance scores between the business problem and each knowledge document in the knowledge base includes: Extracting problem keywords from the business problem; The question keyword is searched in each knowledge document in the knowledge base, and a second relevance score between the business question and each knowledge document in the knowledge base is obtained according to the search result.
6. The method according to claim 4, characterized in that The obtaining of one or more second relevance scores between the business problem and each knowledge document in the knowledge base includes: Obtaining document attribute information of each knowledge document in the knowledge base; According to a preset matching logic, the matching degree between the document attribute information and the business question is determined, and a second relevance score between the business question and each knowledge document in the knowledge base is obtained.
7. The method according to claim 4, characterized in that The first relevance score and each of the second relevance scores have respective corresponding score weights; The fusing the first relevance score and the second relevance score to obtain a relevance score between the business question and each knowledge document in the knowledge base includes: modifying the first relevance score according to the score weight corresponding to the first relevance score, and modifying the second relevance score according to the score weight corresponding to the second relevance score; Based on the corrected first relevance score and the second relevance score, a relevance score between the business question and each knowledge document in the knowledge base is obtained.
8. The method according to claim 7, characterized in that In the multiple knowledge bases, each of the knowledge bases has a corresponding knowledge base weight; After obtaining the relevance scores between the business problem and each knowledge document in the knowledge base, the method further includes: The relevance score is modified according to the knowledge base weight corresponding to the knowledge base where each knowledge document is located.
9. The method according to claim 3, characterized in that: Each of the knowledge bases has a corresponding number of documents; The step of selecting target knowledge documents for answering the business questions from the respective knowledge bases according to the relevance scores includes: Sorting the knowledge documents in each of the knowledge bases in descending order of relevance scores; For any of the knowledge bases, according to the number of target documents corresponding to the knowledge base, among the sorted knowledge documents of the knowledge base, the knowledge documents with the target number of documents at the front are used as the target knowledge documents screened out from the knowledge base.
10. The method according to claim 3, characterized in that: Each of the knowledge bases has a corresponding score threshold; The step of selecting target knowledge documents for answering the business questions from the respective knowledge bases according to the relevance scores includes: For any of the knowledge bases, according to the target score threshold corresponding to the knowledge base, knowledge documents in the knowledge base with a relevance score higher than the target score threshold are used as target knowledge documents screened out from the knowledge base.
11. The method according to any one of claims 3, 9 and 10, characterized in that: After the target knowledge document is obtained through screening, the method further includes: Based on the ranking model, re-determine the relevance score between each of the target knowledge documents and the business problem; Based on the re-determined relevance scores, knowledge documents that do not meet the relevance requirement with the business problem are removed from the target knowledge documents.
12. The method according to claim 3, characterized in that The using the embedding model corresponding to the knowledge base to generate a question vector for the business problem includes: Performing word segmentation processing on the business problem to obtain a vocabulary set of the business problem; Identify entities and keywords in the business question to obtain an entity keyword set of the business question; Extracting the relationships between different entities to obtain an entity relationship set of the business problem; Using the embedding model, vector conversion is performed on the vocabulary set, the entity keyword set and the entity relationship set, and the converted vector is used as the question vector.
13. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the document processing method for multiple knowledge bases as described in claim 1 or 2, or executes the knowledge retrieval method for multiple knowledge bases as described in any one of claims 3 and 12 by executing the computer instructions.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which are used to enable a computer to execute the document processing method for multiple knowledge bases described in claim 1 or 2, or to execute the knowledge retrieval method for multiple knowledge bases described in any one of claims 3 and 12.
15. A computer program product, characterized in that It comprises computer instructions, which are used to make a computer execute the document processing method for multiple knowledge bases as described in claim 1 or 2, or execute the knowledge retrieval method for multiple knowledge bases as described in any one of claims 3 and 12.
Citation Information
Patent Citations
Safety knowledge graph model training method, prediction method and device
CN117056535A
Knowledge question and answer method, device and equipment and storage medium
CN118467690A
Vector knowledge base-based large-model question-answer dialogue method and system and storage medium
CN118484526A
Information retrieval method and device, storage medium and computer program product
CN118939763A
Multi-mode RAG knowledge question-answering method and device applied to vertical field
CN119150998A
Cited By
Knowledge base document searching method and device, electronic equipment and storage medium
CN120821830A
Question and answer method and device, storage medium, electronic equipment and program product
CN121413778A
Method, device and equipment for improving accuracy of query result of knowledge base and storage medium
CN121636668A