Knowledge database updating method, computer program product and electronic device
By calculating the matrix similarity and structural conflict rate between description texts, the vector knowledge database is automatically updated, which solves the problem of manual review being difficult to ensure timely updates, improves efficiency and reduces costs, and ensures the timeliness and accuracy of the knowledge base. quality.
Patent Information
- Application Number
- CN202410831998.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-06-26
AI Technical Summary
In large-scale document data, manual review is difficult to ensure the timely update efficiency of the vector knowledge database, resulting in increased review costs and inability to effectively handle outdated information.
By calculating the matrix similarity between description texts, we filter out knowledge with high and low timeliness, perform knowledge update operations such as deletion, abandonment or downgrade processing, and automatically update the knowledge database using vector similarity and structural conflict rate scores.
It improves the timeliness update efficiency of the knowledge database, reduces audit costs, realizes automated knowledge base information update and content classification, and ensures the timeliness and quality of knowledge.
Smart Images

Figure CN118377789B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a knowledge database updating method, a computer program product and an electronic device. Background Art
[0002] Vector knowledge database is a database specially designed to store and manage vector embeddings. It can effectively store and index large amounts of high-dimensional vector data. In production practice, users' original data formats vary. Among them, text format data usually needs to be cleaned and processed before it is suitable for being transferred to the vector knowledge database for retrieval. Redundant, outdated or inaccurate data will directly affect the output quality of the relevant model question answering system. Therefore, it is crucial to regularly update the data set and automatically clean up outdated information.
[0003] In related technologies, the update of relevant knowledge in the vector knowledge database is usually carried out by manual review. That is, when new knowledge is entered into the database, it is manually determined which one is more timely, the new knowledge or the original knowledge in the knowledge base, and the knowledge is updated accordingly.
[0004] However, when the document data volume is large, updates are frequent, or the knowledge domain spans a wide range, it is difficult to ensure the efficiency of knowledge updating by using manual review, and increasing the number of reviewers will also lead to a sharp increase in review costs. Summary of the invention
[0005] The purpose of this application is to provide a knowledge database updating method, a computer program product and an electronic device for determining knowledge with higher timeliness and authority by judging the matrix similarity form between description texts, and processing outdated knowledge.
[0006] The present application provides a knowledge database updating method, comprising:
[0007] A target document newly added to a knowledge database is obtained, and based on the vector similarity calculation result, multiple similar documents similar to the target document are screened out from the knowledge database; entity extraction is performed based on the target document and the multiple similar documents to obtain at least one entity and a first description text corresponding to each entity and a second description text corresponding to each entity; one entity corresponds to at least one first description text; one entity corresponds to at least one second description text; the first description text is the description text in the target document; the second description text is the description text in the multiple similar documents; the matrix similarity form between each first description text and each second description text of each entity in the at least one entity is calculated, and based on the matrix similarity form between each first description text and each second description text of each entity The structural conflict rate of each document in the target document and the multiple similar documents is determined based on the matrix similarity form between them; the structural conflict rate is used to indicate the proportion of knowledge fragments with structural contradictions between two documents; the timeliness score of the target document and the timeliness score of at least one candidate document whose structural conflict rate is greater than a preset threshold are calculated, and a timeliness score comparison result is generated; based on the timeliness score comparison result, the latest document and the first knowledge with high timeliness and the second knowledge with low timeliness are determined, and a knowledge update operation is performed based on the latest document, the first knowledge and the second knowledge; wherein the timeliness score is calculated based on the impact factor of the document; the knowledge update operation includes any one of the following: deletion operation, discarding operation, downgrading operation, and marking difference operation.
[0008] Optionally, based on the vector similarity calculation result, multiple similar documents similar to the target document are screened out from the knowledge database, including: based on the subject of the target document and the keywords contained therein, a target subject domain with the same subject as the target document is screened out from the subject domain index; the vector similarity between each knowledge document in the target subject domain and the target document is calculated, and multiple knowledge documents with the highest vector similarity are screened out to obtain the multiple similar documents.
[0009] Optionally, the entity extraction is performed based on the target document and the multiple similar documents to obtain at least one entity and a first description text corresponding to each entity and a second description text corresponding to each entity, including: performing a named entity recognition operation and an indicative expression extraction operation on the target document and the multiple similar documents to obtain a normalized knowledge expression statement; and performing entity alignment on the normalized knowledge expression statement to obtain at least one entity and at least one first description text corresponding to each entity in the at least one entity and at least one second description text corresponding to each entity.
[0010] Optionally, the calculation of the matrix similarity between the first description text and the second description text of each entity in the at least one entity includes: dividing each first description text and each second description text of each entity into at least three parts to obtain a field corresponding to each first description text and a field corresponding to each second description text; performing semantic matrix vector representation operations on the fields corresponding to each first description text and the fields corresponding to each second description text, respectively, to obtain a semantic matrix corresponding to each first description text and a semantic matrix corresponding to each second description text.
[0011] Optionally, the calculation of the matrix similarity form between each first description text and each second description text of each entity in the at least one entity includes: calculating the vector distance between the semantic matrix corresponding to each first description text of each entity and the semantic matrix corresponding to each second description text, and determining the matrix similarity form between each first description text and each second description text of each entity based on the vector distance between any two description texts; wherein the vector distance includes: the distance between corresponding vectors in any two semantic matrices.
[0012] Optionally, the method of determining the matrix similarity form between each first description text and each second description text of each entity based on the vector distance between any two description texts includes: generating a vector distance curve based on the distance values between vectors at the same position in any two semantic matrices, and determining the matrix similarity form between each first description text and each second description text of each entity based on the shape distribution of the vector distance curve.
[0013] Optionally, the structural conflict rate of the target document and each document in the multiple similar documents is determined based on the matrix similarity form between each first description text and each second description text of each entity, including: obtaining the matrix similarity form between each first description text and each second description text of each entity, and when the matrix similarity form is the same as a preset similarity form, determining that there is a structural contradiction between the knowledge fragments corresponding to the two description texts; and calculating the structural conflict rate of each similar text based on the number of second description texts with structural contradictions in at least one entity and the similar documents to which each second description text belongs.
[0014] Optionally, the preset similarity form includes any one of the following: a first form for indicating that the contents of the first two parts are the same and the content of the third part is different, a second form for indicating that the content of the first part is the same and the content of the middle part is different, and a third form for indicating that the even parts are different and the odd parts are the same.
[0015] Optionally, the calculating the timeliness score of the target document and the timeliness score of at least one candidate document whose structural conflict rate is greater than a preset threshold, and generating a timeliness score comparison result, includes: obtaining a first influencing factor of the target document and a second influencing factor of each candidate document in the at least one candidate document; calculating the first timeliness score of the target document based on the weights corresponding to each influencing factor in the first influencing factor, and calculating the second timeliness score of each candidate document based on the weights corresponding to each influencing factor in the second influencing factor of each candidate document; comparing the first timeliness score with the second timeliness score of each candidate document to generate the timeliness score comparison result; wherein the timeliness score comparison result is used to indicate the document with the highest timeliness.
[0016] Optionally, the first impact factor and the second impact factor include at least one of the following: publication time, entity version, number of citations, and source credibility.
[0017] Optionally, the method of determining the latest document, the first knowledge with high timeliness, and the second knowledge with low timeliness based on the timeliness score comparison result includes: according to the timeliness score comparison result, screening out the latest document with the highest timeliness score from the target document and the at least one candidate document, and determining the target knowledge fragment contained in the latest document as the first knowledge, and determining the knowledge in other documents except the latest document in the target document and the at least one candidate document that is structurally contradictory to the first knowledge as the second knowledge; wherein the target knowledge fragment is the knowledge fragment belonging to the latest document among the two knowledge fragments that are structurally contradictory.
[0018] Optionally, the knowledge updating operation performed based on the latest document, the first knowledge and the second knowledge includes: obtaining the first knowledge, and / or the target knowledge type of the second knowledge, and performing an update operation corresponding to the target knowledge type on the second knowledge according to a preset knowledge updating strategy; wherein the preset knowledge updating strategy is used to indicate update operations corresponding to different knowledge types.
[0019] The present application also provides a computer program product, comprising a computer program / instruction, which implements the steps of any of the above-mentioned knowledge database updating methods when executed by a processor.
[0020] The present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-described knowledge database updating methods are implemented.
[0021] The present application also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the above-mentioned knowledge database updating methods are implemented.
[0022] The knowledge database updating method, computer program product and electronic device provided by the present application obtain a target document newly added to the knowledge database, and based on the vector similarity calculation result, screen out multiple similar documents similar to the target document from the knowledge database; perform entity extraction based on the target document and the multiple similar documents to obtain at least one entity and a first description text corresponding to each entity and a second description text corresponding to each entity; one entity corresponds to at least one first description text; one entity corresponds to at least one second description text; the first description text is the description text in the target document; the second description text is the description text in the multiple similar documents; calculate the matrix similarity form between each first description text and each second description text of each entity in the at least one entity, and based on each second description text of each entity The matrix similarity form between a description text and each second description text is used to determine the structural conflict rate of the target document and each document in the multiple similar documents; the structural conflict rate is used to indicate the proportion of knowledge fragments with structural contradictions between the two documents; the timeliness score of the target document and the timeliness score of at least one candidate document with a structural conflict rate greater than a preset threshold are calculated, and a timeliness score comparison result is generated; based on the timeliness score comparison result, the latest document and the first knowledge with high timeliness and the second knowledge with low timeliness are determined, and a knowledge update operation is performed based on the latest document, the first knowledge and the second knowledge; wherein the timeliness score is calculated based on the impact factor of the document; the knowledge update operation includes any of the following: deletion operation, discarding operation, downgrading operation, and marking difference operation. In this way, the knowledge with high timeliness and authority can be determined by judging the matrix similarity form between the description texts, and the outdated knowledge can be processed. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 This is one of the flow charts of the knowledge database updating method provided by this application;
[0025] Figure 2This is the second flow chart of the knowledge database updating method provided by this application;
[0026] Figure 3 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0028] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0029] The following is a detailed description of the professional terms involved in the embodiments of the present application:
[0030] Retrieval-Augmented Generation (RAG) is a natural language processing model architecture that combines information retrieval and text generation technologies.
[0031] Chunk: In the RAG field, "chunk" usually refers to small pieces or fragments obtained by segmenting the input text or data to be processed. Dividing long text into smaller, logically coherent chunks allows the model to process these independent parts more efficiently. This helps reduce memory consumption and computational complexity, especially when faced with large-scale text data, avoiding resource limitations caused by loading the entire text at once. In addition, after segmenting the text into chunks, more focused and targeted queries can be generated for each chunk, thereby improving the recall and precision of the retrieval system.
[0032] Embedding: refers to the process of mapping original, usually discrete text data (such as words, phrases, sentences, documents, etc.) into a continuous, low-dimensional vector space. These generated vectors are called Embedding vectors. Each Embedding vector is regarded as a semantic representation of its corresponding text element, which can capture the semantic relationship, grammatical structure and contextual dependency between words. For example, similar or related words will be closer in the Embedding space, reflecting their semantic commonality or relevance.
[0033] Vector: This article states that in RAG practice, it is necessary to divide natural text into small segments, and then use a certain machine learning encoder model to convert these text segments into vector form, which is similar to the meaning of Embedding.
[0034] Large Language Model: LLM is an artificial intelligence model that uses machine learning technology with ultra-large parameters to understand and generate human language.
[0035] In the practice of large models based on RAG knowledge retrieval enhancement, the original knowledge base of users has various formats, and the text usually needs to be carefully cleaned and processed before it is suitable for being transferred to the vector retrieval library for retrieval. In the vector databases constructed in the above fields, it is very important to maintain the timeliness and quality of knowledge data. Redundant, outdated or inaccurate data will directly affect the output quality of RAG and related large model question-answering systems. Therefore, it is crucial to regularly update the data set and automatically clean up outdated information. At present, for the small amount of knowledge and document information in the vector database, when new knowledge is entered into the database, manual review can be adopted to detect and judge which knowledge is more novel and timely, and update the knowledge accordingly; but when the document data volume is large, the update is frequent, or the knowledge domain spans a large range, it is difficult to support it with manpower: the timeliness of manual updates cannot be guaranteed, or the cost rises sharply.
[0036] In view of the above technical problems existing in the related art, the present application embodiment provides a knowledge database updating method, such as Figure 1As shown, the method mainly includes the following steps: first, a subject domain index of relevant knowledge is established on the basis of the knowledge database, and for the newly added knowledge, the subject domain index is retrieved, and only the knowledge fragments in the subject domain that are related to or similar to its content are compared to obtain a similar document set; second, the knowledge entities mentioned in the newly stored knowledge are extracted, and then the description of the new text and the existing similar text in the entity domain is detected to see if there is a structural contradiction, and the structural conflict rate of each document is calculated; then, based on multiple factors such as document publication time and entity version number, multiple documents with high structural conflict rates are calculated and compared for timeliness, and the latest knowledge is marked; finally, after marking the new knowledge, the old knowledge is discarded, deleted or downgraded (the priority of the knowledge in the search results is reduced), thereby automatically realizing the update of knowledge base information and the hierarchical use of content.
[0037] The knowledge database updating method provided by the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0038] like Figure 2 As shown, an embodiment of the present application provides a knowledge database updating method, which may include the following steps 201 to 205:
[0039] Step 201: Acquire a target document newly added to a knowledge database, and based on a vector similarity calculation result, select a plurality of similar documents similar to the target document from the knowledge database.
[0040] For example, in order to improve detection efficiency and determine the timeliness and authority of newly added knowledge and existing related knowledge in the knowledge database, the detection scope can be limited by establishing a subject domain index, and multiple similar documents similar to the newly added target document can be screened out within the detection scope.
[0041] Specifically, the above step 201 may include the following steps 201a1 and 201a2:
[0042] Step 201a1: based on the subject of the target document and the keywords contained therein, select a target subject domain that is the same as the subject of the target document from the subject domain index.
[0043] Step 201a2: Calculate the vector similarity between each knowledge document in the target subject domain and the target document, and select multiple knowledge documents with the highest vector similarity to obtain the multiple similar documents.
[0044] Exemplarily, there are already a large number of vector representations of knowledge documents in the knowledge database. For these existing knowledge documents, by calculating their similarity, they are divided into different subcategories according to the degree of similarity, and a graph index of document topics, keywords and subcategory documents is established, that is, the above-mentioned subject domain index. For newly added knowledge documents (for example, the above-mentioned target documents), the closest subject domain is directly matched according to the topic and keywords of the newly added knowledge documents, and the range of subcategory documents contained therein is the operation boundary of subsequent processing, that is, the above-mentioned multiple similar documents are screened out from the range indicated by this operation boundary.
[0045] In a possible implementation, the similarity between any two knowledge documents can be calculated based on the following formula 1:
[0046] (Formula 1)
[0047] in, is the vector representation corresponding to the target document; It is the vector representation corresponding to the knowledge document in the same subject domain as the target document.
[0048] In another possible implementation, the similarity between any two knowledge documents can be calculated based on the following formula 2:
[0049] (Formula 2)
[0050] in, is the vector representation corresponding to the target document; It is the vector representation corresponding to the knowledge document in the same subject domain as the target document.
[0051] Step 202: perform entity extraction based on the target document and the multiple similar documents to obtain at least one entity and a first description text corresponding to each entity and a second description text corresponding to each entity.
[0052] Among them, one entity corresponds to at least one first description text; one entity corresponds to at least one second description text; the first description text is the description text in the target document; the second description text is the description text in the multiple similar documents.
[0053] Exemplarily, each entity has a corresponding description in the target document and multiple similar documents. The descriptive text describing the same entity can be divided into a description text set of the entity. At the same time, in order to distinguish the source of the description text, the description text in the target document is marked as the first description text, and the description text in multiple similar documents is marked as the second description text.
[0054] Specifically, the above step 202 may further include the following steps 202a1 and 202a2:
[0055] Step 202a1, performing a named entity recognition operation and an indicative expression extraction operation on the target document and the multiple similar documents to obtain a normalized knowledge expression statement.
[0056] Step 202a2: perform entity alignment on the normalized knowledge expression statements to obtain at least one entity, and at least one first description text corresponding to each entity in the at least one entity and at least one second description text corresponding to each entity.
[0057] Exemplarily, vector calculation is performed again from the above-mentioned sub-category document range to obtain multiple documents with the highest similarity (i.e., the above-mentioned multiple similar documents), and named entity recognition and knowledge expression extraction are performed on the newly added knowledge document and the most similar multiple similar documents respectively. It can also be simplified to standard sentence extraction, and then entity extraction is performed on the standardized sentences or knowledge expressions to form multiple sets describing the same entity, such as descriptions of "dog" are classified into one category, descriptions of "dog food" are classified into one category, and descriptions of "people" are classified into one category. The above-mentioned "dog", "dog food" and "people" are entities.
[0058] For example, we obtain the k knowledge documents closest to the newly-input knowledge document from the subject domain index, and the subsequent detection and comparison process is limited to the scope of these k knowledge documents (denoted as K). Within the scope of K, the same entity description statements are summarized into the same description text set, which can be represented by [E, Ke]. That is, for a given knowledge document scope K and a description text containing entity E, Ke represents the description text set in K that describes the same object as E.
[0059] Step 203, calculate the matrix similarity form between each first description text and each second description text of each entity in the at least one entity, and determine the structural conflict rate of the target document and each document in the multiple similar documents based on the matrix similarity form between each first description text and each second description text of each entity.
[0060] The structural conflict rate is used to indicate the proportion of structurally contradictory knowledge fragments between two documents.
[0061] For example, to calculate the structural conflict rate of a document, it is necessary to calculate the amount of structurally contradictory knowledge contained in the document, and to determine whether the knowledge contained in the document is structurally contradictory with other knowledge, the matrix similarity between the corresponding description texts of the two pieces of knowledge can be used to determine.
[0062] Specifically, in the above step 203, the step of determining the matrix similarity form between the two knowledge corresponding description texts may also include the following step 203a:
[0063] Step 203a, calculate the vector distance between the semantic matrix corresponding to each first description text of each entity and the semantic matrix corresponding to each second description text, and determine the matrix similarity form between each first description text of each entity and each second description text based on the vector distance between any two description texts.
[0064] The vector distance includes: the distance between corresponding vectors in any two semantic matrices.
[0065] It should be noted that in the above step 203a, each description text can be sliced through grammatical analysis to obtain multiple factual expressions, each factual expression has a corresponding vector, and the distance between the corresponding vectors in the two description texts is calculated to determine the matrix similarity form between the two description texts.
[0066] Specifically, the above step 203a may further include the following step 203a1:
[0067] Step 203a1, based on the distance value between vectors at the same position in any two semantic matrices, generate a vector distance curve, and based on the shape distribution of the vector distance curve, determine the matrix similarity form between each first description text and each second description text of each entity.
[0068] Exemplarily, Ke includes the description texts in the above-mentioned multiple similar documents. For each [E, Ke], the description text where E is located and all the description texts in Ke are sliced into three-segment factual expressions through syntactic analysis, and converted into corresponding multiple groups of 3-row n-dimensional matrices (can also be multi-row n-dimensional matrices, such as 5-row n-dimensional matrices, etc.) using word embedding technology. Each group of matrices is recorded as [Vsi, Vpi, Voi]. For the vectorized [E, Ke] matrix data, the row matrix similarity forms of E and Ke elements are compared in turn (the higher the similarity, the closer the distance), and it is identified whether the distance pattern of the two knowledge vectors conforms to the "arrow type" and "inverted V type" or "M type" distribution, so as to distinguish whether the associated knowledge is expanded or contradictory. If the conditions of any pattern are met, it can be judged that there is a structural contradiction between the two knowledge fragments.
[0069] Specifically, the step of calculating the structural conflict rate of the document in the above step 203 may include the following steps 203b1 and 204b2:
[0070] Step 203b1, obtaining the matrix similarity form between each first description text and each second description text of each entity, and when the matrix similarity form is the same as the preset similarity form, determining that there is a structural contradiction between the knowledge fragments corresponding to the two description texts.
[0071] Step 203b2: Calculate the structural conflict rate of each similar text based on the number of second description texts with structural contradictions in the at least one entity and the similar documents to which each second description text belongs.
[0072] Among them, the preset similarity form includes any one of the following: a first form (i.e., the above-mentioned "arrow type") used to indicate that the contents of the first two parts are the same and the content of the third part is different, a second form (i.e., the above-mentioned "inverted V type") used to indicate that the content of the first part is the same and the content of the middle part is different, and a third form (i.e., the above-mentioned "M type") used to indicate that the even parts are different and the odd parts are the same.
[0073] For example, all description texts of entities are sliced by syntactic analysis, such as subject-predicate-object three-segment segmentation or subject-copula-object three-segment segmentation (or multiple segments). For example, "dog is a good friend of mankind" is segmented into three sub-segments such as "dog", "is", and "good friend of mankind". These three sub-segments are represented by semantic matrix vectors, assuming that they are [[1,2][5,8][3,6]]; similar vectorization expression operations are performed on all knowledge expressions; the matrix vectors of the newly added documents are compared in turn, and the remaining matrix vectors are compared in pairs. For two knowledge expressions with arrow-shaped or inverted "V" shapes, they are recorded as mutually exclusive. For example, when comparing, the arrow shape is presented, such as "it runs very fast" and "it runs very slowly". In terms of vector distance shape, the first two segments are overlapped, and the third segment is opposite. In the expression of cosine similarity, the opposite vector distance is a negative number, which is represented as an angle greater than 90° in the coordinate space, so the overall expression is an arrow shape. When compared, an inverted "V" shape is presented. For example, "Dogs are good friends of humans" and "Dogs are not good friends of humans". After the three-paragraph syntactic split, the distance between the middle vectors is large, and the first and last paragraphs overlap, presenting an inverted "V" shape. Similar shapes can also be "M" shapes, etc.
[0074] Step 204: Calculate the timeliness score of the target document and the timeliness score of at least one candidate document whose structural conflict rate is greater than a preset threshold, and generate a timeliness score comparison result.
[0075] The timeliness score is calculated based on the impact factor of the document.
[0076] For example, after determining that structurally contradictory knowledge exists in a document, documents with a higher structural conflict rate can be screened out from the multiple similar documents based on the structural conflict rate of each document, and these documents can be compared with the target document for timeliness, thereby determining which documents have higher timeliness and authority. The knowledge in the document with the highest timeliness and authority is the latest knowledge.
[0077] Specifically, in the above step 204, the step of calculating the timeliness score of the document and generating the timeliness score comparison result may also include the following steps 204a1 to 204a3:
[0078] Step 204a1: Obtain a first impact factor of the target document and a second impact factor of each candidate document in the at least one candidate document.
[0079] Step 204a2: Calculate the first timeliness score of the target document based on the weights corresponding to each of the first influencing factors, and calculate the second timeliness score of each candidate document based on the weights corresponding to each of the second influencing factors of each candidate document.
[0080] Step 204a3: Compare the first timeliness score of the target document with the second timeliness score of each candidate document to generate the timeliness score comparison result.
[0081] The timeliness score comparison result is used to indicate the document with the highest timeliness and authority. The first impact factor and the second impact factor include at least one of the following: release time, entity version, number of citations, and source credibility.
[0082] For example, according to the calculation results of the previous step, the document structural conflict rate of each Ke is calculated, that is, the number of structurally contradictory knowledge in a single document / the total number of Ke knowledge, and the knowledge documents (denoted as Kc) whose structural conflict rate exceeds a certain threshold C (that is, the above-mentioned preset threshold) are selected for timeliness analysis, and the following timeliness scoring function is designed to measure the timeliness and authority of each knowledge document:
[0083] S(knowledge)=w1×F(recency)+w2×F(version)+w3×F(citation)+w4×F(authority)
[0084] The latest knowledge with the highest timeliness and authority is:
[0085] F(latest)=max(S(k),k∈Kc)
[0086] Among them, w(n) is the weight of each influencing factor, F(recency), F(version), F(citation) and F(authority) represent the newness of the publication time, the entity version, the number of citations and the credibility of the source (including: author and source unit). Then the latest knowledge F(latest) is the document with the highest score S in the range Kc containing the latest input knowledge.
[0087] For example, document 1 is published on 2024-01-01, document 2 is published on 2020-12-11, both documents have no version number, document 1 has 2 citations, document 2 has 3 citations, the author authority of document 1 is 10, the author authority of document 2 is 6, and all weights are 1. The score of document 1 is: S(1)=4+0+2+10=16; the score of document 2 is: S(2)=0+0+3+6=9;
[0088] In the above calculation, the publication time is directly calculated according to the year difference, 2024-2020=4, so the score of the first item of Document 1 is 4. Please note that this is only an example to illustrate the weight calculation method of time. It can also be quantified according to months, dates, or even minutes and seconds. The time closer to the current time is the one with the higher score. Missing items can be directly calculated as 0, the number of citations is directly calculated according to the actual value, and the author's authority is directly obtained from the internal knowledge base.
[0089] It should be noted that the weight can be modified according to the type of knowledge. If the document is a product manual, the weight of the version can be significantly increased. For papers, the weight of the number of citations can be significantly increased. In addition, for situations where the values of the various scoring items are quite different, the normalized values of the scores of each sub-item can be used in the final calculation. For example, a citation count of 100 may be much higher than the scores of other sub-items. Even if the weight is 1, the impact will be too large, so it needs to be normalized.
[0090] Step 205: determine the latest document, the first knowledge with high timeliness, and the second knowledge with low timeliness based on the timeliness score comparison result, and perform a knowledge update operation based on the latest document, the first knowledge, and the second knowledge.
[0091] The knowledge updating operation includes any one of the following: a deletion operation, a discarding operation, a downgrading operation, and a difference marking operation.
[0092] Exemplarily, old knowledge of different knowledge types may be deleted or discarded, etc. Specifically, corresponding operations may be performed according to a pre-set knowledge update strategy.
[0093] Specifically, the above step 205 may further include the following steps 205a1 and 205a2:
[0094] Step 205a1: Based on the timeliness score comparison result, the latest document with the highest timeliness score is screened out from the target document and the at least one candidate document, and the target knowledge fragment contained in the latest document is determined as the first knowledge, and the knowledge in the target document and other documents other than the latest document in the at least one candidate document that is structurally inconsistent with the first knowledge is determined as the second knowledge.
[0095] The target knowledge fragment is the knowledge fragment belonging to the latest document among the two knowledge fragments with structural contradiction.
[0096] Step 205a2: Obtain the first knowledge and / or the target knowledge type of the second knowledge, and perform an update operation corresponding to the target knowledge type on the second knowledge according to a preset knowledge update strategy.
[0097] The preset knowledge update strategy is used to indicate the update operations corresponding to different knowledge types.
[0098] For example, the knowledge contained in the document with the highest timeliness score is more authoritative and more timely new knowledge, and correspondingly, the knowledge in other documents that is structurally contradictory to the document is old knowledge. According to the knowledge type of the old knowledge, corresponding update operations can be performed.
[0099] For example, according to the calculation results, Document 1 is 16 points, which is greater than Document 2's 9 points. Document 1 is the latest authoritative knowledge expression, and Document 2 can be deleted. At the same time, if Document 2 is a manual, it can be downgraded or marked to adapt to different versions of products.
[0100] The knowledge database updating method provided in the embodiment of the present application obtains a newly added target document in the knowledge database, and based on the vector similarity calculation result, screens out multiple similar documents similar to the target document from the knowledge database; performs entity extraction based on the target document and the multiple similar documents to obtain at least one entity and a first description text corresponding to each entity and a second description text corresponding to each entity; one entity corresponds to at least one first description text; one entity corresponds to at least one second description text; the first description text is the description text in the target document; the second description text is the description text in the multiple similar documents; calculates the matrix similarity form between each first description text and each second description text of each entity in the at least one entity, and based on each first description text of each entity The matrix similarity form between the target document and each second description text is used to determine the structural conflict rate of each document in the target document and the multiple similar documents; the structural conflict rate is used to indicate the proportion of knowledge fragments with structural contradictions between the two documents; the timeliness score of the target document and the timeliness score of at least one candidate document with a structural conflict rate greater than a preset threshold are calculated, and a timeliness score comparison result is generated; based on the timeliness score comparison result, the latest document and the first knowledge with high timeliness and the second knowledge with low timeliness are determined, and a knowledge update operation is performed based on the latest document, the first knowledge and the second knowledge; wherein the timeliness score is calculated based on the impact factor of the document; the knowledge update operation includes any of the following: deletion operation, discarding operation, downgrading operation, and marking difference operation. In this way, knowledge with high timeliness and authority can be determined by judging the matrix similarity form between the description texts, and outdated knowledge can be processed.
[0101] It should be noted that the knowledge database update method provided in the embodiment of the present application can be executed by a knowledge database update device, or a control module in the knowledge database update device for executing the knowledge database update method. In the embodiment of the present application, the knowledge database update device provided in the embodiment of the present application is described by taking the execution of the knowledge database update method by the knowledge database update device as an example.
[0102] It should be noted that, in the embodiments of the present application, the above-mentioned methods shown in the drawings. The knowledge database update method is illustrated by combining an accompanying drawing in the embodiments of the present application as an example. In specific implementation, the knowledge database update method shown in the above-mentioned method drawings can also be implemented in combination with any other drawings that can be combined as shown in the above-mentioned embodiments, which will not be repeated here.
[0103] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the knowledge database update method, which includes: obtaining a target document newly added to the knowledge database, and based on the vector similarity calculation result, screening out multiple similar documents similar to the target document from the knowledge database; performing entity extraction based on the target document and the multiple similar documents to obtain at least one entity and a first description text corresponding to each entity and a second description text corresponding to each entity; one entity corresponds to at least one first description text; one entity corresponds to at least one second description text; the first description text is the description text in the target document; the second description text is the description text in the multiple similar documents; calculating the matrix similarity form between each first description text and each second description text of each entity in the at least one entity, and based on each The method comprises the following steps: according to the matrix similarity form between each first description text and each second description text of an entity, determining the structural conflict rate of the target document and each document in the multiple similar documents; the structural conflict rate is used to indicate the proportion of knowledge fragments with structural contradictions between two documents; calculating the timeliness score of the target document and the timeliness score of at least one candidate document whose structural conflict rate is greater than a preset threshold, and generating a timeliness score comparison result; determining the latest document and the first knowledge with high timeliness and the second knowledge with low timeliness based on the timeliness score comparison result, and performing a knowledge update operation based on the latest document, the first knowledge and the second knowledge; wherein the timeliness score is calculated based on the impact factor of the document; and the knowledge update operation includes any one of the following: deletion operation, discarding operation, downgrading operation, and marking difference operation.
[0104] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0105] On the other hand, the present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the knowledge database updating method provided by the above methods, and the method includes: obtaining a newly added target document in the knowledge database, and based on the vector similarity calculation result, screening out multiple similar documents similar to the target document from the knowledge database; performing entity extraction based on the target document and the multiple similar documents to obtain at least one entity and a first description text corresponding to each entity and a second description text corresponding to each entity; one entity corresponds to at least one first description text; one entity corresponds to at least one second description text; the first description text is the description text in the target document; the second description text is the description text in the multiple similar documents; calculating each of the at least one entity The matrix similarity form between each first description text and each second description text of an entity, and based on the matrix similarity form between each first description text and each second description text of each entity, determine the structural conflict rate of the target document and each document in the multiple similar documents; the structural conflict rate is used to indicate the proportion of knowledge fragments with structural contradictions between two documents; calculate the timeliness score of the target document and the timeliness score of at least one candidate document with a structural conflict rate greater than a preset threshold, and generate a timeliness score comparison result; determine the latest document and the first knowledge with high timeliness and the second knowledge with low timeliness based on the timeliness score comparison result, and perform a knowledge update operation based on the latest document, the first knowledge and the second knowledge; wherein the timeliness score is calculated based on the impact factor of the document; the knowledge update operation includes any one of the following: deletion operation, discarding operation, downgrading operation, and marking difference operation.
[0106] On the other hand, the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the above-mentioned knowledge database updating methods, the methods comprising: obtaining a target document newly added to the knowledge database, and based on a vector similarity calculation result, screening out multiple similar documents similar to the target document from the knowledge database; performing entity extraction based on the target document and the multiple similar documents to obtain at least one entity and a first description text corresponding to each entity and a second description text corresponding to each entity; one entity corresponds to at least one first description text; one entity corresponds to at least one second description text; the first description text is the description text in the target document; the second description text is the description text in the multiple similar documents; calculating the correlation between each first description text and each second description text of each entity in the at least one entity The method comprises the following steps: determining the structural conflict rate of each target document and each of the multiple similar documents based on the matrix similarity form between each first description text and each second description text of each entity; determining the structural conflict rate of each target document and each of the multiple similar documents based on the matrix similarity form between each first description text and each second description text of each entity; the structural conflict rate is used to indicate the proportion of knowledge fragments with structural contradictions between two documents; calculating the timeliness score of the target document and the timeliness score of at least one candidate document whose structural conflict rate is greater than a preset threshold, and generating a timeliness score comparison result; determining the latest document and the first knowledge with high timeliness and the second knowledge with low timeliness based on the timeliness score comparison result, and performing a knowledge update operation based on the latest document, the first knowledge and the second knowledge; wherein the timeliness score is calculated based on the impact factor of the document; and the knowledge update operation includes any one of the following: deletion operation, discarding operation, downgrading operation, and marking difference operation.
[0107] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0108] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0109] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A knowledge database updating method, characterized in that: include: Acquire a target document newly added to the knowledge database, and based on the vector similarity calculation result, select a plurality of similar documents similar to the target document from the knowledge database; Entity extraction is performed based on the target document and the multiple similar documents to obtain at least one entity and a first description text corresponding to each entity and a second description text corresponding to each entity; one entity corresponds to at least one first description text; one entity corresponds to at least one second description text; the first description text is the description text in the target document; the second description text is the description text in the multiple similar documents; Calculating the matrix similarity form between each first description text and each second description text of each entity in the at least one entity, and determining the structural conflict rate of each document in the target document and the plurality of similar documents based on the matrix similarity form between each first description text and each second description text of each entity; the structural conflict rate is used to indicate the proportion of knowledge fragments with structural contradictions between two documents; Calculating the timeliness score of the target document and the timeliness score of at least one candidate document whose structural conflict rate is greater than a preset threshold, and generating a timeliness score comparison result; Determine the latest document, the first knowledge with high timeliness, and the second knowledge with low timeliness based on the timeliness score comparison result, and perform a knowledge update operation based on the latest document, the first knowledge, and the second knowledge; The timeliness score is calculated based on the impact factor of the document; the knowledge update operation includes any of the following: a deletion operation, a discarding operation, a downgrading operation, and a difference marking operation.
2. The method according to claim 1, characterized in that The step of selecting a plurality of similar documents similar to the target document from the knowledge database based on the vector similarity calculation result includes: Based on the subject of the target document and the keywords contained therein, a target subject domain that is the same as the subject of the target document is screened out from the subject domain index; The vector similarity between each knowledge document in the target subject domain and the target document is calculated, and a plurality of knowledge documents with the highest vector similarity are screened out to obtain the plurality of similar documents.
3. The method according to claim 1, characterized in that The entity extraction based on the target document and the multiple similar documents to obtain at least one entity and a first description text corresponding to each entity and a second description text corresponding to each entity includes: Performing a named entity recognition operation and an indicative expression extraction operation on the target document and the plurality of similar documents to obtain a normalized knowledge expression statement; Entity alignment is performed on the normalized knowledge expression sentences to obtain at least one entity, and at least one first description text corresponding to each entity in the at least one entity and at least one second description text corresponding to each entity.
4. The method according to claim 1, characterized in that: The calculating of the matrix similarity between the first description text and the second description text of each entity in the at least one entity comprises: Divide each first description text and each second description text of each entity into at least three parts to obtain a field corresponding to each first description text and a field corresponding to each second description text; Semantic matrix vector representation operations are performed on the fields corresponding to each first description text and the fields corresponding to each second description text respectively, to obtain a semantic matrix corresponding to each first description text and a semantic matrix corresponding to each second description text.
5. The method according to claim 4, characterized in that The calculating of the matrix similarity between each first description text and each second description text of each entity in the at least one entity comprises: Calculate the vector distance between the semantic matrix corresponding to each first description text of each entity and the semantic matrix corresponding to each second description text, and determine the matrix similarity form between each first description text and each second description text of each entity according to the vector distance between any two description texts; The vector distance includes: the distance between corresponding vectors in any two semantic matrices.
6. The method according to claim 5, characterized in that The method of determining the matrix similarity between each first description text and each second description text of each entity according to the vector distance between any two description texts includes: Based on the distance values between vectors at the same position in any two semantic matrices, a vector distance curve is generated, and based on the shape distribution of the vector distance curve, the matrix similarity form between each first description text and each second description text of each entity is determined.
7. The method according to any one of claims 1 to 6, characterized in that The determining of the structural conflict rate of the target document and each document in the plurality of similar documents based on the matrix similarity form between each first description text and each second description text of each entity comprises: Obtaining a matrix similarity form between each first description text and each second description text of each entity, and determining that there is a structural contradiction between the knowledge fragments corresponding to the two description texts when the matrix similarity form is the same as a preset similarity form; Based on the number of second description texts with structural contradictions in the at least one entity and the similar documents to which each second description text belongs, a structural conflict rate of each similar text is calculated.
8. The method according to claim 7, characterized in that in, The preset similarity form includes any one of the following: a first form for indicating that the contents of the first two parts are the same and the content of the third part is different, a second form for indicating that the content of the first part is the same and the content of the middle part is different, and a third form for indicating that the even parts are different and the odd parts are the same.
9. The method according to claim 1, characterized in that: The calculating the timeliness score of the target document and the timeliness score of at least one candidate document having a structural conflict rate greater than a preset threshold, and generating a timeliness score comparison result, includes: Acquire a first impact factor of the target document and a second impact factor of each candidate document in the at least one candidate document; Calculating a first timeliness score of the target document based on the weights corresponding to each of the first impact factors, and calculating a second timeliness score of each candidate document based on the weights corresponding to each of the second impact factors of each candidate document; Comparing the first timeliness score with the second timeliness score of each candidate document to generate the timeliness score comparison result; The timeliness score comparison result is used to indicate the document with the highest timeliness.
10. The method according to claim 9, characterized in that The first impact factor and the second impact factor include at least one of the following: publication time, entity version, number of citations, and source credibility.
11. The method according to claim 1 or 9, characterized in that: The determining of the latest document, the first knowledge with high timeliness, and the second knowledge with low timeliness based on the timeliness score comparison result includes: According to the timeliness score comparison result, the latest document with the highest timeliness score is screened out from the target document and the at least one candidate document, and the target knowledge fragment contained in the latest document is determined as the first knowledge, and the knowledge in the target document and other documents other than the latest document in the at least one candidate document that is structurally contradictory to the first knowledge is determined as the second knowledge; The target knowledge fragment is the knowledge fragment belonging to the latest document among the two knowledge fragments with structural contradiction.
12. The method according to claim 11, characterized in that The performing of the knowledge updating operation based on the latest document, the first knowledge and the second knowledge includes: Acquire the first knowledge and / or the target knowledge type of the second knowledge, and perform an update operation corresponding to the target knowledge type on the second knowledge according to a preset knowledge update strategy; The preset knowledge update strategy is used to indicate the update operations corresponding to different knowledge types.
13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the knowledge database updating method described in any one of claims 1 to 12 are implemented.
14. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the knowledge database updating method according to any one of claims 1 to 12 when executing the program.
15. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the steps of the knowledge database updating method according to any one of claims 1 to 12 are implemented.
