Knowledge base hit optimization method and device, medium and product
Through word segmentation processing, word embedding and large language model expansion optimization of knowledge base hit results, the problem of incomplete user input is solved, and the accuracy and user experience of hit results are improved.
Patent Information
- Application Number
- CN202410838329.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-06-26
AI Technical Summary
The amount of prompt words entered by the user is limited, incomplete or inaccurate, which makes it difficult to accurately match relevant information during the knowledge base search, affecting the accuracy of the hit results.
Noise factors are removed through word segmentation processing and preprocessing, word embedding is performed to improve the semantic representation of query statements, and context expansion and hit range optimization are combined with large language models to generate more comprehensive hit results.
Improve the accuracy and user experience of the hit results of the knowledge base, and provide a richer and more complete knowledge system by focusing on key information and capturing semantic relationships of phrases.
Smart Images

Figure CN118939807A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of intelligent question answering, and in particular to a knowledge base hit optimization method, device, medium and product. Background Art
[0002] In the current information age, knowledge bases, as systems for storing and managing large amounts of structured information, have become a key component in the fields of artificial intelligence, big data analysis, and intelligent customer service. Knowledge bases provide users with accurate and efficient information services by storing, managing, and retrieving structured or unstructured information. Among them, efficient retrieval and accurate hits of knowledge bases are the key to their application effectiveness. However, in actual applications, the hit effect of knowledge bases is often affected by the prompt words entered by users.
[0003] Currently, the prompt words entered by users usually have problems such as limited information, incompleteness, and inaccuracy. These incomplete prompt words will make it difficult for the knowledge base to accurately match relevant information during retrieval, thereby affecting the accuracy of the knowledge base hit results.
[0004] Therefore, how to improve the accuracy of knowledge base hit results is an urgent problem to be solved by technical personnel in this field. Summary of the invention
[0005] The purpose of this application is to provide a knowledge base hit optimization method, device, medium and product to solve at least one of the above technical problems.
[0006] The above invention objectives of the present application are achieved through the following technical solutions: In a first aspect, the present application provides a knowledge base hit optimization method, which adopts the following technical solution: A knowledge base hit optimization method, comprising: Obtaining a query statement input by a user, performing word segmentation processing based on the query statement, and obtaining a query word sequence; Preprocessing is performed based on the query word sequence to obtain a processed query word sequence, wherein the preprocessing includes: removing stop words and punctuation marks; Performing word embedding based on the processed query word sequence to obtain a query vector, wherein the query vector is a numerical representation of the query statement and is used to represent the semantic information of the query statement; Acquire a knowledge base, perform query matching on the query vector and the knowledge base, and determine an initial hit result; Acquire a large language model, and use the large language model to perform context expansion on the initial hit result to generate context information corresponding to the initial hit result; The hit range is optimized based on the context information and the initial hit result to obtain an optimized hit result, and the optimized hit result is sent to the user terminal to provide the user with a comprehensive and accurate hit result.
[0007] By adopting the above technical solution, word segmentation processing is performed based on the query statement to obtain a query word sequence, and then preprocessing is performed based on the query word sequence to obtain a processed query word sequence. The execution of word segmentation processing and preprocessing operations will eliminate the noise factors in the query statement, so that the query matching is more focused on key information to improve the accuracy of the query semantics and the efficiency of the query matching. Then, word embedding is performed based on the processed query word sequence to obtain a query vector, and query matching is performed based on the query vector and the knowledge base to determine the initial hit result. Word embedding can also capture the semantic relationship between phrases, so that the query vector can more accurately represent the semantic information of the query statement, thereby improving the accuracy of the query matching. The initial hit result may be just an isolated knowledge point, lacking association and integration with other information. Therefore, the large language model is used to perform context expansion on the initial hit result, generate context information corresponding to the initial hit result, and optimize the hit range based on the context information and the initial hit result to obtain an optimized hit result. Through context expansion, a richer and more complete knowledge system is provided to users, which improves the accuracy of the knowledge base hit result.
[0008] In a preferred example, the present application may be further configured as follows: the use of the large language model to perform context expansion on the initial hit result to generate context information corresponding to the initial hit result includes: Inputting the initial hit result into the large language model, controlling the large language model to perform context expansion, and outputting first context information; Screening related items based on the initial hit result and the knowledge base to determine second context information; Acquire an external resource library, and perform additional information expansion based on the external resource library and the initial hit result to determine third context information; An interpolation operation is performed based on the first context information, the second context information, and the third context information to generate context information corresponding to the initial hit result.
[0009] In a preferred example, the present application may be further configured as follows: performing word embedding based on the processed query word sequence to obtain a query vector includes: When the processed query word sequence includes only one target query word, performing vector conversion on the target query word using a word embedding model to obtain a query vector; When the processed query word sequence includes at least two target query words, vector conversion is performed on the at least two target query words using a combination analysis method to obtain a query vector, wherein the combination analysis method includes: an average method and a weighted summation method.
[0010] In a preferred example, the present application may be further configured as follows: the optimization of the hit range based on the context information and the initial hit result to obtain the optimized hit result includes: Performing hit fusion based on the context information and the initial hit result to determine a fused hit set; Multi-dimensional sorting is performed based on the fused hit set to obtain optimized hit results, wherein the multi-dimensional sorting is used to sort the hit results based on comprehensive information similarity and knowledge authority.
[0011] In a preferred example, the present application may be further configured as follows: after performing query matching based on the query vector and the knowledge base and determining the initial hit result, the method further includes: When the initial hit result is unanswered, query expansion is performed based on the processed query word sequence to obtain an expanded query word sequence; Performing word embedding based on the extended query word sequence to obtain an extended query vector, performing query matching with the knowledge base based on the extended query vector to obtain an extended hit result, and sending the extended hit result to the user terminal; Based on the initial hit result, the unanswered query statements to be filled are marked for filling, so as to fill the verified information corresponding to the query statements to be filled into the knowledge base.
[0012] In a preferred example, the present application may be further configured as follows: after optimizing the hit range based on the context information and the initial hit result to obtain an optimized hit result, and sending the optimized hit result to the user terminal, it further includes: Obtaining user evaluation information, performing hit accuracy analysis based on the user evaluation information, and determining hit accuracy; The accuracy threshold corresponding to the knowledge base optimization is obtained, and when the hit accuracy is lower than the accuracy threshold, a knowledge base optimization instruction is generated, wherein the knowledge base optimization instruction prompts the technician to optimize and fill the data in the knowledge base.
[0013] In a second aspect, the present application provides an electronic device, which adopts the following technical solution: at least one processor; Memory; At least one application, wherein the at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the above-mentioned knowledge base hit optimization method.
[0014] In a third aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution: A computer-readable storage medium stores a computer program, which, when executed in a computer, causes the computer to execute the above-mentioned knowledge base hit optimization method.
[0015] In a fourth aspect, the present application provides a computer program product, which adopts the following technical solution: A computer program product includes a computer program, and when the computer program is executed by a processor, the knowledge base hit optimization method is implemented.
[0016] In summary, the present application includes at least one of the following beneficial technical effects: Based on the query statement, word segmentation processing is performed to obtain a query word sequence, and then, based on the query word sequence, preprocessing is performed to obtain a processed query word sequence. The execution of word segmentation processing and preprocessing operations will eliminate the noise factors in the query statement, so that the query matching is more focused on key information, so as to improve the accuracy of the query semantics and the efficiency of the query matching. Then, based on the processed query word sequence, word embedding is performed to obtain a query vector, and query matching is performed based on the query vector and the knowledge base to determine the initial hit result. Word embedding can also capture the semantic relationship between phrases, so that the query vector can more accurately represent the semantic information of the query statement, thereby improving the accuracy of the query matching. The initial hit result may be just an isolated knowledge point, lacking association and integration with other information. Therefore, the large language model is used to perform context expansion on the initial hit result, generate context information corresponding to the initial hit result, and optimize the hit range based on the context information and the initial hit result to obtain an optimized hit result. Through context expansion, a richer and more complete knowledge system is provided to users, which improves the accuracy of the knowledge base hit result.
[0017] Based on the context information and the initial hit results, hit fusion is performed to determine the fused hit set. Hit fusion is mainly used to combine the two aspects of information to make the content in the fused hit set more comprehensive. Then, multi-dimensional sorting is performed based on the fused hit set to obtain the optimized hit result. The fused hit method based on context information and the initial hit results can more comprehensively consider the correlation and dependency between information, thereby improving the accuracy of the hit results. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1It is a flowchart of a knowledge base hit optimization method according to one embodiment of the present application; Figure 2 It is a structural schematic diagram of a knowledge base hit optimization device in one embodiment of the present application; Figure 3 It is a structural schematic diagram of an electronic device according to one embodiment of the present application. DETAILED DESCRIPTION
[0019] The following combination Figures 1 to 3 This application is described in further detail.
[0020] This specific embodiment is merely an explanation of the present application and is not a limitation of the present application. After reading this specification, a person skilled in the art may make non-creative modifications to the present embodiment as needed, but such modifications are protected by the patent law as long as they are within the scope of the present application.
[0021] In order to make the purpose, technical scheme and advantages of the embodiment of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is a part of the embodiment of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application. It should be noted that in the optional embodiments of the present application, the object information and other related data involved, when the embodiments in the present application are applied to specific products or technologies, need to obtain the permission or consent of the object, and the collection, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions. In other words, if the data related to the object is involved in the embodiment of the present application, it needs to be obtained through the authorization and consent of the object, the authorization and consent of the relevant departments, and in accordance with the relevant laws, regulations and standards of the country and region. If personal information is involved in the embodiment, the acquisition of all personal information needs to obtain the consent of the individual. If sensitive information is involved, the separate consent of the information subject needs to be obtained, and the embodiment also needs to be implemented with the authorization and consent of the object.
[0022] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.
[0023] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.
[0024] The embodiment of the present application provides a knowledge base hit optimization method, which is executed by an electronic device, which can be a server or a terminal device, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. The terminal device can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited to this. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, and the embodiment of the present application does not limit this. Figure 1 As shown, the method includes step S101, step S102, step S103, step S104, step S105 and step S106, wherein: Step S101: obtaining a query statement input by a user, performing word segmentation processing based on the query statement, and obtaining a query word sequence; Step S102: preprocessing is performed based on the query word sequence to obtain a processed query word sequence, wherein the preprocessing includes: removing stop words and punctuation marks.
[0025] For the embodiment of the present application, the user can query the relevant information that he wants to know through the electronic device, so the query statement will be input in the query interface on the electronic device, and then the query statement will be segmented to obtain a query word sequence. For the word segmentation processing, the query statement is segmented using the word segmentation algorithm in natural language processing, wherein the word segmentation algorithm includes but is not limited to: rule-based word segmentation, statistical-based word segmentation, and deep learning-based word segmentation, so that the original query statement is divided into independent words or phrases, and these words or phrases are arranged in the order in the original statement to form a query word sequence. Since there are usually some phrases without substantive meaning in the query word sequence corresponding to the query statement, such as stop words and punctuation marks, these phrases without substantive meaning are usually regarded as noise in query matching, which will affect the efficiency of subsequent query matching and the accuracy of query semantics to a certain extent. Therefore, preprocessing is performed based on the query word sequence to obtain a processed query word sequence. The preprocessing is used to remove stop words, punctuation marks and other phrases without substantial meaning. The noise is removed by preprocessing, so that the query matching is more focused on key information to improve the accuracy of the query semantics and the efficiency of the query matching. For the removal of stop words in the preprocessing, a stop word list is pre-stored in the electronic device, and the stop word list includes various commonly used stop words. Each phrase in the query word sequence is traversed to check whether it is in the stop word list. If it is in the stop word list, the phrase is deleted from the query word sequence. For the prominent punctuation marks in the preprocessing, a punctuation mark set is pre-stored in the electronic device, and the punctuation mark set includes various punctuation marks. Each phrase in the query word sequence is traversed to check whether it is in the punctuation mark set. If it is in the punctuation mark set, the phrase is deleted from the query word sequence. Of course, preprocessing may also include: converting to lowercase (for example, converting all words to lowercase to eliminate the impact of case on the query), removing special characters (for example, in addition to punctuation marks, other special characters such as HTML tags, URLs, etc. may also be removed), single connection or splitting (for example, for some languages, it may be necessary to connect adjacent words or split compound words into separate words). The specific implementation of the preprocessing operation is no longer limited in the embodiments of the present application.
[0026] Step S103: word embedding is performed based on the processed query word sequence to obtain a query vector, wherein the query vector is a numerical representation of the query statement and is used to represent the semantic information of the query statement; Step S104: Acquire a knowledge base, perform query matching with the knowledge base based on the query vector, and determine an initial hit result.
[0027] For the embodiment of the present application, the word embedding operation is performed on the processed query word sequence, and the text data can be converted into a numerical representation, so as to facilitate the use of efficient vector calculation algorithms to accelerate the query matching process. Compared with the traditional query method based on string matching, the query matching method based on word embedding can find results related to the query statement more quickly, thereby improving the query efficiency. At the same time, word embedding can also capture the semantic relationship between phrases, so that the query vector can more accurately represent the semantic information of the query statement, thereby improving the accuracy of query matching. Of course, as a numerical representation of the query vector, it supports more complex query requirements, such as semantic similarity queries, context-related queries, etc.
[0028] Specifically, a query vector is obtained by performing word embedding based on a processed query word sequence. For the word embedding operation, a word embedding model is selected, and each phrase in the processed query word sequence is mapped to a corresponding word vector using the word embedding model, that is, when the processed query word sequence includes only one target query word, the target query word is transformed into a vector using the word embedding model to obtain a query vector; when the processed query word sequence includes at least two target query words, at least two target query words are transformed into vectors using a combined analysis method to obtain a query vector, wherein the combined analysis method includes: an average method and a weighted summation method. For the word embedding model, it can be a pre-trained model such as Word2Vec and GloVe. Preferably, in order to further improve the accuracy of query matching, the query vector can be optimized, for example, by adding context information, using an attention mechanism, and other methods to fine-tune the query vector.
[0029] Furthermore, a knowledge base is pre-stored in the electronic device. The knowledge base is a system or knowledge base that centrally stores and manages structured and unstructured information. It is used to store and query relevant knowledge in a specific field. The relevant knowledge can be facts, rules, concepts, relationships, etc. The construction of the knowledge base requires the participation of domain experts to ensure the accuracy and completeness of the knowledge. With the continuous increase in the amount of data and the continuous updating of domain knowledge, the knowledge base is also continuously maintained and updated. The information in the knowledge base is usually stored in a structured form, including information such as entities, relationships, and attributes. Among them, the entity is usually represented as a vector to facilitate query matching with the query vector. Then, based on the query vector and the knowledge base, the query matching is performed to determine the initial hit result. For query matching, a vector similarity calculation method can be used to compare the similarity between the query vector and the vector representation of the entity in the knowledge base, and according to the similarity score, the relevant information closest to the query vector is determined as the initial hit result. Of course, a similarity threshold can be set in the electronic device. Only when the similarity score exceeds the similarity threshold, the result is considered a hit. This operation helps to filter out results that are not very relevant to the query.
[0030] Step S105: obtaining a large language model, and using the large language model to perform context expansion on the initial hit result to generate context information corresponding to the initial hit result; Step S106: Optimize the hit range based on the context information and the initial hit result to obtain an optimized hit result, and send the optimized hit result to the user terminal to provide the user with a comprehensive and accurate hit result.
[0031] For the embodiments of the present application, the initial hit result may be just an isolated knowledge point, lacking association and integration with other information. However, this lack of context association makes it difficult for users to associate it with other knowledge to form a complete knowledge system. Therefore, through context expansion, a richer and more complete knowledge system is provided to users to enhance their cognition and understanding, thereby improving their usage experience and satisfaction.
[0032] Specifically, a large language model is obtained. The large language model is an artificial intelligence model trained with a large amount of data, which is designed to understand and generate natural language text to provide users with richer and more accurate information. The large language model is used to expand the context of the initial hit result to generate context information corresponding to the initial hit result, wherein the context information is closely related to the initial hit result and can provide users with a more comprehensive understanding and reference. There are many ways to expand the context. In one feasible way, the initial hit result is passed as input to the large language model. The large language model will understand and analyze the initial hit result based on its trained language knowledge and context information, and generate context information related to the initial hit result. This information may include background knowledge, related concepts, explanations, etc. In another achievable method, the initial hit result is input into a large language model, the large language model is controlled to perform context expansion, and the first context information is output; the relevance items are screened based on the initial hit result and the knowledge base to determine the second context information; an external resource library is obtained, and additional information is expanded based on the external resource library and the initial hit result to determine the third context information; interpolation operations are performed based on the first context information, the second context information, and the third context information to generate context information corresponding to the initial hit result. Then, the context information is integrated with the initial hit result, that is, the context information is used as a supplement to the initial hit result, or the context information is associated with the initial hit result to form a more complete and richer result set. Then, based on the integrated context information and the initial hit result, reordering, filtering or clustering operations are performed to obtain optimized hit results, so that the optimized hit results are more accurate. Finally, the optimized hit results are sent to the user terminal to provide users with more comprehensive and accurate search results.
[0033] It can be seen that in the embodiment of the present application, word segmentation processing is performed based on the query statement to obtain a query word sequence, and then, preprocessing is performed based on the query word sequence to obtain a processed query word sequence, and the execution of word segmentation processing and preprocessing operations will eliminate the noise factors in the query statement, so that the query matching is more focused on key information, so as to improve the accuracy of the query semantics and the efficiency of the query matching. Further, word embedding is performed based on the processed query word sequence to obtain a query vector, and query matching is performed based on the query vector and the knowledge base to determine the initial hit result. Word embedding can also capture the semantic relationship between phrases, so that the query vector can more accurately represent the semantic information of the query statement, thereby improving the accuracy of the query matching. The initial hit result may be just an isolated knowledge point, lacking association and integration with other information, and therefore, the initial hit result is contextually expanded using a large language model, and the context information corresponding to the initial hit result is generated, and the hit range is optimized based on the context information and the initial hit result to obtain an optimized hit result. Through context expansion, a richer and more complete knowledge system is provided to users, which improves the accuracy of the knowledge base hit result.
[0034] Furthermore, in order to make the final determined context information more comprehensive and rich, in the embodiment of the present application, the large language model is used to perform context expansion on the initial hit result to generate context information corresponding to the initial hit result, including: Inputting the initial hit result into the large language model, controlling the large language model to perform context expansion, and outputting first context information; Screening related items based on the initial hit result and the knowledge base to determine the second context information; Obtaining an external resource library, and performing additional information expansion based on the external resource library and the initial hit result to determine third context information; An interpolation operation is performed based on the first context information, the second context information, and the third context information to generate context information corresponding to the initial hit result.
[0035] For the embodiment of the present application, when using a large language model for context expansion, the large language model can capture long-distance dependencies in the text and generate first context information related to the initial hit result. The first context information may be one or more descriptive texts, providing the background, details and explanation of the initial hit result. At the same time, based on the initial hit result and the knowledge base, the relevance items are screened to determine the second context information, that is, using natural language processing technology, key phrases are extracted from the initial hit result. The key phrases are used to reflect the subject or key content of the initial hit result; the relevance items are screened according to the key sentences and the knowledge base, and the screened relevance items are integrated and formatted to generate the second context information, wherein the second context information is detailed information, facts, relationships and other factors related to the subject of the initial hit result, so as to provide users with more comprehensive and accurate search results and context support. Furthermore, an external resource library is obtained. The external resource library can be a resource library outside the knowledge base such as a search engine, a knowledge graph, and a professional database, which is used to provide multi-dimensional and multi-level additional information. Therefore, the external resource library is used to query and expand the additional information of the initial hit result to obtain richer third context information. The introduction of external resource library and additional information expansion can provide users with more accurate and comprehensive search results and recommended content, which helps to improve user experience and satisfaction, and increase user stickiness and activity. Then, the first context information, the second context information and the third context information are interpolated by interpolation algorithms (for example, linear interpolation, polynomial difference, etc.), and the context information complements each other to fill or supplement the missing content, and the difference results are processed as necessary, such as deduplication, sorting, formatting, etc., which helps to ensure the accuracy and readability of the generated context information. Finally, the context information corresponding to the initial hit result is determined, and the context information can better capture the intrinsic relationship between texts. In the process of executing context expansion, three methods are used to obtain the corresponding context information, and the context information obtained by the three methods is integrated, so that the final determined context information is more comprehensive and rich.
[0036] It can be seen that in the embodiment of the present application, the initial hit result is input into the large language model, the large language model is controlled to perform context expansion, and the first context information is output; at the same time, the relevant items are screened based on the initial hit result and the knowledge base to determine the second context information; at the same time, additional information expansion is performed based on the external resource library and the initial hit result to determine the third context information. Finally, interpolation operations are performed based on the first context information, the second context information, and the third context information to generate context information corresponding to the initial hit result. In the process of executing context expansion, three methods are used to obtain the corresponding context information, and the context information obtained by the three methods is combined to make the final determined context information more comprehensive and rich.
[0037] Furthermore, in order for the query vector to more accurately represent the overall semantics of the query, in an embodiment of the present application, word embedding is performed based on the processed query word sequence to obtain a query vector, including: When the processed query word sequence includes only one target query word, the target query word is transformed into a vector using a word embedding model to obtain a query vector; When the processed query word sequence includes at least two target query words, a combination analysis method is used to perform vector conversion on the at least two target query words to obtain a query vector, wherein the combination analysis method includes: an average method and a weighted summation method.
[0038] For the embodiment of the present application, the word embedding operation is a necessary step to convert text data into a numerical form that can be understood and processed by the machine, and using the query vector as an input feature can significantly improve the matching efficiency of knowledge base query matching. In the operation of performing word embedding, different processing methods are used for the cases of one target query word and at least two target query words, which helps the query vector to more accurately represent the overall semantics of the query and flexibly adapt to different query lengths.
[0039] Specifically, when the processed query word sequence includes only one target query word, a pre-trained word embedding model is selected, for example, Word2Vec, GloVe, FastText or a Transformer-based model, and the processed query word sequence is used as input data of the word embedding model to query the query vector corresponding to the target query word, wherein when the target query word is no longer in the vocabulary of the pre-trained word embedding model, a zero vector or a random vector can be used instead. When the processed query word sequence includes at least two target query words, a combined analysis method is used to convert the vectors of the at least two target query words to obtain a query vector, wherein the combined analysis method includes: an average method and a weighted summation method. For the average method, the vectors of all target query words are added and then divided by the number of target query words, that is, (V1 +V2 + ... +Vn) / n, wherein n is the number of target query words, and Vx is the vector corresponding to the target query word. For the weighted summation method, different weights are assigned to the target query words according to their importance in the query, and then a weighted sum is performed. The weight can be determined based on the position, part of speech, or other factors of the target query words in the query. For a single target query word, directly using its word embedding vector can avoid the noise or information loss that may be introduced by aggregating multiple word embeddings, and also improve the computational effect of the word embedding operation. For multiple target query words, determining the query vector through a combined analysis method can more accurately represent the overall semantics of the query and capture the semantic associations between multiple target query words.
[0040] It can be seen that in the embodiment of the present application, when the processed query word sequence includes only one target query word, the target query word is vectorized using the word embedding model to obtain a query vector. When the processed query word sequence includes at least two target query words, the at least two target query words are vectorized using a combined analysis method to obtain a query vector. Using different processing methods for the cases of one target query word and at least two target query words respectively helps the query vector to more accurately represent the overall semantics of the query and flexibly adapt to different query lengths.
[0041] Furthermore, in order to more comprehensively consider the relevance and dependency between information, thereby improving the accuracy of the hit result, in an embodiment of the present application, the hit range is optimized based on the context information and the initial hit result to obtain an optimized hit result, including: Perform hit fusion based on context information and initial hit results to determine a fused hit set; Multi-dimensional sorting is performed based on the fused hit set to obtain optimized hit results, wherein the multi-dimensional sorting is used to sort the hit results based on comprehensive information similarity and knowledge authority.
[0042] For the embodiment of the present application, hit fusion is performed based on context information and initial hit results to determine a fused hit set, wherein hit fusion is mainly used to combine the two aspects of information so that the content in the fused hit set is more comprehensive, and the hit fusion strategy can be based on different algorithms or models, such as rule-based fusion, machine learning-based fusion, etc. Then, multidimensional sorting is performed based on the fused hit set to obtain optimized hit results, wherein multidimensional sorting is used to sort the hit results based on comprehensive information similarity and knowledge authority, information similarity is used to measure the relevance of the hit results to the user query, and knowledge authority is used to evaluate the credibility and authority of the information in the fused hit set. For information similarity sorting, a similarity algorithm is used to calculate the similarity between each hit combination information in the fused hit set and the query statement, and a similarity score for each hit combination information is determined, wherein the higher the similarity score, the more relevant the hit combination information is to the query. For the ranking of knowledge authority, the authority score is performed based on the credibility (for example, whether it comes from an authoritative news website, professional database, etc.), accuracy (for example, whether it has a reference source, fact verification) and timeliness (for example, considering the release date and update frequency) of each hit combination information in the fused hit set, where the higher the authority score, the more reliable the hit result. Then, the weights corresponding to the similarity and knowledge authority are obtained, where the weight size can be determined based on experience and expert opinion. Furthermore, based on the similarity score and authority score corresponding to each hit combination information, and the weight distribution, the comprehensive score of each hit combination information is calculated, where the comprehensive score can be calculated by weighted summation, weighted product or other comprehensive scoring algorithms. Finally, each hit combination information in the fused hit set is sorted according to the comprehensive score to determine the optimized hit result. The fused hit method based on context information and the initial hit result can more comprehensively consider the relevance and dependency between information, thereby improving the accuracy of the hit result.
[0043] It can be seen that in the embodiment of the present application, hit fusion is performed based on context information and the initial hit result to determine the fused hit set, and the hit fusion is mainly used to combine the two aspects of information so that the content in the fused hit set is more comprehensive. Then, multi-dimensional sorting is performed based on the fused hit set to obtain an optimized hit result. The fused hit method based on context information and the initial hit result can more comprehensively consider the correlation and dependency between information, thereby improving the accuracy of the hit result.
[0044] Furthermore, in order to optimize the operation of the knowledge base and improve the comprehensiveness and accuracy of the knowledge base content, in the embodiment of the present application, after performing query matching based on the query vector and the knowledge base and determining the initial hit result, the following is further included: When the initial hit result is unanswered, query expansion is performed based on the processed query word sequence to obtain an expanded query word sequence; Based on the extended query word sequence, word embedding is performed to obtain an extended query vector, and query matching is performed with the knowledge base based on the extended query vector to obtain an extended hit result, and the extended hit result is sent to the user terminal; Based on the initial hit result, the unanswered query statements to be filled are marked for filling, so as to fill the verified information corresponding to the query statements to be filled into the knowledge base.
[0045] For the embodiments of the present application, in the early stage of knowledge base creation or when the knowledge base is not updated in time, the initial hit result is often unanswered, that is, the electronic device cannot find a matching answer from the knowledge base, which greatly affects the user experience. Therefore, the relevant knowledge corresponding to the unanswered query statement is filled and marked to facilitate filling the verified information corresponding to the query statement to be filled, thereby realizing the optimization operation of the knowledge base and improving the comprehensiveness and accuracy of the knowledge base content.
[0046] Specifically, when the initial hit result is unanswered, query expansion is performed based on the processed query word sequence to obtain an extended query word sequence, wherein the query expansion is used to find a phrase with the same or similar meaning and spelling as the processed query word sequence to form an extended query word sequence. Then, word embedding is performed based on the extended query word sequence to obtain an extended query vector, and query matching is performed with the knowledge base based on the extended query vector to obtain an extended hit result, and the extended hit result is sent to the user terminal. The series of operations after the above query expansion can reduce the probability of failing to hit the result due to human input errors and dialect personality input by the user, and to a certain extent improve the fault tolerance rate of the knowledge base hit. Furthermore, a filling mark is performed based on the query statement to be filled that is unanswered for the initial hit result, so as to fill the knowledge base with the verified information corresponding to the query statement to be filled, wherein the verified information is the authoritative knowledge supplemented by the technicians in the field of the query statement to be filled.
[0047] It can be seen that in the embodiment of the present application, when the initial hit result is unanswered, query expansion is performed based on the processed query word sequence to obtain an extended query word sequence. Then, word embedding is performed based on the extended query word sequence to obtain an extended query vector, and query matching is performed with the knowledge base based on the extended query vector to obtain an extended hit result, and the extended hit result is sent to the user terminal. The series of operations after the above query expansion can reduce the probability of failing to hit the result due to human input errors and dialect personality input by the user, and to a certain extent improve the fault tolerance rate of the knowledge base hit. Finally, a fill mark is performed based on the query statement to be filled that is unanswered for the initial hit result, so as to fill the verified information corresponding to the query statement to be filled in the knowledge base, thereby realizing the optimization operation of the knowledge base and improving the comprehensiveness and accuracy of the knowledge base content.
[0048] Furthermore, in order to continuously improve the accuracy and completeness of the knowledge base and provide users with better information services, in the embodiment of the present application, after optimizing the hit range based on the context information and the initial hit result to obtain the optimized hit result and sending the optimized hit result to the user terminal, it also includes: Obtain user evaluation information, perform accurate hit analysis based on the user evaluation information, and determine the hit accuracy; The accuracy threshold corresponding to the knowledge base optimization is obtained, and when the hit accuracy is lower than the accuracy threshold, a knowledge base optimization instruction is generated, wherein the knowledge base optimization instruction prompts the technician to optimize and fill the data in the knowledge base.
[0049] For the embodiment of the present application, after the user inputs the query statement using the electronic device and obtains the optimized hit result, the user can evaluate the search result. The user evaluation information is the user's evaluation of the relevance of the search result to the query statement, and the collected evaluation information is used for subsequent iterative optimization of the knowledge base data. That is, a star rating or a simple "relevant" and "irrelevant" option can be set in the evaluation interface. Therefore, based on the user evaluation information, a precise analysis of the hit is performed to determine the hit accuracy. For the precise analysis, if it is a star rating method, the average value of all ratings can be directly selected and recorded as the hit accuracy; if the "relevant" and "irrelevant" option method is adopted, the score can be calculated according to the proportion of users who select "relevant" to determine the hit accuracy. Then, the accuracy threshold corresponding to the knowledge base optimization is obtained. The accuracy threshold is an indicator determined based on historical data, industry standards, user expectations and other factors, and is pre-stored in the electronic device. Furthermore, the hit accuracy is compared with the accuracy threshold. When the hit accuracy is lower than the accuracy threshold, a knowledge base optimization instruction is generated, and the knowledge base optimization instruction prompts the technician to optimize and fill the data in the knowledge base. During the optimization filling process, the information corresponding to the search results with low hit accuracy will be adjusted. The optimization filling includes but is not limited to adding new knowledge points, updating outdated information, and correcting erroneous data. Through the above operations, a closed-loop optimization mechanism based on user feedback is formed, which continuously improves the accuracy and completeness of the knowledge base and provides users with better information services.
[0050] It can be seen that in the embodiment of the present application, a hit accuracy analysis is performed based on user evaluation information to determine the hit accuracy, and then, when the hit accuracy is lower than the accuracy threshold, a knowledge base optimization instruction is generated. Through the above operations, a closed-loop optimization mechanism based on user feedback is formed, which continuously improves the accuracy and completeness of the knowledge base and provides users with better information services.
[0051] The above embodiment introduces a knowledge base hit optimization method from the perspective of method flow, and the following embodiment introduces a knowledge base hit optimization device from the perspective of a virtual module or a virtual unit. For details, please refer to the following embodiment.
[0052] The present application embodiment provides a knowledge base hit optimization device, such as Figure 2 As shown, the knowledge base hit optimization device may specifically include: The word segmentation processing module 210 is used to obtain a query statement input by a user, perform word segmentation processing based on the query statement, and obtain a query word sequence; A preprocessing module 220 is used to perform preprocessing based on the query word sequence to obtain a processed query word sequence, wherein the preprocessing includes: removing stop words and punctuation marks; A word embedding module 230, configured to perform word embedding based on the processed query word sequence to obtain a query vector, wherein the query vector is a numerical representation of the query statement, and is used to represent the semantic information of the query statement; A query matching module 240 is used to obtain a knowledge base, perform query matching with the knowledge base based on the query vector, and determine an initial hit result; A context expansion module 250 is used to obtain a large language model, use the large language model to perform context expansion on the initial hit result, and generate context information corresponding to the initial hit result; The hit range optimization module 260 is used to optimize the hit range based on the context information and the initial hit result, obtain the optimized hit result, and send the optimized hit result to the user terminal, so as to provide the user with a comprehensive and accurate hit result.
[0053] For the embodiment of the present application, word segmentation is performed based on the query statement to obtain a query word sequence, and then, preprocessing is performed based on the query word sequence to obtain a processed query word sequence, and word segmentation and preprocessing operations are performed, which will eliminate the noise factors in the query statement, so that the query matching is more focused on key information, so as to improve the accuracy of the query semantics and the efficiency of the query matching. Then, word embedding is performed based on the processed query word sequence to obtain a query vector, and query matching is performed based on the query vector and the knowledge base to determine the initial hit result. Word embedding can also capture the semantic relationship between phrases, so that the query vector can more accurately represent the semantic information of the query statement, thereby improving the accuracy of the query matching. The initial hit result may be just an isolated knowledge point, lacking association and integration with other information, and therefore, the initial hit result is contextually expanded using a large language model, and context information corresponding to the initial hit result is generated, and the hit range is optimized based on the context information and the initial hit result to obtain an optimized hit result. Through context expansion, a richer and more complete knowledge system is provided to users, which improves the accuracy of the knowledge base hit result.
[0054] In a possible implementation of the embodiment of the present application, when the context expansion module 250 performs context expansion on the initial hit result using the large language model to generate context information corresponding to the initial hit result, it is used to: Inputting the initial hit result into the large language model, controlling the large language model to perform context expansion, and outputting first context information; Screening related items based on the initial hit result and the knowledge base to determine the second context information; Obtaining an external resource library, and performing additional information expansion based on the external resource library and the initial hit result to determine third context information; An interpolation operation is performed based on the first context information, the second context information, and the third context information to generate context information corresponding to the initial hit result.
[0055] In a possible implementation of the embodiment of the present application, when the word embedding module 230 performs word embedding based on the processed query word sequence to obtain the query vector, it is used to: When the processed query word sequence includes only one target query word, the target query word is transformed into a vector using a word embedding model to obtain a query vector; When the processed query word sequence includes at least two target query words, a combination analysis method is used to perform vector conversion on the at least two target query words to obtain a query vector, wherein the combination analysis method includes: an average method and a weighted summation method.
[0056] In a possible implementation of the embodiment of the present application, when the hit range optimization module 260 performs hit range optimization based on context information and the initial hit result to obtain the optimized hit result, it is used to: Perform hit fusion based on context information and initial hit results to determine a fused hit set; Multi-dimensional sorting is performed based on the fused hit set to obtain optimized hit results, wherein the multi-dimensional sorting is used to sort the hit results based on comprehensive information similarity and knowledge authority.
[0057] In a possible implementation of the embodiment of the present application, the knowledge base hit optimization device further includes: A knowledge base filling module is used to expand the query based on the processed query word sequence to obtain an expanded query word sequence when the initial hit result is unanswered; Based on the extended query word sequence, word embedding is performed to obtain an extended query vector, and query matching is performed with the knowledge base based on the extended query vector to obtain an extended hit result, and the extended hit result is sent to the user terminal; Based on the initial hit result, the unanswered query statements to be filled are marked for filling, so as to fill the verified information corresponding to the query statements to be filled into the knowledge base.
[0058] In a possible implementation of the embodiment of the present application, the knowledge base hit optimization device further includes: The knowledge base optimization module is used to obtain user evaluation information, perform accurate hit analysis based on the user evaluation information, and determine the hit accuracy; The accuracy threshold corresponding to the knowledge base optimization is obtained, and when the hit accuracy is lower than the accuracy threshold, a knowledge base optimization instruction is generated, wherein the knowledge base optimization instruction prompts the technician to optimize and fill the data in the knowledge base. Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of a knowledge base hit optimization device described above can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0059] An electronic device is provided in an embodiment of the present application, such as Figure 3 As shown, Figure 3 The electronic device 300 shown includes: a processor 301 and a memory 303. The processor 301 and the memory 303 are connected, such as through a bus 302. Optionally, the electronic device 300 may also include a transceiver 304. It should be noted that in actual applications, the transceiver 304 is not limited to one, and the structure of the electronic device 300 does not constitute a limitation on the embodiments of the present application.
[0060] The processor 301 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 301 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0061] The bus 302 may include a path to transmit information between the above components. The bus 302 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 302 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but it does not mean that there is only one bus or only one type of bus.
[0062] The memory 303 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0063] The memory 303 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 301. The processor 301 is used to execute the application code stored in the memory 303 to implement the contents shown in the above method embodiment.
[0064] The electronic devices include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server, etc. Figure 3 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0065] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment.
[0066] The embodiment of the present application provides a computer program product, which includes a computer program, which implements the method in any of the above embodiments when executed by a processor. Compared with the related art, the embodiment of the present application performs word segmentation processing based on the query statement to obtain a query word sequence, and then performs preprocessing based on the query word sequence to obtain a processed query word sequence, performs word segmentation processing and preprocessing operations, and eliminates noise factors in the query statement, so that the query matching is more focused on key information to improve the accuracy of the query semantics and the efficiency of the query matching. Further, a word embedding is performed based on the processed query word sequence to obtain a query vector, and a query matching is performed based on the query vector and the knowledge base to determine the initial hit result. Word embedding can also capture the semantic relationship between phrases, so that the query vector can more accurately represent the semantic information of the query statement, thereby improving the accuracy of the query matching. The initial hit result may be just an isolated knowledge point, lacking association and integration with other information, and therefore, the initial hit result is contextually expanded using a large language model, and context information corresponding to the initial hit result is generated, and the hit range is optimized based on the context information and the initial hit result to obtain an optimized hit result. Through context expansion, we provide users with a richer and more complete knowledge system, thereby improving the accuracy of knowledge base hit results.
[0067] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0068] The above are only some implementation methods of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A knowledge base hit optimization method, characterized in that: include: Obtaining a query statement input by a user, performing word segmentation processing based on the query statement, and obtaining a query word sequence; Preprocessing is performed based on the query word sequence to obtain a processed query word sequence, wherein the preprocessing includes: removing stop words and punctuation marks; Performing word embedding based on the processed query word sequence to obtain a query vector, wherein the query vector is a numerical representation of the query statement and is used to represent the semantic information of the query statement; Acquire a knowledge base, perform query matching on the query vector and the knowledge base, and determine an initial hit result; Acquire a large language model, and use the large language model to perform context expansion on the initial hit result to generate context information corresponding to the initial hit result; The hit range is optimized based on the context information and the initial hit result to obtain an optimized hit result, and the optimized hit result is sent to the user terminal to provide the user with a comprehensive and accurate hit result.
2. The knowledge base hit optimization method according to claim 1, characterized in that: The using the large language model to perform context expansion on the initial hit result to generate context information corresponding to the initial hit result includes: Inputting the initial hit result into the large language model, controlling the large language model to perform context expansion, and outputting first context information; Screening related items based on the initial hit result and the knowledge base to determine second context information; Acquire an external resource library, and perform additional information expansion based on the external resource library and the initial hit result to determine third context information; An interpolation operation is performed based on the first context information, the second context information, and the third context information to generate context information corresponding to the initial hit result.
3. The knowledge base hit optimization method according to claim 1, characterized in that: The word embedding is performed based on the processed query word sequence to obtain a query vector, including: When the processed query word sequence includes only one target query word, performing vector conversion on the target query word using a word embedding model to obtain a query vector; When the processed query word sequence includes at least two target query words, vector conversion is performed on the at least two target query words using a combination analysis method to obtain a query vector, wherein the combination analysis method includes: an average method and a weighted summation method.
4. The knowledge base hit optimization method according to claim 1, characterized in that: The optimizing the hit range based on the context information and the initial hit result to obtain the optimized hit result includes: Performing hit fusion based on the context information and the initial hit result to determine a fused hit set; Multi-dimensional sorting is performed based on the fused hit set to obtain optimized hit results, wherein the multi-dimensional sorting is used to sort the hit results based on comprehensive information similarity and knowledge authority.
5. The knowledge base hit optimization method according to claim 1, characterized in that: After performing query matching based on the query vector and the knowledge base to determine the initial hit result, the method further includes: When the initial hit result is unanswered, query expansion is performed based on the processed query word sequence to obtain an expanded query word sequence; Performing word embedding based on the extended query word sequence to obtain an extended query vector, performing query matching with the knowledge base based on the extended query vector to obtain an extended hit result, and sending the extended hit result to the user terminal; Based on the initial hit result, the unanswered query statements to be filled are marked for filling, so as to fill the verified information corresponding to the query statements to be filled into the knowledge base.
6. The knowledge base hit optimization method according to claim 1, characterized in that: After optimizing the hit range based on the context information and the initial hit result to obtain an optimized hit result and sending the optimized hit result to the user terminal, the method further includes: Obtaining user evaluation information, performing hit accuracy analysis based on the user evaluation information, and determining hit accuracy; The accuracy threshold corresponding to the knowledge base optimization is obtained, and when the hit accuracy is lower than the accuracy threshold, a knowledge base optimization instruction is generated, wherein the knowledge base optimization instruction prompts the technician to optimize and fill the data in the knowledge base.
7. An electronic device, characterized in that: include: at least one processor; Memory; At least one application, wherein the at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the knowledge base hit optimization method according to any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the knowledge base hit optimization method according to any one of claims 1 to 6.
9. A computer program product, characterized in that The method comprises a computer program, wherein the computer program is executed by a processor to perform the knowledge base hit optimization method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Semantic-based rapid knowledge hit method and device in question and answer system
CN113722452A
Reordering method and device for improving retrieval performance of AI large language model
CN117725183A
Knowledge retrieval method based on large language model and knowledge base management platform
CN118210875A
