A knowledge base hit optimization method, device, medium and product
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2026-08-11
AI Technical Summary
然而,在实际应用中,知识库的命中效果往往受到用户输入提示词的影响
基于查询语句进行分词处理,得到查询单词序列,然后,基于查询单词序列进行预处理,得到已处理查询单词序列,执行分词处理和预处理操作,会剔除查询语句中的噪声因素,使得查询匹配更加聚焦于关键信息,以提高查询语义的准确性和查询匹配的效率。进而,基于已处理查询单词序列进行词嵌入,得到查询向量,并基于查询向量与知识库进行查询匹配,确定初次命中结果。词嵌入还能够捕获词组之间的语义关系,使得查询向量能够更准确地表示查询语句的语义信息,从而提高了查询匹配的准确性。初次命中结果可能只是孤立的知识点,缺乏与其他信息的关联和整合,因而,利用大语言模型对初次命中结果进行上下文拓展,生成与初次命中结果对应的上下文信息,并基于上下文信息与初次命中结果进行命中范围优化,得到优化命中结果。通过上下文拓展来为用户提供一个更加丰富和完整的知识体系,提高了知识库命中结果的准确性。
Smart Images

Figure CN118939807B_ABST
Abstract
Description
Technical Field
[0001] This 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 Technology
[0002] In today's information age, knowledge bases, as systems for storing and managing large amounts of structured information, have become a key component in fields such as artificial intelligence, big data analytics, and intelligent customer service. Knowledge bases provide users with accurate and efficient information services by storing, managing, and retrieving structured or unstructured information. Efficient retrieval and accurate matching are crucial to the effectiveness of their application. However, in practical applications, the accuracy of knowledge base matching is often affected by user-input suggestions.
[0003] Currently, user-input suggestions often suffer from limited, incomplete, or inaccurate information. These incomplete suggestions make it difficult for the knowledge base to accurately match relevant information during retrieval, thus affecting the accuracy of the knowledge base's hit results.
[0004] Therefore, how to improve the accuracy of knowledge base hit results is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] The purpose of this application is to provide a knowledge base hit optimization method, device, medium, and product for solving at least one of the above-mentioned technical problems.
[0006] The above-mentioned inventive objective of this application is achieved through the following technical solutions: Firstly, this application provides a knowledge base hit optimization method, which adopts the following technical solution: A knowledge base hit optimization method includes: Obtain the query statement input by the user, perform word segmentation based on the query statement, and obtain the query word sequence; Preprocessing is performed on the query word sequence to obtain a processed query word sequence, wherein the preprocessing includes: removing stop words and punctuation marks; 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; Obtain the knowledge base, and perform a query matching based on the query vector and the knowledge base to determine the initial hit result; Obtain a large language model, and use the large language model to expand the context of the initial hit result to generate context information corresponding to the initial hit result; Based on the context information and the initial hit result, the hit range is optimized to obtain an optimized hit result, and the optimized hit result is sent to the user terminal to provide the user with comprehensive and accurate hit results.
[0007] By employing the aforementioned technical solution, word segmentation is performed on the query statement to obtain a sequence of query words. Then, preprocessing is performed on this sequence to obtain a processed sequence of query words. Word segmentation and preprocessing remove noise from the query statement, allowing query matching to focus more on key information, thus improving the accuracy of query semantics and the efficiency of query matching. Furthermore, word embedding is performed on the processed sequence of query words to obtain a query vector. This query vector is then matched against the knowledge base to determine the initial hit result. Word embedding also captures the semantic relationships between word groups, enabling the query vector to more accurately represent the semantic information of the query statement, thereby improving the accuracy of query matching. The initial hit result may only contain isolated knowledge points, lacking association and integration with other information. Therefore, a large language model is used to expand the context of the initial hit result, generating contextual information corresponding to the initial hit result. The hit range is then optimized based on this contextual information and the initial hit result to obtain an optimized hit result. Context expansion provides users with a richer and more complete knowledge system, improving the accuracy of knowledge base hit results.
[0008] In a preferred embodiment, this application can be further configured as follows: the use of the large language model to perform context expansion on the initial hit result, generating context information corresponding to the initial hit result, includes: The initial hit result is input into the large language model, and the large language model is controlled to perform context expansion and output the first context information. Based on the initial hit result and the knowledge base, relevant entries are filtered to determine the second context information; Obtain an external resource library, and expand upon the external resource library and the initial hit result with additional information to determine the third context information; Interpolation 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 embodiment, this application can be further configured such that: the word embedding based on the processed query word sequence to obtain the query vector includes: When the processed query word sequence contains 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, the at least two target query words are vectorized using a combination analysis method to obtain a query vector. The combination analysis method includes: averaging and weighted summation.
[0010] In a preferred embodiment, this application can be further configured as follows: the step of optimizing the hit range based on the context information and the initial hit result to obtain an optimized hit result includes: Based on the context information and the initial hit result, a hit fusion is performed to determine the fused hit set; Based on the fused hit set, a multidimensional ranking is performed to obtain optimized hit results. The multidimensional ranking is used to rank the hit results by combining information similarity and knowledge authority.
[0011] In a preferred embodiment, this application can be further configured such that, after performing query matching based on the query vector and the knowledge base to determine the initial hit result, it also includes: When the initial hit result is no answer, the query is expanded based on the processed query word sequence to obtain an expanded query word sequence. Word embedding is performed based on the extended query word sequence to obtain an extended query vector. The extended query vector is then matched with the knowledge base to obtain an extended hit result, which is then sent to the user terminal. The query statements to be filled are marked as unanswered based on the initial hit result, so as to fill the knowledge base with the verified information corresponding to the query statements to be filled.
[0012] In a preferred embodiment, this application can 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: Obtain user review information, perform hit accuracy analysis based on the user review information, and determine the hit accuracy; Obtain the accuracy threshold corresponding to knowledge base optimization. When the hit accuracy is lower than the accuracy threshold, generate a knowledge base optimization instruction, wherein the knowledge base optimization instruction prompts technicians to optimize and populate the data in the knowledge base.
[0013] Secondly, this application provides an electronic device that adopts the following technical solution: At least one processor; Memory; At least one application, wherein the at least one application is stored in memory and configured to be executed by at least one processor, the at least one application being configured to: execute the knowledge base hit optimization method described above.
[0014] Thirdly, this application provides a computer-readable storage medium, which adopts the following technical solution: A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the knowledge base hit optimization method described above.
[0015] Fourthly, this application provides a computer program product, which adopts the following technical solution: A computer program product includes a computer program that, when executed by a processor, implements the aforementioned knowledge base hit optimization method.
[0016] In summary, this application includes at least one of the following beneficial technical effects: The query statement is segmented to obtain a sequence of query words. This sequence is then preprocessed to obtain a processed sequence of query words. The segmentation and preprocessing remove noise from the query statement, allowing the query match to focus more on key information, thus improving the accuracy and efficiency of the query semantics. Next, word embedding is performed on the processed query word sequence to obtain a query vector. This vector is then matched against the knowledge base to determine the initial hit result. Word embedding also captures the semantic relationships between word groups, enabling the query vector to more accurately represent the semantic information of the query statement, thereby improving the accuracy of the query match. The initial hit result may only contain isolated knowledge points, lacking connection and integration with other information. Therefore, a large language model is used to expand the context of the initial hit result, generating contextual information corresponding to the initial hit result. The hit range is then optimized based on this contextual information and the initial hit result to obtain an optimized hit result. This context expansion provides users with a richer and more complete knowledge system, improving the accuracy of the knowledge base hit result.
[0017] Hit fusion is performed based on contextual information and the initial hit result to determine a fused hit set. Hit fusion mainly combines the two types of information, making the content in the fused hit set more comprehensive. Then, multi-dimensional sorting is performed based on the fused hit set to obtain optimized hit results. The fused hit method based on contextual information and the initial hit result can more comprehensively consider the correlation and dependency between information, thereby improving the accuracy of the hit results. Attached Figure Description
[0018] Figure 1This is a flowchart illustrating a knowledge base hit optimization method according to one embodiment of this application; Figure 2 This is a schematic diagram of the structure of a knowledge base hit optimization device according to one embodiment of this application; Figure 3 This is a schematic diagram of the structure of an electronic device according to one embodiment of this application. Detailed Implementation
[0019] The following combination Figures 1 to 3 This application will be described in further detail.
[0020] This specific embodiment is merely an explanation of this application and is not intended to limit it. After reading this specification, those skilled in the art can make modifications to this embodiment without contributing any inventive step, but such modifications are protected by patent law as long as they are within the scope of this application.
[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. It should be noted that in the optional embodiments of this application, the object information and other related data involved require the permission or consent of the object when the embodiments of this application are applied to specific products or technologies, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. That is to say, if the embodiments of this application involve data related to the object, it needs to be obtained with the authorization and consent of the object, the authorization and consent of the relevant departments, and in compliance with the relevant laws, regulations, and standards of the country and region. If personal information is involved in the embodiments, the acquisition of all personal information requires the consent of the individual. If sensitive information is involved, the separate consent of the information subject is required, and the embodiments also need to be implemented with the authorization and consent of the object.
[0022] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article, unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship.
[0023] The embodiments of this application will now be described in further detail with reference to the accompanying drawings.
[0024] This application provides a knowledge base hit optimization method, executed by an electronic device, which can be a server or a terminal device. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal device can be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these. The terminal device and the server can be directly or indirectly connected via wired or wireless communication. This application does not impose any limitations on this. Figure 1 As shown, the method includes steps S101, S102, S103, S104, S105, and S106, wherein: Step S101: Obtain the query statement input by the user, perform word segmentation based on the query statement, and obtain the query word sequence; Step S102: Preprocess based on the query word sequence to obtain the processed query word sequence, wherein the preprocessing includes: removing stop words and punctuation marks.
[0025] In this embodiment of the application, users can use electronic devices to query relevant information they wish to know. Therefore, they input a query statement on the query interface of the electronic device, and then the query statement is segmented into words to obtain a sequence of query words. For word segmentation, word segmentation algorithms from natural language processing are used to segment the query statement. These algorithms include, but are not limited to, rule-based segmentation, statistical segmentation, and deep learning-based segmentation. This results in the original query statement being divided into individual words or phrases, which are arranged in the order they appear in the original statement, forming a sequence of query words. Since the sequence of query words usually contains some meaningless phrases, such as stop words and punctuation marks, these meaningless phrases are generally considered noise in the query matching process and can affect the efficiency of subsequent query matching and the accuracy of the query semantics to some extent. Therefore, preprocessing is performed based on the query word sequence to obtain a processed query word sequence. Preprocessing removes stop words, punctuation marks, and other phrases without substantial meaning. By removing noise through preprocessing, query matching becomes more focused on key information, thereby improving the accuracy of query semantics and the efficiency of query matching. Regarding stop word removal in preprocessing, a stop word list is pre-stored within the electronic device. This list includes various commonly used stop words. Each phrase in the query word sequence is iterated over, and its presence in the stop word list is checked. If it is, the phrase is removed from the query word sequence. Similarly, regarding highlighting punctuation marks in preprocessing, a punctuation mark set is pre-stored within the electronic device. This set includes various punctuation marks. Each phrase in the query word sequence is iterated over, and its presence in the punctuation mark set is checked. If it is, the phrase is removed from the query word sequence. Of course, preprocessing may also include: converting to lowercase (e.g., converting all words to lowercase to eliminate the impact of case on the query), removing special characters (e.g., in addition to punctuation marks, other special characters such as HTML tags, URLs, etc. may also be removed), single connection or splitting (e.g., for some languages, it may be necessary to connect adjacent words or split compound words into individual words). The specific implementation of the preprocessing operations is not limited in the embodiments of this application.
[0026] Step S103: Perform word embedding based on the processed query word sequence to obtain the query vector, where 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: Obtain the knowledge base, perform query matching based on the query vector and the knowledge base, and determine the initial hit result.
[0027] In this embodiment, word embedding of the processed query word sequence converts text data into a numerical representation, facilitating the use of efficient vector computation algorithms to accelerate the query matching process. Compared to traditional string-based matching methods, word embedding-based matching finds results related to the query statement more quickly, improving query efficiency. Simultaneously, word embedding captures semantic relationships between word groups, enabling query vectors to more accurately represent the semantic information of the query statement, thereby improving query matching accuracy. Furthermore, as a numerical representation, the query vector supports more complex query requirements, such as semantic similarity queries and context-dependent queries.
[0028] Specifically, word embedding is performed based on the processed query word sequence to obtain a query vector. For the word embedding operation, a word embedding model is selected. Using this model, each word group in the processed query word sequence is mapped to a corresponding word vector. That is, when the processed query word sequence contains only one target query word, the word embedding model is used to transform the target query word into a vector, resulting in a query vector. When the processed query word sequence contains at least two target query words, a combinatorial analysis method is used to transform the vectors of at least two target query words, resulting in a query vector. The combinatorial analysis method includes averaging and weighted summation. For the word embedding model, pre-trained models such as Word2Vec and GloVe can be used. Preferably, to further improve the accuracy of query matching, the query vector can be optimized, for example, by adding contextual information or using attention mechanisms to fine-tune the query vector.
[0029] Furthermore, the electronic device pre-stores a knowledge base. A knowledge base is a system or repository that centrally stores and manages structured and unstructured information, used to store and query relevant knowledge in a specific domain. This 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. As the amount of data increases and domain knowledge is continuously updated, the knowledge base is also constantly maintained and updated. Information in the knowledge base is usually stored in a structured form, including entities, relationships, attributes, etc. Entities are typically represented as vectors to facilitate query matching with query vectors. Then, a query matching process is performed based on the query vector and the knowledge base to determine the initial hit result. For query matching, vector similarity calculation methods can be used to compare the similarity between the query vector and the vector representation of the entity in the knowledge base. Based on the similarity score, the relevant information most similar to the query vector is determined as the initial hit result. Of course, a similarity threshold can be set within the electronic device; only when the similarity score exceeds this threshold is the result considered a hit. This operation helps filter out results that are not very relevant to the query.
[0030] Step S105: Obtain the large language model, and use the large language model to expand the context of the initial hit result to generate context information corresponding to the initial hit result; Step S106: Optimize the hit range based on context information and the initial hit result to obtain the optimized hit result, and send the optimized hit result to the user terminal so as to provide the user with comprehensive and accurate hit results.
[0031] In the embodiments of this application, the initial hit result may only be an isolated knowledge point, lacking connection and integration with other information. However, this lack of contextual association makes it difficult for users to link it with other knowledge to form a complete knowledge system. Therefore, contextual expansion provides users with a richer and more complete knowledge system, enhancing their cognition and understanding, thereby improving their user experience and satisfaction.
[0032] Specifically, this involves acquiring a large language model, an artificial intelligence model trained on massive amounts of data, designed to understand and generate natural language text, providing users with richer and more accurate information. The large language model is used to expand the context of the initial hit result, generating contextual information corresponding to the initial hit result. This contextual information is closely related to the initial hit result, providing users with a more comprehensive understanding and reference. There are various methods for context expansion. In one feasible approach, the initial hit result is passed as input to the large language model. Based on its trained language knowledge and contextual information, the large language model understands and analyzes the initial hit result, generating contextual information related to the initial hit result. This information may include background knowledge, related concepts, explanations, etc. In another feasible approach, the initial hit result is input into a large language model, which then expands the context to output first contextual information. Based on the initial hit result and a knowledge base, relevant entries are filtered to determine second contextual information. An external resource library is retrieved, and additional information is expanded based on this library and the initial hit result to determine third contextual information. Interpolation is then performed on the first, second, and third contextual information to generate contextual information corresponding to the initial hit result. This contextual information is then integrated with the initial hit result—either as a supplement or by associating it with the initial hit result—to form a more complete and richer result set. Next, based on the integrated contextual information and the initial hit result, reordering, filtering, or clustering operations are performed to obtain optimized hit results, making them more accurate. Finally, the optimized hit results are sent to the user's terminal, providing the user with more comprehensive and accurate search results.
[0033] As can be seen, in this embodiment, word segmentation is performed on the query statement to obtain a query word sequence. Then, preprocessing is performed on the query word sequence to obtain a processed query word sequence. Performing word segmentation and preprocessing removes noise factors from the query statement, making query matching more focused on key information, thereby improving the accuracy of query semantics and the efficiency of query matching. Furthermore, word embedding is performed on the processed query word sequence to obtain a query vector, and query matching is performed between the query vector and the knowledge base to determine the initial hit result. Word embedding can also capture the semantic relationships between word groups, enabling the query vector to more accurately represent the semantic information of the query statement, thus improving the accuracy of query matching. The initial hit result may only be an isolated knowledge point, lacking association and integration with other information. Therefore, a large language model is used to expand the context of the initial hit result, generating context information corresponding to the initial hit result. The hit range is then optimized based on the context information and the initial hit result to obtain an optimized hit result. Context expansion provides users with a richer and more complete knowledge system, improving the accuracy of knowledge base hit results.
[0034] Furthermore, to make the final determined context information more comprehensive and richer, in this embodiment of the application, a large language model is used to expand the context of the initial hit result, generating context information corresponding to the initial hit result, including: The initial hit result is input into the large language model, which is then controlled to expand the context and output the first context information. Based on the initial hit results and the knowledge base, relevant entries are filtered to determine the second context information; Obtain external resource libraries and expand upon them with additional information based on the external resource libraries and the initial hit results to determine third context information; Interpolation 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] In the embodiments of this 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. This first context information may be one or more descriptive texts, providing background, details, and explanations of the initial hit result. Simultaneously, based on the initial hit result and the knowledge base, relevant entries are filtered to determine second context information. That is, using natural language processing technology, key phrases are extracted from the initial hit result. These key phrases reflect the main body or key content of the initial hit result. Relevant entries are filtered based on key sentences and the knowledge base, and the filtered relevant entries are integrated and formatted to generate second context information. The second context information includes detailed information, facts, and relationships related to the topic of the initial hit result, providing users with more comprehensive and accurate search results and contextual support. Furthermore, an external resource library is acquired. This external resource library can be a resource library outside of the knowledge base, such as a search engine, knowledge graph, or professional database, to provide multi-dimensional and multi-level additional information. Therefore, utilizing external resource libraries to query and expand the initial hit results with additional information to obtain richer third contextual information, and introducing external resource libraries 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. Furthermore, interpolation algorithms (e.g., linear interpolation, polynomial interpolation, etc.) are used to interpolate the first, second, and third contextual information. The contextual information complements each other to fill in or supplement missing content, and necessary post-processing is performed on the interpolation results, such as deduplication, sorting, and formatting, to help ensure the accuracy and readability of the generated contextual information. Finally, the contextual information corresponding to the initial hit result is determined, which can better capture the inherent relationships between texts. During the context expansion process, three methods are used to obtain the corresponding contextual information, and the contextual information obtained by the three methods is combined to make the final determined contextual information more comprehensive and richer.
[0036] As can be seen, in this embodiment, the initial hit result is input into a large language model, which then performs context expansion and outputs first context information. Simultaneously, based on the initial hit result and the knowledge base, relevant entries are filtered to determine second context information. Furthermore, based on an external resource library and the initial hit result, additional information is expanded to determine third context information. Finally, interpolation is performed based on the first, second, and third context information to generate context information corresponding to the initial hit result. During the context expansion process, three methods are used to obtain the corresponding context information, and the context information obtained from these three methods is integrated, resulting in more comprehensive and richer final context information.
[0037] Furthermore, in order for the query vector to more accurately represent the overall semantics of the query, in this embodiment, word embedding is performed based on the processed query word sequence to obtain the query vector, including: When the processed query word sequence contains only one target query word, the target query word is transformed into a vector using a word embedding model to obtain the query vector; When the processed query word sequence contains at least two target query words, the at least two target query words are transformed into a query vector using a combinatorial analysis method. The combinatorial analysis method includes: averaging and weighted summation.
[0038] In the embodiments of this application, word embedding is a necessary step to transform text data into a numerical form that machines can understand and process. Using the query vector as input features can significantly improve the matching efficiency of knowledge base query matching. In performing word embedding, different processing methods are used for cases with one target query word and cases with at least two target query words. This 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 contains only one target query word, a pre-trained word embedding model is selected, such as Word2Vec, GloVe, FastText, or a Transformer-based model. The processed query word sequence is used as input data to the word embedding model to query the query vector corresponding to the target query word. If the target query word is not 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 contains at least two target query words, a combinatorial analysis method is used to transform the vectors of at least two target query words to obtain the query vector. The combinatorial analysis method includes averaging and weighted summation. For averaging, the vectors of all target query words are summed and then divided by the number of target query words, i.e., (V1 + V2 + ... + Vn) / n, where 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 based on their importance in the query, and then a weighted summation is performed. The weights 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 avoids the noise or information loss that may be introduced by aggregating multiple word embeddings, and also improves the computational efficiency of word embedding operations. For multiple target query words, determining the query vector through combinatorial analysis can more accurately represent the overall semantics of the query and capture the semantic relationships between multiple target query words.
[0040] As can be seen, in this embodiment, when the processed query word sequence contains only one target query word, the target query word is vectorized using a word embedding model to obtain a query vector. When the processed query word sequence contains at least two target query words, the at least two target query words are vectorized using a combinatorial analysis method to obtain a query vector. Using different processing methods for the cases with one target query word and at least two target query words helps the query vector to more accurately represent the overall semantics of the query and flexibly adapt to different query lengths.
[0041] Furthermore, to more comprehensively consider the correlation and dependency between information, thereby improving the accuracy of the hit results, in this embodiment of the application, the hit range is optimized based on contextual information and the initial hit result to obtain optimized hit results, including: Based on contextual information and the initial hit result, hit fusion is performed to determine the fused hit set; Multidimensional ranking is performed based on the fused hit set to obtain optimized hit results. The multidimensional ranking is used to sort the hit results by combining information similarity and knowledge authority.
[0042] In this embodiment, a hit fusion is performed based on contextual information and the initial hit result to determine a fused hit set. Hit fusion primarily combines the two types of information, making the content in the fused hit set more comprehensive. The hit fusion strategy can be based on different algorithms or models, such as rule-based fusion, machine learning-based fusion, etc. Then, multi-dimensional ranking is performed based on the fused hit set to obtain optimized hit results. Multi-dimensional ranking is used to rank the hit results by comprehensively considering information similarity and knowledge authority. Information similarity measures the relevance of the hit results to the user query, while knowledge authority assesses the credibility and authority of the information in the fused hit set. For information similarity ranking, a similarity algorithm is used to calculate the similarity between each hit combination in the fused hit set and the query statement, determining a similarity score for each hit combination. A higher similarity score indicates that the hit combination is more relevant to the query. For ranking knowledge authority, an authority score is assigned based on the credibility (e.g., whether it comes from authoritative news websites, professional databases, etc.), accuracy (e.g., whether it has cited sources and fact-checking), and timeliness (e.g., considering publication date and update frequency) of each hit combination in the fusion hit set. A higher authority score indicates a more reliable hit result. Then, the weights corresponding to similarity and knowledge authority are obtained, with the weights determined based on experience and expert opinions. Next, a comprehensive score is calculated for each hit combination based on its similarity and authority scores, as well as the weight distribution. This comprehensive score can be calculated using weighted summation, weighted product, or other comprehensive scoring algorithms. Finally, each hit combination in the fusion hit set is ranked according to its comprehensive score to determine the optimal hit result. This fusion hit method, based on contextual information and initial hit results, can more comprehensively consider the correlation and dependence between information, thereby improving the accuracy of the hit results.
[0043] As can be seen, in this embodiment, a hit fusion is performed based on contextual information and the initial hit result to determine a fused hit set. Hit fusion is mainly used to combine the two types of information, making the content in the fused hit set more comprehensive. Then, multi-dimensional sorting is performed based on the fused hit set to obtain optimized hit results. The fused hit method based on contextual information and the initial hit result can more comprehensively consider the correlation and dependency between information, thereby improving the accuracy of the hit results.
[0044] Furthermore, in order to optimize the knowledge base and improve the comprehensiveness and accuracy of its content, in this embodiment, after matching the query vector with the knowledge base to determine the initial hit result, the following steps are also included: When the initial hit result is no answer, the query is expanded based on the processed query word sequence to obtain the expanded query word sequence; Word embedding is performed based on the extended query word sequence to obtain the extended query vector. The extended query vector is then matched with the knowledge base to obtain the extended hit result, which is then sent to the user terminal. The query statements that are initially unanswered are marked for filling, so that the verified information corresponding to the query statements can be added to the knowledge base.
[0045] In the embodiments of this application, during the initial creation of the knowledge base or when updates are not timely, the initial hit result often results in an unanswered question, meaning the electronic device cannot find a matching answer in the knowledge base. This situation significantly impacts the user experience. Therefore, by filling in the relevant knowledge corresponding to unanswered queries with tags, the verified information corresponding to the queries to be filled in is updated. This optimizes the knowledge base and improves the comprehensiveness and accuracy of its content.
[0046] Specifically, 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. This expansion involves finding phrases with the same or similar meaning and spelling as the processed query word sequence. Then, word embedding is performed based on the expanded query word sequence to obtain an expanded query vector. This vector is then matched against the knowledge base to obtain an expanded hit result, which is sent to the user's terminal. This series of operations after query expansion reduces the probability of missing results due to user input errors or dialectal input, thus improving the knowledge base's hit tolerance to some extent. Furthermore, the query statement to be filled, which initially resulted in an unanswered hit, is marked for filling, facilitating the addition of verified information corresponding to the query statement to the knowledge base. This verified information consists of authoritative knowledge provided by professionals in the field of the query statement to address the issue.
[0047] As can be seen, in this embodiment, 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. Then, word embedding is performed based on the expanded query word sequence to obtain an expanded query vector, and query matching is performed between the expanded query vector and the knowledge base to obtain an expanded hit result, which is then sent to the user terminal. This series of operations after query expansion reduces the probability of missing results due to user input errors or dialectal input, thus improving the knowledge base's fault tolerance rate to a certain extent. Finally, the query statements to be filled are marked as unanswered in the initial hit result to facilitate the filling of the knowledge base with the verified information corresponding to the query statements to be filled, thereby optimizing 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 this embodiment of the application, after optimizing the hit range based on 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: Obtain user review information, perform accuracy analysis based on user review information, and determine the accuracy of the hit; Obtain the accuracy threshold corresponding to knowledge base optimization. When the accuracy of the hit is lower than the accuracy threshold, generate a knowledge base optimization instruction. The knowledge base optimization instruction prompts the technicians to optimize and populate the data in the knowledge base.
[0049] In this embodiment, after a user inputs a query using an electronic device and obtains optimized hit results, they can evaluate the search results. User evaluation information reflects the relevance of the search results to the query, and the collected evaluation information is used for subsequent iterative optimization of the knowledge base data. Specifically, a star rating or a simple "relevant" or "irrelevant" option can be set in the evaluation interface. Therefore, a hit accuracy analysis is performed based on user evaluation information to determine the hit accuracy. For accuracy analysis, if a star rating method is used, the average of all ratings can be directly selected as the hit accuracy; if a "relevant" or "irrelevant" option method is used, the score can be calculated based on the proportion of users selecting "relevant" to determine the hit accuracy. Then, the accuracy threshold corresponding to knowledge base optimization is obtained. The accuracy threshold is an indicator determined based on historical data, industry standards, and user expectations, 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, prompting technicians to optimize and populate the data in the knowledge base. During the optimization and population process, the focus is on adjusting the information corresponding to search results with low accuracy. This optimization includes, but is not limited to, adding new knowledge points, updating outdated information, and correcting erroneous data. Through these operations, a closed-loop optimization mechanism based on user feedback is formed, continuously improving the accuracy and completeness of the knowledge base and providing users with higher-quality information services.
[0050] As can be seen, in this embodiment, a hit accuracy analysis is performed based on user evaluation information to determine the hit accuracy. 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 embodiments describe a knowledge base hit optimization method from the perspective of process flow. The following embodiments describe a knowledge base hit optimization device from the perspective of virtual modules or virtual units. For details, please refer to the following embodiments.
[0052] This application 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 module 210 is used to obtain the query statement input by the user, perform word segmentation based on the query statement, and obtain the query word sequence. The preprocessing module 220 is used to preprocess the query word sequence to obtain a processed query word sequence. The preprocessing includes removing stop words and punctuation marks. The word embedding module 230 is used 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; The query matching module 240 is used to obtain the knowledge base, perform query matching based on the query vector and the knowledge base, and determine the initial hit result. The context expansion module 250 is used to obtain a large language model, expand the context of the initial hit result using the large language model, 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 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 comprehensive and accurate hit results.
[0053] In this embodiment, word segmentation is performed on the query statement to obtain a sequence of query words. Then, preprocessing is performed on this sequence to obtain a processed sequence of query words. The word segmentation and preprocessing operations remove noise from the query statement, making the query matching more focused on key information, thus improving the accuracy of the query semantics and the efficiency of query matching. Furthermore, word embedding is performed on the processed sequence of query words to obtain a query vector. This query vector is then matched against the knowledge base to determine the initial hit result. Word embedding can also capture the semantic relationships between word groups, allowing the query vector to more accurately represent the semantic information of the query statement, thereby improving the accuracy of query matching. The initial hit result may only be an isolated knowledge point, lacking association and integration with other information. Therefore, a large language model is used to expand the context of the initial hit result, generating contextual information corresponding to the initial hit result. The hit range is then optimized based on the contextual information and the initial hit result to obtain an optimized hit result. Context expansion provides users with a richer and more complete knowledge system, improving the accuracy of the knowledge base hit result.
[0054] In one possible implementation of this application embodiment, when the context expansion module 250 performs context expansion on the initial hit result using a large language model to generate context information corresponding to the initial hit result, it is used for: The initial hit result is input into the large language model, which is then controlled to expand the context and output the first context information. Based on the initial hit results and the knowledge base, relevant entries are filtered to determine the second context information; Obtain external resource libraries and expand upon them with additional information based on the external resource libraries and the initial hit results to determine third context information; Interpolation 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 one possible implementation of this application embodiment, 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 contains only one target query word, the target query word is transformed into a vector using a word embedding model to obtain the query vector; When the processed query word sequence contains at least two target query words, the at least two target query words are transformed into a query vector using a combinatorial analysis method. The combinatorial analysis method includes: averaging and weighted summation.
[0056] In one possible implementation of this application embodiment, when the hit range optimization module 260 performs hit range optimization based on context information and the initial hit result to obtain an optimized hit result, it is used to: Based on contextual information and the initial hit result, hit fusion is performed to determine the fused hit set; Multidimensional ranking is performed based on the fused hit set to obtain optimized hit results. The multidimensional ranking is used to sort the hit results by combining information similarity and knowledge authority.
[0057] One possible implementation of this application embodiment, the knowledge base hit optimization device, further includes: The knowledge base population module is used to expand the query based on the processed query word sequence when the initial hit result is no answer, and to obtain the expanded query word sequence. Word embedding is performed based on the extended query word sequence to obtain the extended query vector. The extended query vector is then matched with the knowledge base to obtain the extended hit result, which is then sent to the user terminal. The query statements that are initially unanswered are marked for filling, so that the verified information corresponding to the query statements can be added to the knowledge base.
[0058] One possible implementation of this application embodiment, the knowledge base hit optimization device, further includes: The knowledge base optimization module is used to obtain user evaluation information, perform hit accuracy analysis based on user evaluation information, and determine the hit accuracy. Obtain the accuracy threshold corresponding to knowledge base optimization. When the accuracy of the hit is lower than the accuracy threshold, generate a knowledge base optimization instruction. The knowledge base optimization instruction prompts the technicians to optimize and populate the data in the knowledge base. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the knowledge base hit optimization device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0059] This application provides an electronic device, such as... Figure 3 As shown, Figure 3 The illustrated electronic device 300 includes a processor 301 and a memory 303. The processor 301 and the memory 303 are connected, for example, via a bus 302. Optionally, the electronic device 300 may also include a transceiver 304. It should be noted that in practical applications, the transceiver 304 is not limited to one type, and the structure of this electronic device 300 does not constitute a limitation on the embodiments of this application.
[0060] 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 can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 301 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0061] Bus 302 may include a pathway for transmitting information between the aforementioned components. Bus 302 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 302 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 3 The symbol is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0062] The memory 303 may be a ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory) or other type of dynamic storage device capable of storing information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0063] The memory 303 is used to store application code that executes the solution of this application, and its 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 content shown in the foregoing method embodiments.
[0064] Electronic devices include, but are not limited to: mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Servers can also be included. Figure 3 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0065] This application provides a computer-readable storage medium storing a computer program that, when run on a computer, enables the computer to execute the corresponding content in the aforementioned method embodiments.
[0066] This application provides a computer program product, including a computer program that, when executed by a processor, implements the methods described in any of the above embodiments. Compared with related technologies, this application embodiment performs word segmentation based on a query statement to obtain a query word sequence. Then, it performs preprocessing based on the query word sequence to obtain a processed query word sequence. Performing word segmentation and preprocessing operations removes noise factors from the query statement, making query matching more focused on key information, thereby improving the accuracy of query semantics and the efficiency of query matching. Furthermore, 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 relationships between word groups, enabling the query vector to more accurately represent the semantic information of the query statement, thereby improving the accuracy of query matching. The initial hit result may only be an isolated knowledge point, lacking association and integration with other information. Therefore, a large language model is used to expand the context of the initial hit result, generating context information corresponding to the initial hit result, and the hit range is optimized based on the context information and the initial hit result to obtain an optimized hit result. By expanding the context, a richer and more complete knowledge system is provided to users, improving the accuracy of knowledge base hit results.
[0067] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0068] The above are only some embodiments of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A knowledge base hit optimization method, characterized in that, include: Obtain the query statement input by the user, perform word segmentation based on the query statement, and obtain the query word sequence; Preprocessing is performed on the query word sequence to obtain a processed query word sequence, wherein the preprocessing includes: removing stop words and punctuation marks; 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; Obtain the knowledge base, and perform a query matching based on the query vector and the knowledge base to determine the initial hit result; Obtain a large language model, and use the large language model to expand the context of the initial hit result to generate context information corresponding to the initial hit result; Based on the context information and the initial hit result, the hit range is optimized to obtain an optimized hit result, and the optimized hit result is sent to the user terminal to provide the user with comprehensive and accurate hit results; The step of using the large language model to perform context expansion on the initial hit result and generating context information corresponding to the initial hit result includes: The initial hit result is input into the large language model, and the large language model is controlled to perform context expansion and output the first context information. Based on the initial hit result and the knowledge base, relevant entries are filtered to determine the second context information; Obtain an external resource library, and expand upon the external resource library and the initial hit result with additional information to determine the third context information; Interpolation 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.
2. The knowledge base hit optimization method according to claim 1, characterized in that, The step of embedding words based on the processed query word sequence to obtain a query vector includes: When the processed query word sequence contains 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, the at least two target query words are vectorized using a combination analysis method to obtain a query vector. The combination analysis method includes: averaging and weighted summation.
3. The knowledge base hit optimization method according to claim 1, characterized in that, The step of optimizing the hit range based on the context information and the initial hit result to obtain the optimized hit result includes: Based on the context information and the initial hit result, a hit fusion is performed to determine the fused hit set; Based on the fused hit set, a multidimensional ranking is performed to obtain optimized hit results. The multidimensional ranking is used to rank the hit results by combining information similarity and knowledge authority.
4. The knowledge base hit optimization method according to claim 1, characterized in that, After determining the initial hit result by performing a query matching based on the query vector and the knowledge base, the process further includes: When the initial hit result is no answer, the query is expanded based on the processed query word sequence to obtain an expanded query word sequence. Word embedding is performed based on the extended query word sequence to obtain an extended query vector. The extended query vector is then matched with the knowledge base to obtain an extended hit result, which is then sent to the user terminal. The query statements to be filled are marked as unanswered based on the initial hit result, so as to fill the knowledge base with the verified information corresponding to the query statements to be filled.
5. 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: Obtain user review information, perform hit accuracy analysis based on the user review information, and determine the hit accuracy; Obtain the accuracy threshold corresponding to knowledge base optimization. When the hit accuracy is lower than the accuracy threshold, generate a knowledge base optimization instruction, wherein the knowledge base optimization instruction prompts technicians to optimize and populate the data in the knowledge base.
6. 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 memory and configured to be executed by at least one processor, said at least one application being configured to: perform the knowledge base hit optimization method according to any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed in a computer, causes the computer to perform the knowledge base hit optimization method according to any one of claims 1 to 5.
8. A computer program product, characterized in that, It includes a computer program, which is executed by a processor using the knowledge base hit optimization method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Semantic-based rapid knowledge hit method and device in question and answer system
CN113722452A
Knowledge retrieval method based on large language model and knowledge base management platform
CN118210875A