Knowledge graph updating method and device, equipment and storage medium
By processing target text pairs using a pre-defined semantic model, determining the vector representation of keywords, and updating the knowledge graph, the problem of low efficiency and low accuracy caused by non-standard information input by staff is solved, thus realizing the automation and efficient construction of the knowledge graph.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- COSMO INSTITUTE OF INDUSTRIAL INTELLIGENCE (QINGDAO) CO LTD
- Filing Date
- 2023-03-31
- Publication Date
- 2026-04-14
AI Technical Summary
In existing technologies, the lack of standardization in the processing information entered by staff leads to low efficiency and low accuracy in refining the process chain and constructing a knowledge graph.
By processing target text pairs using a pre-defined semantic model, determining the vector representation of keywords, and automatically updating the knowledge graph based on association parameters, the standardization and automated updating of non-standard information can be achieved.
It improves the speed and accuracy of knowledge graph construction and reduces the impact of subjective human factors.
Smart Images

Figure CN116431826B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a method, apparatus, device and storage medium for updating a knowledge graph. Background Technology
[0002] Currently, in the industrial internet scenario, knowledge graphs can be used to describe some knowledge within the industrial internet context, thus providing knowledge query functions to industrial internet practitioners or other users through human-computer interaction (such as knowledge question answering). Taking piecework processing as an example, the process chains of various industrial products can be extracted from the processing information entered by workers, and a knowledge graph can be constructed based on these extracted process chains to describe the processing knowledge in the piecework processing scenario.
[0003] However, due to the lack of standardization in the processing information entered by staff, the process of refining the process chain and constructing the knowledge graph is currently generally handled manually. This existing method of manually refining the process chain and constructing the knowledge graph is not only inefficient, affecting the speed of knowledge graph construction, but also susceptible to subjective human factors, resulting in a low accuracy rate for the constructed knowledge graph. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for updating knowledge graphs, which can improve the speed of knowledge graph construction and the accuracy of the constructed knowledge graphs.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] In a first aspect, this application provides a method for updating a knowledge graph, comprising: obtaining target text pairs; the target text pairs include a first target keyword and a second target keyword; processing the target text pairs by calling a preset semantic model to determine a first target vector corresponding to the first target keyword and a second target vector corresponding to the second target keyword; determining target association parameters based on the first target vector and the second target vector; the target association parameters are used to characterize the degree of association between the first target keyword and the second target keyword; and updating the current knowledge graph based on the first target vector, the second target vector, and the target association parameters.
[0007] In the technical solution provided in this application, after obtaining the target text pairs in the piecework processing scenario, a preset semantic model can be called to process the target text pairs to determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword. The preset semantic model can be a pre-trained semantic model used to standardize the obtained target text pairs. Specifically, when the obtained target text pair is an irregular expression of certain processing information, the preset semantic model can be used to transform the target text pair into a target vector corresponding to the regular expression of that processing information. Then, target association parameters can be determined based on the first and second target vectors, and the current knowledge graph can be updated based on the first target vector, the second target vector, and the target association parameters. Since the target association parameters characterize the degree of association between the first and second target keywords, and the edge relationship between two adjacent nodes in the knowledge graph characterizes the degree of association between the two keywords corresponding to the two nodes, the current knowledge graph can be automatically updated based on the target association parameters and the target vectors corresponding to the first and second target keywords. As can be seen, this application processes target text pairs using a pre-defined semantic model, which can standardize irregularly processed information entered manually. Furthermore, it can automatically update the knowledge graph through vector representations of target text pairs and target association parameters. Therefore, this application can improve the speed and accuracy of knowledge graph construction.
[0008] Optionally, in one possible design approach, the aforementioned "updating the current knowledge graph based on the first target vector, the second target vector, and target association parameters" may include:
[0009] If the target association parameter is determined to be greater than or equal to the association parameter threshold, then based on the first target vector, the second target vector, and the target association parameter, the first target node corresponding to the first target keyword and the second target node corresponding to the second target keyword are updated in the current knowledge graph.
[0010] Optionally, in another possible design approach, the above-mentioned "updating the first target node corresponding to the first target keyword and the second target node corresponding to the second target keyword in the current knowledge graph based on the first target vector, the second target vector, and the target association parameters" may include:
[0011] The vector representation of the first target node is updated according to the first target vector, and the vector representation of the second target node is updated according to the second target vector. The edge weights of the edge relationship formed by the first target node and the second target node are updated according to the target association parameters.
[0012] Optionally, in another possible design approach, before the above-mentioned "calling a preset semantic model to process the target text pair and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword", it may also include:
[0013] Obtain the historical data entry table; the historical data entry table includes each historical data entry within a preset historical time period, and each historical data entry includes at least two data entry fields arranged in an orderly manner; based on the arrangement order of each data entry field in each historical data entry, determine each sample text pair in each historical data entry; each sample text pair includes a first sample keyword and a second sample keyword; wherein, the first sample keyword and the second sample keyword correspond to two consecutive fields in each data entry field of each historical data entry; based on each sample text pair, construct an initial current knowledge graph.
[0014] Alternatively, in another possible design approach, the above "constructing an initial current knowledge graph based on each sample text pair" may include:
[0015] Based on the number of text pairs in each sample text pair and the number of related text pairs in each sample text pair, the sample association parameters for each sample text pair are determined respectively. Among them, for each sample text pair, the related text pairs of the current sample text pair are the sample text pairs in each sample text pair where the first sample keyword is the same as the first sample keyword of the current sample text pair, and the second sample keyword is different from the second sample keyword of the current sample text pair. For each sample text pair, the first sample keyword of the current sample text pair is used as the first initial node in the current knowledge graph, and the second sample keyword of the current sample text pair is used as the second initial node in the current knowledge graph. The sample association parameters of the current sample text pair are used as the edge weights of the edge relationship formed by the first initial node and the second initial node.
[0016] Optionally, in another possible design approach, after the above-mentioned "constructing an initial current knowledge graph based on each sample text pair", it may also include:
[0017] The preset semantic model is invoked to process the current sample text pair, determine the first sample vector corresponding to the first sample keyword of the current sample text pair, and the second sample vector corresponding to the second sample keyword of the current sample text pair, and update the vector representation of the first initial node and the second initial node based on the first sample vector and the second sample vector.
[0018] Alternatively, in another possible design, for each piece of historical entry information, each entry field in the current historical entry information includes: an entry personnel identifier field, an entry product identifier field, and at least one entry process identifier field.
[0019] Secondly, this application provides a knowledge graph updating device, including: an acquisition module, a determination module, and an updating module;
[0020] The module is used to acquire target text pairs, which include a first target keyword and a second target keyword. The module is used to call a preset semantic model to process the target text pairs and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword. The module is also used to determine target association parameters based on the first target vector and the second target vector. The target association parameters are used to characterize the degree of association between the first target keyword and the second target keyword. The module is used to update the current knowledge graph based on the first target vector, the second target vector, and the target association parameters.
[0021] Optionally, in one possible design approach, the update module is specifically used for:
[0022] If the target association parameter is determined to be greater than or equal to the association parameter threshold, then based on the first target vector, the second target vector, and the target association parameter, the first target node corresponding to the first target keyword and the second target node corresponding to the second target keyword are updated in the current knowledge graph.
[0023] Alternatively, in another possible design approach, the update module is also specifically used for:
[0024] The vector representation of the first target node is updated according to the first target vector, and the vector representation of the second target node is updated according to the second target vector. The edge weights of the edge relationship formed by the first target node and the second target node are updated according to the target association parameters.
[0025] Optionally, in another possible design, the knowledge graph updating apparatus provided in this application may also include a building module;
[0026] The acquisition module is also used to acquire a historical entry information table before the determination module calls the preset semantic model to process the target text pair and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword. The historical entry information table includes each historical entry information within a preset historical time period, and each historical entry information includes at least two entry fields arranged in an orderly manner.
[0027] The determination module is also used to determine each sample text pair in each historical entry based on the arrangement order of each entry field in each historical entry; each sample text pair includes a first sample keyword and a second sample keyword; wherein, the first sample keyword and the second sample keyword correspond to two consecutive fields in each entry field of each historical entry.
[0028] The building module is used to construct an initial current knowledge graph based on each sample text pair.
[0029] Alternatively, in another possible design approach, the building blocks are specifically used for:
[0030] Based on the number of text pairs in each sample text pair and the number of text pairs in the associated text pairs of each sample text pair, the sample association parameters for each sample text pair are determined respectively; among them, for each sample text pair, the associated text pairs of the current sample text pair are the sample text pairs in each sample text pair where the first sample keyword is the same as the first sample keyword of the current sample text pair, and the second sample keyword is different from the second sample keyword of the current sample text pair.
[0031] For each sample text pair, the first sample keyword of the current sample text pair is used as the first initial node in the current knowledge graph, and the second sample keyword of the current sample text pair is used as the second initial node in the current knowledge graph. The sample association parameters of the current sample text pair are used as the edge weights of the edge relationship formed by the first initial node and the second initial node.
[0032] Optionally, in another possible design, the determination module is also used to call a preset semantic model to process the current sample text pairs after the construction module constructs the initial current knowledge graph based on each sample text pair, to determine the first sample vector corresponding to the first sample keyword of the current sample text pair and the second sample vector corresponding to the second sample keyword of the current sample text pair, and to update the vector representation of the first initial node and the second initial node based on the first sample vector and the second sample vector.
[0033] Alternatively, in another possible design, for each piece of historical entry information, each entry field in the current historical entry information includes: an entry personnel identifier field, an entry product identifier field, and at least one entry process identifier field.
[0034] Thirdly, this application provides a knowledge graph updating device, including a memory, a processor, a bus, and a communication interface; the memory is used to store computer execution instructions, and the processor is connected to the memory via the bus; when the knowledge graph updating device is running, the processor executes the computer execution instructions stored in the memory, so that the knowledge graph updating device performs the knowledge graph updating method as provided in the first aspect above.
[0035] Fourthly, this application provides a computer-readable storage medium storing instructions that, when executed by a computer, cause the computer to perform the knowledge graph update method as provided in the first aspect.
[0036] Fifthly, this application provides a computer program product including computer instructions that, when executed on a computer, cause the computer to perform the knowledge graph updating method as provided in the first aspect.
[0037] It should be noted that the aforementioned computer instructions may be stored, in whole or in part, on a computer-readable storage medium. This computer-readable storage medium may be packaged together with the processor of the knowledge graph updating device, or it may be packaged separately from the processor of the knowledge graph updating device; this application does not impose any limitations on this.
[0038] The descriptions of the second, third, fourth, and fifth aspects in this application can be referenced to the detailed description of the first aspect; and the beneficial effects of the descriptions of the second, third, fourth, and fifth aspects can be referenced to the analysis of the beneficial effects of the first aspect, which will not be repeated here.
[0039] In this application, the names of the aforementioned devices or functional modules are not limited, and in actual implementation, these devices or functional modules may appear under other names. As long as the functions of each device or functional module are similar to those in this application, they all fall within the scope of this application.
[0040] These or other aspects of this application will become more readily apparent in the following description. Attached Figure Description
[0041] Figure 1 A flowchart illustrating a knowledge graph updating method provided in an embodiment of this application;
[0042] Figure 2 A partial schematic diagram of an initial current knowledge graph provided for an embodiment of this application;
[0043] Figure 3 A schematic diagram illustrating the iterative relationship between a knowledge graph and a preset semantic model, provided as an embodiment of this application;
[0044] Figure 4 A flowchart illustrating another knowledge graph updating method provided in this application embodiment;
[0045] Figure 5 A schematic diagram of the structure of a knowledge graph updating device provided in an embodiment of this application;
[0046] Figure 6 This is a schematic diagram of the structure of a knowledge graph updating device provided in an embodiment of this application. Detailed Implementation
[0047] The following description, in conjunction with the accompanying drawings, details the knowledge graph updating method, apparatus, device, and storage medium provided in the embodiments of this application.
[0048] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0049] The terms "first" and "second," etc., used in the specification and drawings of this application are used to distinguish different objects or to distinguish different treatments of the same object, rather than to describe a specific order of objects.
[0050] Furthermore, the terms "comprising" and "having," and any variations thereof, used in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0051] It should be noted that in the embodiments of this application, the words "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the words "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0052] In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0053] Furthermore, the acquisition, storage, use, and processing of data in this application's technical solution all comply with relevant national laws and regulations.
[0054] Currently, in the industrial internet scenario, knowledge graphs can be used to describe some knowledge within the industrial internet context, thus providing knowledge query functions to industrial internet practitioners or other users through human-computer interaction (such as knowledge question answering). Taking piecework processing as an example, the process chains of various industrial products can be extracted from the processing information entered by workers, and a knowledge graph can be constructed based on these extracted process chains to describe the processing knowledge in the piecework processing scenario.
[0055] However, due to the lack of standardization in the processing information entered by staff, the process of refining the process chain and constructing the knowledge graph is currently generally handled manually. This existing method of manually refining the process chain and constructing the knowledge graph is not only inefficient, affecting the speed of knowledge graph construction, but also susceptible to subjective human factors, resulting in a low accuracy rate for the constructed knowledge graph.
[0056] To address the problems existing in the prior art, this application provides a method for updating a knowledge graph. This method processes target text pairs using a preset semantic model, which can standardize irregularly processed information entered manually. Furthermore, it can automatically update the knowledge graph through vector representation of target text pairs and target association parameters. Therefore, this application can improve the speed and accuracy of knowledge graph construction.
[0057] The knowledge graph updating method provided in this application embodiment can be executed by the knowledge graph updating device provided in this application embodiment. The device can be implemented by software and / or hardware and integrated into the knowledge graph updating device that executes this method.
[0058] The method for updating the knowledge graph provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0059] Reference Figure 1 The knowledge graph updating method provided in this application includes S101-S104:
[0060] S101. Obtain the target text pair.
[0061] The knowledge graph updating method provided in this application embodiment can be applied to piecework processing scenarios. The target text pair can be a text pair to be processed determined from the processing information entered by the workers in the piecework processing scenario (that is, the entry information in this application embodiment).
[0062] Furthermore, in order to achieve automatic processing of processing information and thus automatic updating of the knowledge graph, the processing information entered by the staff can be information entered according to a predetermined format. The processing information can include multiple fields, and these fields are arranged in a pre-defined order. For example, the processing information can be: Staff A; Product A; Process A; Process B. This processing information indicates that Staff A entered processing technology information for Product A, and that Product A's processing technology has two processes: the first process is Process A, and the second process is Process B. For this processing information, three target text pairs can be identified: (Staff A, Product A), (Product A, Process A), and (Process A, Process B). The processing procedure for different target text pairs is the same in this application embodiment. The following description will use the processing procedure for any single target text pair as an example.
[0063] The target text pair includes a first target keyword and a second target keyword. For example, if the target text pair is (employee A, product A), the first target keyword could be "employee A" and the second target keyword could be "product A".
[0064] S102. Call the preset semantic model to process the target text pair and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword.
[0065] The preset semantic model can be a pre-determined model. For example, the preset semantic model can be a BERT (Bidirectional Encoder Representation from Transformers, a pre-trained language representation model) model, which can convert two keywords in a text pair into two vector representations respectively. Specific methods for converting keywords into vector representations can be found in relevant descriptions in the prior art, and are not limited thereto in this embodiment.
[0066] Furthermore, the pre-defined semantic model can standardize non-standard target text. Specifically, it can transform non-standard target text into a target vector corresponding to the standard expression of that non-standard target text. For example, if a processing step of product A is step C, and the standard expression of step C is "cleaning," and a worker enters step C as the non-standard expression "cleaning" when entering processing information, then after inputting the target text containing the keyword "cleaning" into the pre-defined semantic model, the model can automatically recognize the keyword "cleaning" as a keyword with the same semantic meaning as "cleaning," thereby transforming the keyword "cleaning" into a target vector corresponding to "cleaning."
[0067] Optionally, before calling the preset semantic model to process the target text pairs and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword, the knowledge graph update method provided in this application embodiment may further include: obtaining a historical input information table; determining each sample text pair in each historical input information based on the arrangement order of each input field in each historical input information; and constructing an initial current knowledge graph based on each sample text pair.
[0068] The historical data entry table includes all historical data entries within a preset historical time period. Each historical data entry includes at least two data entry fields arranged in an orderly manner. The preset historical time period can be a pre-determined historical period, such as the past 7 days.
[0069] In one possible implementation, each piece of historical data entry includes a timestamp. When the knowledge graph updating device receives data entry from staff (i.e., processing information in this embodiment), it can add a timestamp to the data entry based on the receiving time and store the timestamped data entry in the historical data entry database. When constructing the initial current knowledge graph, the knowledge graph updating device can filter out each piece of historical data entry within a preset historical time period from the historical data entry database based on the timestamps of the historical data entry data in the database, thus obtaining the historical data entry table in this embodiment.
[0070] In another possible implementation, the entered information may also include an entry time field, which is located in a fixed position in each entry field, such as the first or last position. When constructing the initial current knowledge graph, the knowledge graph updating device can filter out each piece of historical entry information within a preset historical time period from the historical entry information database based on the entry time field of the historical entry information, thus obtaining the historical entry information table in this embodiment.
[0071] Optionally, for each piece of historical data entry, each entry field in the current historical data entry includes: the entry personnel identifier field, the entry product identifier field, and at least one entry process identifier field.
[0072] In this embodiment, the entered information is stored in a tabular format in the historical entered information database, and the tabular format of the historical entered information table is the same as that of the historical entered information database. For example, referring to Table 1, a historical entered information table is provided in this embodiment:
[0073] Table 1
[0074] Enter personnel identification field Enter product identification field Enter process identifier field Enter process identifier field Enter process identifier field Enter process identifier field Person A Product A Process A1 Process A2 Process A3 Process A4 Person A Product B Process B1 Process B2 Process B3 Person A Product B Process B1 Process B4 Personnel B Product A Process A1 Process A2 Process A3 Process A4 Personnel B Product B Process B1 Process B2 Process B3 Personnel B Product C Process C1 Process C2
[0075] As shown in Table 1, the historical data entry table includes six historical data entry records. Each of these six records contains a recorder identifier field, a recorder product identifier field, and at least one recorder process identifier field. Furthermore, the entry fields are arranged in the order of recorder identifier, recorder product identifier, and recorder process identifier, and the multiple recorder process identifier fields within each historical data entry record are arranged in the chronological order of the processes. For example, taking the first historical data entry record in Table 1 as an example, this record indicates that during the production of product A, the processing steps were sequentially step A1, step A2, step A3, and step A4.
[0076] In this embodiment of the application, after obtaining the historical entry information table, all text pairs in the historical entry information table can be determined based on the arrangement order of each entry field in each historical entry information, and then the same text pairs can be divided into the same sample text pairs.
[0077] Each sample text pair includes a first sample keyword and a second sample keyword; the first sample keyword and the second sample keyword correspond to two consecutive fields in each input field of each historical input information.
[0078] For example, taking the first historical entry in Table 1 as an example, five text pairs can be determined based on the arrangement order of the fields in that historical entry: (Personnel A, Product A), (Product A, Process A1), (Process A1, Process A2), (Process A2, Process A3), and (Process A3, Process A4). Similarly, text pairs can be identified for each historical entry in Table 1, and identical text pairs can be merged. For instance, if the text pair (Product B, Process B1) can be identified from the second, third, and fourth historical entries in Table 1, then these three text pairs can be merged to obtain a sample text pair (Product B, Process B1), and the number of text pairs in this sample text pair (Product B, Process B1) is determined to be 3. The first sample keyword in this sample text pair is "Product B", and the second sample keyword is "Process B1".
[0079] Optionally, based on each sample text pair, an initial current knowledge graph is constructed, including: determining the sample association parameters of each sample text pair based on the number of text pairs in each sample text pair and the number of text pairs in the associated text pairs of each sample text pair; for each sample text pair, the first sample keyword of the current sample text pair is used as the first initial node in the initial current knowledge graph, and the second sample keyword of the current sample text pair is used as the second initial node in the initial current knowledge graph, and the sample association parameters of the current sample text pair are used as the edge weights of the edge relationships formed by the first initial node and the second initial node.
[0080] Specifically, for each sample text pair, the associated text pair is the sample text pair in which the first sample keyword is the same as the first sample keyword of the current sample text pair, and the second sample keyword is different from the second sample keyword of the current sample text pair. For example, taking Table 1 as an example, the sample text pair (Person A, Product A) can be identified, and the associated text pair of this sample text pair is (Person A, Product B).
[0081] In one possible implementation, if person A entered n1 data entries within a preset historical time period, including n2 entries for product A and n3 entries for other products (i.e., n1 = n2 + n3), then the number of text pairs in the sample text pair (person A, product A) is n2, and the number of associated text pairs in the sample text pair (person A, product A) is n3. Therefore, the sample association parameter for the sample text pair (person A, product A) is n2 / n1. For example, refer to... Figure 2 This provides an initial partial schematic diagram of the current knowledge graph. For example... Figure 2 As shown, the initial knowledge graph includes four nodes: "Personnel A", "Product A", "Process A1", and "Process A2". Taking the node corresponding to "Personnel A" and the node corresponding to "Product A" as an example, the edge weight of the edge relationship formed by these two nodes is n2 / n1.
[0082] Optionally, after using the sample association parameters of the current sample text pair as the edge weights of the edge relationship composed of the first initial node and the second initial node, the knowledge graph update method provided in this application embodiment may include: calling a preset semantic model to process the current sample text pair, determining the first sample vector corresponding to the first sample keyword of the current sample text pair and the second sample vector corresponding to the second sample keyword of the current sample text pair, and updating the vector representations of the first initial node and the second initial node based on the first sample vector and the second sample vector.
[0083] In this embodiment, the embedding representations of nodes in the knowledge graph can be updated using a preset semantic model. Furthermore, during the process of loading the preset semantic model to generate the embedding representations of nodes in the knowledge graph, the parameters in the preset semantic model are also continuously updated. That is, the update process of the preset semantic model and the update process of the knowledge graph iterate with each other. This improves the accuracy of the preset semantic model's vector transformation of target text pairs during the automatic updating of the knowledge graph, thereby increasing the accuracy of the determined knowledge graph.
[0084] Reference Figure 3 This is a schematic diagram illustrating the iterative relationship between a knowledge graph and a preset semantic model, provided in an embodiment of this application. Figure 3 As shown, the embedded representation of nodes in the knowledge graph can be updated through the preset semantic model. At the same time, the parameters inside the preset semantic model will be fine-tuned once each time the embedded representation of nodes in the knowledge graph is loaded.
[0085] S103. Determine the target association parameters based on the first target vector and the second target vector.
[0086] Among them, the target association parameter is used to characterize the degree of association between the first target keyword and the second target keyword.
[0087] In this embodiment of the application, the similarity of parameters in the first target vector and the second target vector can be compared to determine the correlation between the first target vector and the second target vector, and the correlation can be determined as the target association parameter corresponding to the first target vector and the second target vector.
[0088] S104. Update the current knowledge graph based on the first target vector, the second target vector, and the target association parameters.
[0089] Optionally, updating the current knowledge graph based on the first target vector, the second target vector, and the target association parameters may include: if it is determined that the target association parameters are greater than or equal to the association parameter threshold, then based on the first target vector, the second target vector, and the target association parameters, updating the first target node corresponding to the first target keyword and the second target node corresponding to the second target keyword in the current knowledge graph.
[0090] The threshold value for the association parameter is a predetermined value; for example, the threshold value for the association parameter could be 0.6.
[0091] For example, if the target association parameter is 0.7, then based on the first target vector, the second target vector, and the target association parameter, the first target node corresponding to the first target keyword and the second target node corresponding to the second target keyword can be updated in the current knowledge graph.
[0092] In this embodiment, when the target association parameter of two target keywords in a target text pair is too small, it indicates that the correlation between the two target keywords is very small. In this case, adding nodes corresponding to these two target keywords to the knowledge graph is meaningless. Therefore, in the process of updating the current knowledge graph, this embodiment can filter target text pairs with low correlation between two target keywords by using the association parameter threshold to ensure the accuracy of the updated knowledge graph.
[0093] Optionally, updating the first target node corresponding to the first target keyword and the second target node corresponding to the second target keyword in the current knowledge graph based on the first target vector, the second target vector, and the target association parameters may include: updating the vector representation of the first target node according to the first target vector, updating the vector representation of the second target node according to the second target vector, and updating the edge weight of the edge relationship formed by the first target node and the second target node according to the target association parameters.
[0094] In one possible implementation, if the current knowledge graph includes a first target node corresponding to the first target keyword and a second target node corresponding to the second target keyword, the vector representation of the first target node can be updated to the first target vector, and the vector representation of the second target node can be updated to the second target vector. Then, the edge weights of the edge relationship formed by the first target node and the second target node can be updated to the target association parameters.
[0095] In another possible implementation, if the current knowledge graph does not include the first target node corresponding to the first target keyword and the second target node corresponding to the second target keyword, the first target node and the second target node can be added to the current knowledge graph first. Then, the vector representation of the first target node is updated according to the first target vector, and the vector representation of the second target node is updated according to the second target vector. The edge weights of the edge relationship formed by the first target node and the second target node are updated according to the target association parameters.
[0096] In summary, the knowledge graph updating method provided in this application, after obtaining target text pairs in a piecework processing scenario, can first call a preset semantic model to process the target text pairs, determining the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword. The preset semantic model can be a pre-trained semantic model used to standardize the obtained target text pairs. Specifically, when the obtained target text pair is an irregular expression of certain processing information, the preset semantic model can transform the target text pair into a target vector corresponding to the regular expression of that processing information. Then, target association parameters can be determined based on the first and second target vectors, and the current knowledge graph can be updated based on the first target vector, the second target vector, and the target association parameters. Since the target association parameters characterize the degree of association between the first and second target keywords, and the edge relationship between two adjacent nodes in the knowledge graph characterizes the degree of association between the two keywords corresponding to the two nodes, automatic updating of the current knowledge graph can be achieved based on the target association parameters and the target vectors corresponding to the first and second target keywords. As can be seen, the embodiments of this application process target text pairs through a preset semantic model, which can standardize irregularly processed information entered manually. Furthermore, it can achieve automated updates to the knowledge graph through vector representations of target text pairs and target association parameters. Therefore, the embodiments of this application can improve the speed and accuracy of knowledge graph construction.
[0097] Optional, such as Figure 4 As shown, this application embodiment also provides a knowledge graph updating method, including S401-S409:
[0098] S401. Obtain the historical data entry table.
[0099] S402. Based on the arrangement order of each field in each historical entry, determine each sample text pair in each historical entry.
[0100] S403. Based on the number of text pairs in each sample text pair and the number of associated text pairs in each sample text pair, determine the sample association parameters for each sample text pair.
[0101] S404. For each sample text pair, the first sample keyword of the current sample text pair is used as the first initial node in the current knowledge graph, and the second sample keyword of the current sample text pair is used as the second initial node in the current knowledge graph. The sample association parameters of the current sample text pair are used as the edge weights of the edge relationship formed by the first initial node and the second initial node.
[0102] S405. For each sample text pair, call the preset semantic model to process the current sample text pair, determine the first sample vector corresponding to the first sample keyword of the current sample text pair and the second sample vector corresponding to the second sample keyword of the current sample text pair, and update the vector representation of the first initial node and the second initial node based on the first sample vector and the second sample vector.
[0103] S406. Obtain the target text pair.
[0104] S407. Call the preset semantic model to process the target text pair and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword.
[0105] S408. Determine the target association parameters based on the first target vector and the second target vector.
[0106] S409. If it is determined that the target association parameter is greater than or equal to the association parameter threshold, then update the vector representation of the first target node according to the first target vector, update the vector representation of the second target node according to the second target vector, and update the edge weight of the edge relationship formed by the first target node and the second target node according to the target association parameter.
[0107] like Figure 5 As shown in the figure, this application embodiment also provides a knowledge graph updating device, which may include: an acquisition module 11, a determination module 21, and an update module 31.
[0108] Specifically, the acquisition module 11 executes S101 in the above method embodiment, the determination module 21 executes S102 and S103 in the above method embodiment, and the update module 31 executes S104 in the above method embodiment.
[0109] Module 11 is used to acquire target text pairs; the target text pairs include a first target keyword and a second target keyword;
[0110] The determination module 21 is used to call a preset semantic model to process the target text pair and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword.
[0111] The determining module 21 is also used to determine target association parameters based on the first target vector and the second target vector; the target association parameters are used to characterize the degree of association between the first target keyword and the second target keyword;
[0112] The update module 31 is used to update the current knowledge graph based on the first target vector, the second target vector, and the target association parameters.
[0113] Optionally, in one possible design, update module 31 is specifically used for:
[0114] If the target association parameter is determined to be greater than or equal to the association parameter threshold, then based on the first target vector, the second target vector, and the target association parameter, the first target node corresponding to the first target keyword and the second target node corresponding to the second target keyword are updated in the current knowledge graph.
[0115] Optionally, in another possible design, update module 31 is further used for:
[0116] The vector representation of the first target node is updated according to the first target vector, and the vector representation of the second target node is updated according to the second target vector. The edge weights of the edge relationship formed by the first target node and the second target node are updated according to the target association parameters.
[0117] Optionally, in another possible design, the knowledge graph updating apparatus provided in this application may also include a building module;
[0118] The acquisition module 11 is also used to acquire a historical entry information table before the determination module 21 calls the preset semantic model to process the target text pair and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword. The historical entry information table includes each historical entry information within a preset historical time period, and each historical entry information includes at least two entry fields arranged in an orderly manner.
[0119] The determination module 21 is also used to determine each sample text pair in each historical entry based on the arrangement order of each entry field in each historical entry; each sample text pair includes a first sample keyword and a second sample keyword; wherein, the first sample keyword and the second sample keyword correspond to two consecutive fields in each entry field in each historical entry.
[0120] The building module is used to construct an initial current knowledge graph based on each sample text pair.
[0121] Alternatively, in another possible design approach, the building blocks are specifically used for:
[0122] Based on the number of text pairs in each sample text pair and the number of text pairs in the associated text pairs of each sample text pair, the sample association parameters for each sample text pair are determined respectively; among them, for each sample text pair, the associated text pairs of the current sample text pair are the sample text pairs in each sample text pair where the first sample keyword is the same as the first sample keyword of the current sample text pair, and the second sample keyword is different from the second sample keyword of the current sample text pair.
[0123] For each sample text pair, the first sample keyword of the current sample text pair is used as the first initial node in the current knowledge graph, and the second sample keyword of the current sample text pair is used as the second initial node in the current knowledge graph. The sample association parameters of the current sample text pair are used as the edge weights of the edge relationship formed by the first initial node and the second initial node.
[0124] Optionally, in another possible design, the determining module 21 is also used to call a preset semantic model to process the current sample text pairs after the building module constructs the initial current knowledge graph based on each sample text pair, to determine the first sample vector corresponding to the first sample keyword of the current sample text pair and the second sample vector corresponding to the second sample keyword of the current sample text pair, and to update the vector representation of the first initial node and the second initial node based on the first sample vector and the second sample vector.
[0125] Alternatively, in another possible design, for each piece of historical entry information, each entry field in the current historical entry information includes: an entry personnel identifier field, an entry product identifier field, and at least one entry process identifier field.
[0126] Optionally, the knowledge graph updating device may also include a storage module for storing the program code of the knowledge graph updating device, etc.
[0127] like Figure 6 As shown, this application embodiment also provides a knowledge graph updating device, including a memory 41 and a processor (e.g., Figure 6 The processor includes 42-1 and 42-2, bus 43, and communication interface 44; memory 41 is used to store computer execution instructions, and the processor is connected to memory 41 via bus 43; when the knowledge graph updating device is running, the processor executes the computer execution instructions stored in memory 41 to make the knowledge graph updating device perform the knowledge graph updating method provided in the above embodiments.
[0128] In a specific implementation, as one example, the processor may include one or more central processing units (CPUs), for example... Figure 6 CPU0 and CPU1 are shown in the diagram. As one embodiment, the knowledge graph updating device may include multiple processors, such as... Figure 6 The processors 42-1 and 42-2 are shown in the diagram. Each of these processors (CPUs) can be a single-core processor or a multi-core processor. Here, "processor" can refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).
[0129] Memory 41 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) 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. Memory 41 may exist independently and be connected to the processor via bus 43. Memory 41 may also be integrated with the processor.
[0130] In a specific implementation, memory 41 is used to store the data in this application and the computer execution instructions corresponding to the software program of this application. The processor can perform various functions of the knowledge graph update device by running or executing the software program stored in memory 41 and calling the data stored in memory 41.
[0131] Communication interface 44 uses any transceiver-like device for communicating with other devices or communication networks, such as control systems, radio access networks (RAN), wireless local area networks (WLANs), etc. Communication interface 44 may include a receiving unit to implement receiving functions and a transmitting unit to implement transmitting functions.
[0132] Bus 43 can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus, etc. This bus 43 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0133] As an example, combined Figure 5 The function implemented by the determination module in the knowledge graph update device is the same as... Figure 6 The processor in the memory performs the same function. When the knowledge graph update device includes a storage module, the storage module performs the same function as... Figure 6 The memory in them performs the same function.
[0134] The explanation of the relevant content in this embodiment can be found in the above method embodiment, and will not be repeated here.
[0135] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0136] This application also provides a computer-readable storage medium storing instructions that, when executed by a computer, cause the computer to perform the knowledge graph updating method provided in the above embodiments.
[0137] The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable computer disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM), registers, hard disks, optical fibers, CD-ROMs, optical storage devices, magnetic storage devices, or any suitable combination thereof, or any other form of computer-readable storage medium known in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can reside in an application-specific integrated circuit (ASIC). In embodiments of this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0138] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for updating a knowledge graph, characterized in that, include: Obtain target text pairs; the target text pairs include a first target keyword and a second target keyword; The target text pair is processed by calling a preset semantic model to determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword; Target association parameters are determined based on the first target vector and the second target vector; the target association parameters are used to characterize the degree of association between the first target keyword and the second target keyword; The current knowledge graph is updated based on the first target vector, the second target vector, and the target association parameters; Before the step of calling a preset semantic model to process the target text pair and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword, the method further includes: Retrieve historical data entry information table; Based on the arrangement order of each field in each historical entry, each sample text pair in each historical entry is determined; each sample text pair includes a first sample keyword and a second sample keyword; wherein, the first sample keyword and the second sample keyword correspond to two consecutive fields in each of the fields in each historical entry. Based on the aforementioned sample text pairs, an initial current knowledge graph is constructed, including: Based on the number of text pairs in each sample text pair and the number of text pairs in the associated text pairs of each sample text pair, the sample association parameters of each sample text pair are determined respectively; wherein, the associated text pairs of the current sample text pair are those in which the first sample keyword is the same as the first sample keyword of the current sample text pair, and the second sample keyword is different from the second sample keyword of the current sample text pair. For each sample text pair, the first sample keyword of the current sample text pair is used as the first initial node in the current knowledge graph, and the second sample keyword of the current sample text pair is used as the second initial node in the current knowledge graph. The sample association parameter of the current sample text pair is used as the edge weight of the edge relationship formed by the first initial node and the second initial node.
2. The knowledge graph updating method according to claim 1, characterized in that, The step of updating the current knowledge graph based on the first target vector, the second target vector, and the target association parameters includes: If it is determined that the target association parameter is greater than or equal to the association parameter threshold, then based on the first target vector, the second target vector, and the target association parameter, the first target node corresponding to the first target keyword and the second target node corresponding to the second target keyword are updated in the current knowledge graph.
3. The knowledge graph updating method according to claim 2, characterized in that, The step of updating the first target node corresponding to the first target keyword and the second target node corresponding to the second target keyword in the current knowledge graph based on the first target vector, the second target vector, and the target association parameters includes: The vector representation of the first target node is updated according to the first target vector, and the vector representation of the second target node is updated according to the second target vector. The edge weight of the edge relationship formed by the first target node and the second target node is updated according to the target association parameter.
4. The knowledge graph updating method according to claim 1, characterized in that, The historical entry information table includes each historical entry information within a preset historical time period, and each historical entry information includes at least two entry fields arranged in an orderly manner.
5. The knowledge graph updating method according to claim 1, characterized in that, After using the sample association parameters of the current sample text pair as the edge weights of the edge relationship formed by the first initial node and the second initial node, the method includes: The preset semantic model is invoked to process the current sample text pair, determine the first sample vector corresponding to the first sample keyword of the current sample text pair and the second sample vector corresponding to the second sample keyword of the current sample text pair, and update the vector representation of the first initial node and the second initial node based on the first sample vector and the second sample vector.
6. The knowledge graph updating method according to any one of claims 1 and 5, characterized in that, For each of the aforementioned historical data entries, the data entry fields in the current historical data entry include: a data entry personnel identifier field, a data entry product identifier field, and at least one data entry process identifier field.
7. A knowledge graph updating device, characterized in that, include: The acquisition module is used to acquire target text pairs; the target text pairs include a first target keyword and a second target keyword; The determination module is used to call a preset semantic model to process the target text pair and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword. The determining module is further configured to determine target association parameters based on the first target vector and the second target vector; the target association parameters are used to characterize the degree of association between the first target keyword and the second target keyword; The update module is used to update the current knowledge graph based on the first target vector, the second target vector, and the target association parameters; The acquisition module is further configured to acquire a historical input information table before calling the preset semantic model to process the target text pair and determine the first target vector corresponding to the first target keyword and the second target vector corresponding to the second target keyword. The determining module is further configured to determine each sample text pair in each historical entry information based on the arrangement order of each entry field in each historical entry information; each sample text pair includes a first sample keyword and a second sample keyword; wherein the first sample keyword and the second sample keyword correspond to two consecutive fields in each entry field in each historical entry information. The construction module is used to construct an initial current knowledge graph based on each sample text pair, including: Based on the number of text pairs in each sample text pair and the number of text pairs in the associated text pairs of each sample text pair, the sample association parameters of each sample text pair are determined respectively; wherein, the associated text pairs of the current sample text pair are those in which the first sample keyword is the same as the first sample keyword of the current sample text pair, and the second sample keyword is different from the second sample keyword of the current sample text pair. For each sample text pair, the first sample keyword of the current sample text pair is used as the first initial node in the current knowledge graph, and the second sample keyword of the current sample text pair is used as the second initial node in the current knowledge graph. The sample association parameter of the current sample text pair is used as the edge weight of the edge relationship formed by the first initial node and the second initial node.
8. A knowledge graph updating device, characterized in that, It includes a memory, a processor, a bus, and a communication interface; the memory is used to store computer-executed instructions, and the processor is connected to the memory via the bus; When the knowledge graph updating device is running, the processor executes the computer execution instructions stored in the memory to cause the knowledge graph updating device to perform the knowledge graph updating method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by a computer, cause the computer to perform the knowledge graph update method as described in any one of claims 1-6.
Citation Information
Patent Citations
Construction method and device for medical knowledge map
CN106874695A
Knowledge graph updating method and electronic equipment
CN114357180A