A time sequence and knowledge alignment method based on bipartite graph matching
By transforming the triple matching problem into a bipartite graph matching problem between entities and time, and constructing a weighted model and a bipartite graph matching algorithm, the problem of low training and inference efficiency in time-varying knowledge graphs is solved, and efficient temporal and knowledge alignment is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- UNIV OF ELECTRONICS SCI & TECH OF CHINA
- Filing Date
- 2024-06-26
- Publication Date
- 2026-06-12
Smart Images

Figure CN118863035B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of knowledge graph technology, specifically relating to a method for aligning temporal sequences and knowledge based on bipartite graph matching. Background Technology
[0002] In knowledge graphs that incorporate temporal information, time is a key factor distinguishing them from traditional static knowledge graphs. Real-world phenomena are not static but constantly changing over time. As a representation of real-world phenomena, the knowledge within a time-varying knowledge graph also evolves over time. For example, a person's place of residence might be their hometown, university location, or workplace at different times. Therefore, time-varying knowledge graphs need to extract knowledge containing temporal information from social data to represent the temporal relationships between entities and connections within the graph.
[0003] While entity extraction and relation extraction methods are relatively mature, they still have limitations in handling temporal information to obtain quadruples related to time-varying knowledge graphs. Existing methods generally align temporal information with knowledge by matching temporal information through rule matching and manual verification; others jointly extract knowledge containing temporal information using deep learning and other methods. However, rule matching-based methods are sensitive to rule enumeration and have poor generalization performance; while deep learning-based methods can compensate for the lack of generalization, their training and inference efficiency are low on large-scale datasets.
[0004] Rule-based methods typically extract knowledge according to predefined rules based on manually constructed rule templates. While efficient and fast, rule-based methods suffer from issues such as excessive reliance on rules, poor generalization, and incomplete knowledge extraction due to missing rules.
[0005] Deep learning-based methods typically extract and learn feature patterns of entities and relationships from text, transforming the joint entity and relationship extraction task into a labeling problem, and directly extracting entities and relationships using an end-to-end model. Although deep learning-based joint extraction methods have high generalization ability, their training time increases significantly when the data scale is large, making them unsuitable for real-time, large-scale time-varying knowledge graph construction tasks.
[0006] Due to the limited number of manually enumerated rules and the increasing complexity of deep learning model network structures, existing methods for aligning temporal information with knowledge are constrained by factors such as the significant differences in the distribution patterns of data in specific scenarios, the insufficient generalization ability of manually enumerated rules in matching temporal knowledge, and the low training and inference efficiency of the models. Therefore, both rule-based and deep learning-based methods have significant shortcomings in addressing the problem of obtaining quadruplets in the construction of time-varying knowledge graphs. Summary of the Invention
[0007] To address the aforementioned technical problems, this invention provides a method for aligning temporal information and knowledge based on bipartite graph matching, which can effectively transform the problem of matching temporal knowledge into an optimization problem of a bipartite graph model.
[0008] The technical solution adopted in this invention is: a method for aligning time series and knowledge based on bipartite graph matching, the specific steps of which are as follows:
[0009] S1. Transform the triple matching problem into an entity-time matching problem, and then transform the entity-time matching problem into a bipartite graph matching problem.
[0010] S2. Based on step S1, construct a matching weight model for the entity-time matching relationship;
[0011] S3. Based on step S2, the problem of matching time knowledge is transformed into an optimization problem of a bipartite graph model. A bipartite graph matching algorithm is proposed to solve the problem and complete the alignment of time series and knowledge.
[0012] Furthermore, step S1 is specifically as follows:
[0013] set up Represents a static knowledge graph. Represents a set of entities. A set representing relations.
[0014] One of them In, triples are used To state a fact, Indicates the head entity. Indicates a relationship. This indicates the tail entity.
[0015] Extending temporal information onto a static knowledge graph yields a time-varying knowledge graph. , Represents a set of entities. A set representing relations. A set representing time.
[0016] One of them In, quadruplets are used To state a fact, Indicates the head entity. It exhibits consistency over time. Indicates time.
[0017] The time matching problem is formulated as follows: for a triple... Find the most suitable time Forming a quadruple By determining the head entity Tail-end entity The relationship between the two is thus determined by their time. The time frame transforms the triple matching problem into an entity-time matching problem.
[0018] The matching relationship between time and entity is viewed as an edge connecting the two, using... express.
[0019] in, A set representing entities and time; a set representing points. It represents the matching relationship between entities and time, and represents the set of edges.
[0020] The problem of matching entities with time is transformed into a bipartite graph matching problem, that is, the vertex set... If a graph is divided into two disjoint subsets, and every edge in the graph connects two vertices that belong to the two distinct subsets, then the graph... It can be represented as a bipartite graph, where the edges between vertices represent the matching relationship between entities and time.
[0021] In a bipartite graph, the degree of matching between entities and time is represented by the weight of the edges.
[0022] Furthermore, step S2 is specifically as follows:
[0023] S21. Constructing syntactic structures;
[0024] Extracting time information from a sentence and performing syntactic analysis to determine whether the time appears as a separate sentence component, the influence of syntactic structure on time matching is expressed as follows:
[0025]
[0026] in, The weight parameter represents the syntactic structure part, i.e., the influence factor of this part in the overall weight model; when time appears as a separate sentence component, The value is 1, representing the overall function value. for This indicates that the time of an entity can currently be determined through syntactic structure; when time does not appear as a separate sentence element... The value is 0, the overall function value. for The coefficient is 1, indicating that the time associated with the entity cannot be determined through syntactic structure at present.
[0027] S22. Dependency path analysis to obtain the shortest dependency path length;
[0028] For a sentence, use the spaCy utility library to perform syntactic analysis to obtain a dependency tree, and then obtain the shortest dependency path length between two words.
[0029] The effect of dependency paths on time matching is expressed as follows:
[0030]
[0031] in, This represents the length of the shortest dependency path between an entity and time. Indicates the offset parameter. This represents the weight parameter of the dependency path component, i.e., the influence factor of this component in the entire weight model.
[0032] S23. Extract temporal features;
[0033] When extracting tense features, spaCy is first used to perform part-of-speech analysis on the words in the sentence, and then tense identification is performed on the verbs. The tense features are represented as follows:
[0034]
[0035] in, Indicates the tense of the verb, if it is past tense Present tense and future tense Record the time to be matched as Record the publication time of the text as ,symbol The expression for the value of is as follows:
[0036]
[0037] If the time is before the release time, then If it is after the release time, then it is When the tense of the verb matches the time... This indicates that the time corresponding to the entity in the sentence matches the time to be matched, and the match is highly reliable; if the verb tense does not match the time, ... This indicates that the time corresponding to the entity is not highly consistent with the time to be matched, and the reliability of the match is low.
[0038] S24. Determine the number of co-occurrences;
[0039] The more times an entity and time co-occur in a text, the higher their frequency of occurrence and the stronger their correlation. The expression for the co-occurrence count is as follows:
[0040]
[0041] in, Indicates the number of times an entity co-occurs with time. Indicates the offset parameter. The weight parameter represents the number of co-occurrences, which is the influence factor of this part in the entire weighted model.
[0042] S25. Introduce a time window;
[0043] Based on text context analysis, a time window is introduced. When a time that matches an entity cannot be found in the current sentence, a time to be matched is searched within the time window.
[0044] Number the sentences in the order they appear in the text to form an ordered sequence. ,in Indicates the number of sentences; in the analysis of the first... If no matching time can be found for the first sentence, then start from the previous sentence. Starting with each sentence, the timestamps of each sentence are used as the timestamps to be matched. Then the time window... The expression is defined as follows:
[0045]
[0046] When the time window is determined After the size, proceed sequentially from sentence Select the time to be matched. The expression for the value of is as follows:
[0047]
[0048] If the time to be matched and the entity are not in the same sentence, the dependency path analysis in step S22 cannot be performed, and the shortest dependency path length cannot be obtained. In this case, the positional distance is used instead of the shortest dependency path length.
[0049] In this process, each sentence is segmented according to its order of appearance to obtain the word sequence of the entire text. The sequence difference between two words in the text is the positional distance, which replaces the shortest dependency path length.
[0050] S26. Based on steps S21-S25, construct the objective function of the weight model;
[0051] Based on the analysis of five factors—syntactic structure, dependency path, tense features, co-occurrence frequency, and time window—in steps S21-S25, the scoring function expression of the weighted model is as follows:
[0052]
[0053] in, These represent the weight parameters of syntactic structure, dependency path, and co-occurrence frequency in the model, respectively. Indicates the offset parameter. This represents the length of the shortest dependency path between an entity and time. This parameter indicates the number of times an entity and a time co-occur. When the entity and time are not in the same sentence, the parameter... The distance to the location within the time window becomes the value.
[0054] When syntactic structure is significant When the syntactic structure is absent, considering the influence of other factors, then . The tense feature is represented, and its consistency is used as a coefficient to directly affect the weights of syntactic structure and co-occurrence frequency. When tenses are consistent, a larger weight indicates a higher degree of matching. (Dependency path length part) Co-occurrence frequency Together, they constitute the main part of the weighting model.
[0055] Furthermore, step S3 is specifically as follows:
[0056] S31. Transform the problem of matching time knowledge into an optimization problem of a bipartite graph model;
[0057] The matching problem of time knowledge is to find a time vertex in the time point set and match it for each entity vertex in the entity point set in the bipartite graph. The goal is to maximize the overall edge weight after all entity vertices in the entity point set have been matched.
[0058] The problem of matching the time knowledge is formulated as a bipartite partitioning problem. The weighted complete bipartite graph.
[0059] in, , represents the set of entity vertices, and n represents the positive integer number of entity vertices; Let m represent the set of time vertices, and m represent the number of time vertices as a positive integer. With weight In this weighted bipartite graph, a matching with the largest total weight is found.
[0060] S32. A bipartite graph matching algorithm is proposed to solve the problem and align the time series with the knowledge.
[0061] Based on the KM algorithm, an improved matching algorithm, namely the bipartite graph matching algorithm, is proposed.
[0062] The specific bipartite graph matching algorithm is as follows:
[0063] A1. For point sets The points in, in sequence Find the matching point with the largest weight in the array and use an array. Record The point in The matching point in the middle, for Points in the array Record The point in is The number of point matches in the array, and the corresponding array for each match. The values at each index are incremented by one until the traversal is complete. When the point is in the middle, the corresponding point is obtained. array The value;
[0064] Among them, for The points in sequence Traversal, The time complexity of traversing all points is O(n). ;
[0065] After the traversal steps are completed, if the array If the array contains an index with a value of 0, proceed to step A2; if the array... If there is no index with a value of 0, then it means... The points in the middle are all with The algorithm completes the point matching process, obtaining the matching results of all entities and time.
[0066] A2. Regarding the results obtained in step A1 Array traversal, in We obtain the points corresponding to the indices with a value of 0, and treat these points as a set. For sets The point in, and its relationship with The points in the graph are reconstructed into a bipartite graph, and the matching process will... If the points in the set are taken as the complete set of matches, then the KM algorithm is used for matching to obtain the maximum weighted matching result, and then... The matching point records in the data are a set Then, based on the results, the set Midpoint corresponding Array update;
[0067] After step A2 is completed, a portion of the entity-time matching results are obtained, i.e., a set. points in The points in the algorithm have been matched. Furthermore, step A2 introduces relaxation parameters to optimize the KM algorithm, reducing the time complexity to [missing value]. .
[0068] A3, from the set Remove the set of points that have already been matched. Get the set and from the set Remove the set of points that have already been matched. Get the set , will set and set Step A1 is re-executed as a new set, and in step A2, the set from step A1 is... Unmatched points in If a match is found in the set, the algorithm ends, and all sets are... Points and sets in All points in the array are matched.
[0069] Finally, a bipartite graph matching algorithm is used to match temporal knowledge, thus aligning the time series with the knowledge.
[0070] The beneficial effects of this invention are as follows: This invention addresses the problems existing in the construction of time-varying knowledge graphs and the alignment of temporal information and knowledge. First, it transforms the triple matching problem into an entity-time matching problem, then into a bipartite graph matching problem. Next, it constructs a matching weight model for the entity-time matching relationship. Finally, it transforms the temporal knowledge matching problem into an optimization problem of a bipartite graph model, proposing a bipartite graph matching algorithm to solve it, thus completing the alignment of temporal information and knowledge. This invention transforms the temporal knowledge matching problem into a bipartite graph model, reducing time complexity from the perspective of bipartite graph matching optimization and improving performance in large-scale data processing. It proposes a matching weight model that integrates syntactic structure, dependency paths, temporal features, co-occurrence frequency, and time windows to assign appropriate weights to edges in the bipartite graph, thereby quantifying the degree of matching between entities and time. This model can more accurately capture the correlation between time and knowledge under multiple features, possessing high accuracy, and ensuring accuracy while reducing time complexity. Attached Figure Description
[0071] Figure 1 This is a flowchart of a time series and knowledge alignment method based on bipartite graph matching according to the present invention.
[0072] Figure 2 This is a schematic diagram of bipartite graph matching between entities and time in an embodiment of the present invention.
[0073] Figure 3 This is a schematic diagram of the dependency relationship tree in an embodiment of the present invention.
[0074] Figure 4 This is a schematic diagram of the bipartite graph matching algorithm in an embodiment of the present invention. Detailed Implementation
[0075] The method of the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0076] like Figure 1 The flowchart of a time series and knowledge alignment method based on bipartite graph matching according to the present invention is shown below. The specific steps are as follows:
[0077] S1. Transform the triple matching problem into an entity-time matching problem, and then transform the entity-time matching problem into a bipartite graph matching problem.
[0078] S2. Based on step S1, construct a matching weight model for the entity-time matching relationship;
[0079] S3. Based on step S2, the problem of matching time knowledge is transformed into an optimization problem of a bipartite graph model. A bipartite graph matching algorithm is proposed to solve the problem and complete the alignment of time series and knowledge.
[0080] In this embodiment, step S1 is specifically as follows:
[0081] set up Represents a static knowledge graph. Represents a set of entities. A set representing relations.
[0082] One of them In, triples are used To state a fact, Indicates the head entity. Indicates a relationship. This indicates the tail entity.
[0083] Extending temporal information onto a static knowledge graph yields a time-varying knowledge graph. , Represents a set of entities. A set representing relations. A set representing time.
[0084] One of them In, quadruplets are used To state a fact, Indicates the head entity. They are consistent over time, even though they are... All three are consistent. Indicates time.
[0085] The time matching problem is formulated as follows: for a triple... Find the most suitable time Forming a quadruple Because of the triplet With consistent time Therefore, for Only the time of both needs to be determined. This allows us to determine the time of the entire triple. This embodiment addresses the time-matching problem of triples by determining the head entity. Tail-end entity The relationship between the two is thus determined by their time. The time frame transforms the triple matching problem into an entity-time matching problem.
[0086] Time and entity are two disjoint sets, and the matching relationship between time and entity is considered as the edge connecting them. express.
[0087] in, A set representing entities and time; a set representing points. It represents the matching relationship between entities and time, and represents the set of edges.
[0088] The problem of matching entities with time is transformed into a bipartite graph matching problem, that is, the vertex set... If a graph is divided into two disjoint subsets, and every edge in the graph connects two vertices that belong to the two distinct subsets, then the graph... Represented as a bipartite graph, the edges between vertices represent the matching relationship between entities and time, i.e., as shown below. Figure 2 As shown, where Indicates the first One entity, Indicates the first At that time.
[0089] In a bipartite graph, the degree of matching between entities and time is represented by the weight of the edges.
[0090] After transforming the entity-time matching problem into a bipartite graph matching problem, this embodiment considers the matching relationship between the two. The matching relationship is abstracted into the edge between two vertices in the bipartite graph. The degree of matching between entity and time is then represented by the weight of the edge in the bipartite graph.
[0091] In this embodiment, step S2 is specifically as follows:
[0092] This embodiment first proposes a weighted model for measuring the degree of entity-time matching, used to assign weights to edges in a bipartite graph. By assigning weights to the edges between entity vertices and time vertices in the bipartite graph, the degree of entity-time matching can be measured. The higher the degree of entity-time matching in the entire text, the higher the weight score between them should be. This embodiment constructs a matching weighted model of entity-time matching relationships from five aspects: syntactic structure, dependency path, tense features, co-occurrence frequency, and time window. Finally, the objective function of the matching weighted model is given. That is, the bipartite graph is transformed into a weighted bipartite graph, and solving the time-entity matching problem is transformed into finding a time vertex for each entity vertex in the weighted bipartite graph that maximizes the overall weight, i.e., solving the maximum weight matching problem.
[0093] S21. Constructing syntactic structures;
[0094] Syntactic structure is a prominent feature in time matching problems. In syntactic structures where time information appears as an independent sentence component, entities describing an event at a specific point in time are directly linked to that time information, forming a complete sentence structure. When such a syntactic structure occurs, matching the entity with that time information is considered first. In this embodiment, after extracting the time information from the sentence, syntactic analysis is performed to determine whether the time appears as a separate sentence component. The influence of syntactic structure on time matching is expressed as follows:
[0095]
[0096] in, The weight parameter represents the syntactic structure part, i.e., the influence factor of this part in the overall weight model; when time appears as a separate sentence component, The value is 1, representing the overall function value. for This indicates that the time of an entity can currently be determined through syntactic structure; when time does not appear as a separate sentence element... The value is 0, the overall function value. for The coefficient is 1, indicating that the time associated with the entity cannot be determined through syntactic structure at present.
[0097] Therefore, the weight of syntactic structure contribution varies for different sentence forms. Steps S22-S25 will analyze the construction of other parts of the matching weight model besides syntactic structure.
[0098] S22. Dependency path analysis to obtain the shortest dependency path length;
[0099] Dependency path length refers to the length of the path connecting two words in a dependency relationship. In natural language processing tasks, dependency relationships refer to the grammatical relationships between words in a sentence, which constitute the sentence's structure and grammatical rules. A dependency tree is a tree-like structure describing sentence structure, where each word is a node in the tree, and the dependency relationships between words in a sentence are represented by edges. The root node in a dependency tree usually corresponds to the core word in the sentence or a virtual root node. Other words are child nodes of this root node, and each child node has an edge with its corresponding parent node, representing a grammatical relationship, such as subject-verb or verb-object.
[0100] For time-based matching problems, dependency path length can be used to measure the grammatical distance between an entity and a time element. A shorter dependency path length indicates a closer grammatical relationship between the entity and the time element. Dependency path length is typically determined using dependency parsing techniques in natural language processing. This involves identifying the dependency relationships between words and constructing a dependency tree to obtain the dependency path length between two words. The number of dependency edges contained in the shortest dependency path between two words in the dependency tree is called the shortest dependency path length. In this embodiment, the shortest dependency path length is used to represent the dependency path length between an entity and a time element.
[0101] For a sentence, the spaCy utility library is used for syntactic analysis to obtain a dependency tree, which shows the shortest dependency path length between two words. This example uses the sentence "The satellite was officially launched in 2024," and the corresponding dependency tree is as follows: Figure 3 As shown in the figure, the shortest dependency path between the entity word "satellite" and the time word "2024" is ("satellite", "launch", "2024"), and the shortest dependency path length is 2.
[0102] The shorter the shortest dependency path between an entity term and a time term, the tighter the syntactic structure between them, and the more likely the time information is a correct match for the entity. The effect of dependency paths in time matching is expressed as follows:
[0103]
[0104] in, This represents the length of the shortest dependency path between an entity and time. Indicates the offset parameter. This represents the weight parameter of the dependency path component, i.e., the influence factor of this component in the entire weight model.
[0105] To capture changes in the shortest dependency path length, this embodiment aims to capture the most drastic changes at shorter dependency path lengths; therefore, an exponential function is used. When the shortest dependency path length is small, even a small change in length can cause a drastic change in the function value, thus increasing the probability of obtaining the time relationship most closely related to the entity in terms of syntactic structure.
[0106] S23. Extract temporal features;
[0107] Besides syntactic and grammatical structures, tense features directly reflect temporal information. When people express themselves, they correspondingly represent temporal information in tense features; therefore, tense features are also an important factor to consider in time matching tasks. Tense features are usually directly related to verbs in a sentence. Verbs reflect the temporal state of an action or event, and they are also the main grammatical components of a sentence; most sentences generally contain verbs. By analyzing verb tenses, we can more accurately understand the temporal sequence of events or actions in a sentence, thereby more precisely matching the temporal information corresponding to entities in the sentence. Therefore, verb tenses are the focus of this embodiment when considering tense features. In many languages, including Chinese and English, verb tenses can generally be divided into past tense (representing past time, usually used to describe events or actions that have already occurred), present tense (representing the current time, used to describe events and actions that are in progress), and future tense (representing future time, used to describe events or actions that will happen in the future).
[0108] When extracting tense features, spaCy is first used to perform part-of-speech analysis on the words in the sentence, and then tense identification is performed on the verbs. The tense features are represented as follows:
[0109]
[0110] in, Indicates the tense of the verb, if it is past tense Present tense and future tense Record the time to be matched as Record the publication time of the text as ,symbol The expression for the value of is as follows:
[0111]
[0112] If the time is before the release time, then If it is after the release time, then it is When the tense of the verb matches the time... This indicates that the time corresponding to the entity in the sentence matches the time to be matched, and the match is highly reliable; if the verb tense does not match the time, ... This indicates that the time corresponding to the entity is not highly consistent with the time to be matched, and the reliability of the match is low.
[0113] S24. Determine the number of co-occurrences;
[0114] In the task of matching entity and time information, in addition to syntactic and structural analysis, this embodiment also considers the degree of association between entities and time from the perspective of global context. The more times an entity and time co-occur in the text, the higher their frequency of simultaneous occurrence and the stronger their association. During the matching process, the system tends to select entities and times with higher co-occurrence frequencies because they are more likely to appear in the same context, thus increasing the probability of a correct match. Conversely, fewer co-occurrences between entities and time indicate a weaker association, making incorrect matching more likely. Furthermore, the number of co-occurrences only indicates a certain degree of association between entities and time in the text; its importance to the matching task is relatively weak. Therefore, the expression for the number of co-occurrences is as follows:
[0115]
[0116] in, Indicates the number of times an entity co-occurs with time. Indicates the offset parameter. This represents the weighting parameter for the co-occurrence frequency component, i.e., its influence factor in the overall weighting model. The co-occurrence frequency factor has a relatively low impact on entity-time matching and is considered more as an auxiliary factor, indicating that it should not significantly disturb the overall weighting model; therefore, a logarithmic function is used. When the co-occurrence frequency varies greatly, this component has a smaller disturbance to the overall weighting model.
[0117] S25. Introduce a time window;
[0118] In real-world text scenarios, the time corresponding to an entity may not necessarily appear in the current sentence. In context-based situations, time information may have been mentioned earlier in the text, and subsequent text expands upon that earlier time, thus the time information will not reappear in later sentences. Therefore, in studying entity-time matching, we cannot limit ourselves to a single sentence. When a matching time cannot be found in the current sentence, we should consider whether the time appeared in the preceding text and attempt to match it with the entity. Therefore, this embodiment introduces a time window based on text context analysis. When a matching time cannot be found in the current sentence, a time to be matched is searched within the time window.
[0119] Number the sentences in the order they appear in the text to form an ordered sequence. ,in Indicates the number of sentences. In analyzing the... If no matching time can be found for the first sentence, then start from the previous sentence. Starting with each sentence, the timestamps of each sentence are used as the timestamps to be matched. Then the time window... The expression is defined as follows:
[0120]
[0121] When the time window is determined After the size, proceed sequentially from sentence Select the time to be matched. The expression for the value of is as follows:
[0122]
[0123] If the time and entity to be matched are not in the same sentence, dependency path analysis in step S22 cannot be performed, and the shortest dependency path length cannot be obtained. In this case, positional distance is used instead of the shortest dependency path length. Positional distance refers to the difference in the positions of two words after word segmentation in the text. Figure 3 Taking the example sentence "The satellite was officially launched in 2024" as an example, the sequence after word segmentation is {"satellite", "officially", "launch", "launch", "in", "2024"}, where the positional distance between "satellite" and "2024" is 5, and the shortest dependency path length between the two is 2.
[0124] In the actual calculation, each sentence is segmented into words according to the order in which they appear to obtain the word sequence of the entire text. The sequence difference between two words in the text is the positional distance, which replaces the shortest dependency path length.
[0125] S26. Based on steps S21-S25, construct the objective function of the weight model;
[0126] Based on the analysis of five factors—syntactic structure, dependency path, tense features, co-occurrence frequency, and time window—in steps S21-S25, the scoring function expression of the weighted model is as follows:
[0127]
[0128] in, These represent the weight parameters of syntactic structure, dependency path, and co-occurrence frequency in the model, respectively. This represents the offset parameter, which is used to add a certain offset to the function part. This represents the length of the shortest dependency path between an entity and time. This parameter indicates the number of times an entity and a time co-occur. When the entity and time are not in the same sentence, the parameter... The distance to the location within the time window becomes the value.
[0129] When syntactic structure is significant When the syntactic structure is absent, considering the influence of other factors, then . The tense feature is represented, and its consistency is used as a coefficient to directly affect the weights of syntactic structure and co-occurrence frequency. When tenses are consistent, a larger weight indicates a higher degree of matching. (Dependency path length part) Co-occurrence frequency Together, they constitute the main part of the weighted model. Both affect the weight of the matching edge between entities and time, but since the dependency path length part is an exponential function, changes in its parameters have a drastic impact on the overall change. Conversely, the co-occurrence frequency part uses a logarithmic function, and the characteristics of the logarithmic function make the impact of increasing the co-occurrence frequency on the edge weight relatively stable, without drastic changes. Therefore, changes in its parameters have a smaller disturbance to the overall model. This embodiment adopts this design to take into account the different effects of dependency path length and co-occurrence frequency on edge weights, enabling the model to maintain a certain degree of stability and controllability under different conditions.
[0130] In this embodiment, step S3 is specifically as follows:
[0131] S31. Transform the problem of matching time knowledge into an optimization problem of a bipartite graph model;
[0132] Based on steps S1-S2, after obtaining the bipartite graph of entities and time and the edge weight model, the next problem to be solved is matching a large number of entities and time in the text. The goal of this embodiment is to maximize the matching degree of entities and time throughout the entire text. Therefore, we cannot only consider the best match of a single entity, but need to take a global perspective to obtain the overall best match of all entities. That is, the matching problem in this embodiment is a global optimization problem.
[0133] Based on the weight model (bipartite graph model) constructed in step S2, entities and time are two unrelated sets of points. The edge between any pair of entity vertices and time vertices can be weighted using the weight model in step S2, and the larger the weight, the higher the degree of matching between the two.
[0134] The matching problem of time knowledge is to find a time vertex in the time point set and match it for each entity vertex in the entity point set in the bipartite graph. The goal is to maximize the overall edge weight after all entity vertices in the entity point set have been matched.
[0135] The problem of matching the time knowledge is formulated as a bipartite partitioning problem. The weighted complete bipartite graph.
[0136] in, , represents the set of entity vertices, and n represents the positive integer number of entity vertices; Let m represent the set of time vertices, and m represent the number of time vertices as a positive integer. With weight In this weighted bipartite graph, a matching with the largest total weight is found.
[0137] If we directly use existing methods for brute-force solution, it will take a total of Second match. In In this case, the time complexity is O(n log n). .
[0138] S32. A bipartite graph matching algorithm is proposed to solve the problem and align the time series with the knowledge.
[0139] While mature algorithms like the KM algorithm can reduce time complexity, they require that a vertex in another vertex set can only be matched once. In other words, for a time vertex, it can only match one entity vertex. Furthermore, after all points in one set are matched, points in the other set may remain unmatched. However, in the person-decision time-varying knowledge graph construction task of this embodiment, multiple events or behaviors may occur simultaneously, and multiple entities may match the same time. Moreover, the time appearing in the text should also be matched with a specific entity. Therefore, the KM algorithm cannot be directly applied to the entity-time matching problem in this embodiment.
[0140] This embodiment proposes an improved matching algorithm, namely the bipartite graph matching algorithm, based on the KM (Kuhn-Munkres) algorithm.
[0141] like Figure 4 As shown, the bipartite graph matching algorithm is as follows:
[0142] A1. For point sets The points in, in sequence Find the matching point with the largest weight in the array and use an array. Record The point in The matching point in the middle, for Points in the array Record The point in is The number of point matches in the array, and the corresponding array for each match. The values at each index are incremented by one until the traversal is complete. When the point is in the middle, the corresponding point is obtained. array The value;
[0143] Among them, for The points in sequence Traversal, The time complexity of traversing all points is O(n). However, obtaining the optimal match on the first try is an ideal situation; in reality, multiple iterations are required to achieve the optimal match.
[0144] After the traversal steps are completed, if the array If the array contains an index with a value of 0, proceed to step A2; if the array... If there is no index with a value of 0, then it means... The points in the middle are all with The algorithm completes the point matching process, obtaining the matching results of all entities and time.
[0145] A2. Regarding the results obtained in step A1 Array traversal, in We obtain the points corresponding to the indices with a value of 0, and treat these points as a set. For sets The point in, and its relationship with The points in the graph are reconstructed into a bipartite graph, and the matching process will... If the points in the set are taken as the complete set of matches, then the KM algorithm is used for matching to obtain the maximum weighted matching result, and then... The matching point records in the data are a set Then, based on the results, the set Midpoint corresponding Array update;
[0146] After step A2 is completed, a portion of the entity-time matching results are obtained, i.e., a set. points in The points in the algorithm have been matched. Furthermore, step A2 introduces relaxation parameters to optimize the KM algorithm, reducing the time complexity to [missing value]. .
[0147] A3, from the set Remove the set of points that have already been matched. Get the set and from the set Remove the set of points that have already been matched. Get the set , will set and set Step A1 is re-executed as a new set, and in step A2, the set from step A1 is... Unmatched points in If a match is found in the set, the algorithm ends, and all sets are... Points and sets in All points in the array are matched.
[0148] Based on the overall algorithm flow, it can be seen that in the worst-case scenario, it is necessary to perform... Each iteration requires... This operation has a time complexity of O(n). However, in actual step A2, only a portion of the points participate in the matching, and at most only a few... There are several points. In the case of the maximum number of iterations, the time complexity of step A2 can be considered approximately... In the worst case, the time complexity of step A2 is O(n). If the iteration count is constant, then the time complexity of the bipartite graph matching algorithm described in this embodiment can be approximated as... .
[0149] Finally, a bipartite graph matching algorithm is used to match temporal knowledge, thus aligning the time series with the knowledge.
[0150] In summary, the method of this invention transforms the problem of matching temporal knowledge into a bipartite graph model, reducing time complexity from the perspective of bipartite graph matching optimization and improving performance in large-scale data processing. It proposes a matching weight model that integrates syntactic structure, dependency path, temporal features, co-occurrence frequency, and time window to assign appropriate weights to the edges in the bipartite graph, thereby quantifying the degree of matching between entities and time. This model can more accurately capture the correlation between time and knowledge under multiple features and has high accuracy, ensuring accuracy while reducing time complexity.
[0151] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the principles of the invention, and should be understood that the scope of protection of the invention is not limited to such specific statements and embodiments. Various modifications and variations can be made to the invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the scope of the claims of the invention.
Claims
1. A method for aligning time series data with knowledge based on bipartite graph matching, the specific steps of which are as follows: S1. Transform the triple matching problem into an entity-time matching problem, and then transform the entity-time matching problem into a bipartite graph matching problem. The specific steps of S1 are as follows: set up Represents a static knowledge graph. Represents a set of entities. A set representing relations; in, one In, triples are used To state a fact, Indicates the head entity. Indicates a relationship. Indicates the tail entity; Extending temporal information onto a static knowledge graph yields a time-varying knowledge graph. , Represents a set of entities. A set representing relations. A set representing time; One of them In, quadruplets are used To state a fact, Indicates the head entity. It exhibits consistency over time. Indicates time; The time matching problem is formulated as follows: for a triple... Find the most suitable time Forming a quadruple By determining the head entity Tail-end entity The relationship between the two is thus determined by their time. The time frame transforms the triple matching problem into an entity-time matching problem; The matching relationship between time and entity is viewed as an edge connecting the two, using... express; in, A set representing entities and time; a set representing points. It represents the matching relationship between entities and time, and represents the set of edges; The problem of matching entities with time is transformed into a bipartite graph matching problem, that is, the vertex set... If a graph is divided into two disjoint subsets, and every edge in the graph connects two vertices that belong to the two distinct subsets, then the graph... It can be represented as a bipartite graph, where the edges between vertices represent the matching relationship between entities and time. In this bipartite graph, the degree of matching between entities and time is represented by the weight of the edges. S2. Based on step S1, construct a matching weight model for the entity-time matching relationship; Based on the analysis of five factors—syntactic structure, dependency path, tense features, co-occurrence frequency, and time window—the scoring function expression of the weighted model is as follows: ; in, These represent the weight parameters of syntactic structure, dependency path, and co-occurrence frequency in the model, respectively. Indicates the offset parameter. This represents the length of the shortest dependency path between an entity and time. This parameter indicates the number of times an entity and a time co-occur. When the entity and time are not in the same sentence, the parameter... The location distance within the time window; when time appears as a separate sentence element. The value is 1; when time does not appear as a separate sentence element, The value is 0; Indicates the tense of the verb, if it is past tense Present tense and future tense If the time is before the release time, then If it is after the release time, then it is ; When syntactic structure is significant When the syntactic structure is absent, considering the influence of other factors, then The tense feature is represented, and its consistency, as a coefficient, directly affects the weights of syntactic structure and co-occurrence frequency. When tenses are consistent, a larger weight indicates a higher degree of matching; the dependency path length part... Co-occurrence frequency Together they constitute the main part of the weighting model; S3. Based on step S2, the problem of matching time knowledge is transformed into an optimization problem of a bipartite graph model. A bipartite graph matching algorithm is proposed to solve the problem and complete the alignment of time series and knowledge.
2. The method for aligning time series and knowledge based on bipartite graph matching according to claim 1, characterized in that, Step S2 is as follows: S21. Constructing syntactic structures; Extracting time information from a sentence and performing syntactic analysis to determine whether the time appears as a separate sentence component, the influence of syntactic structure on time matching is expressed as follows: ; in, The weight parameter represents the syntactic structure part, i.e., the influence factor of this part in the overall weight model; when time appears as a separate sentence component, The value is 1, representing the overall function value. for This indicates that the time of an entity can currently be determined through syntactic structure; when time does not appear as a separate sentence element... The value is 0, the overall function value. for A coefficient of 1 indicates that the time associated with the entity cannot be determined through syntactic structure at present. S22. Dependency path analysis to obtain the shortest dependency path length; For a sentence, use the spaCy utility library to perform syntactic analysis to obtain a dependency tree, and obtain the shortest dependency path length between two words; The effect of dependency paths on time matching is expressed as follows: ; in, This represents the length of the shortest dependency path between an entity and time. Indicates the offset parameter. This represents the weight parameters of the dependency path component, i.e., the influence factor of this component in the entire weight model; S23. Extract temporal features; When extracting tense features, we first use spaCy to perform part-of-speech analysis on the words in the sentence, and then perform tense identification on the verbs; the tense features are represented as follows: ; in, Indicates the tense of the verb, if it is past tense Present tense and future tense Record the time to be matched as Record the publication time of the text as ,symbol The expression for the value of is as follows: ; If the time is before the release time, then If it is after the release time, then it is When the tense of the verb matches the time... This indicates that the time corresponding to the entity in the sentence matches the time to be matched, and the match is highly reliable; if the verb tense does not match the time, ... This indicates that the time corresponding to the entity is not highly consistent with the time to be matched, and the reliability of the match is low. S24. Determine the number of co-occurrences; The more times an entity and time co-occur in a text, the higher their frequency of occurrence and the stronger their correlation. The expression for the co-occurrence count is as follows: ; in, Indicates the number of times an entity co-occurs with time. Indicates the offset parameter. The weight parameter represents the number of co-occurrences, i.e., the influence factor of this part in the entire weight model; S25. Introduce a time window; Based on text context analysis, a time window is introduced. When a time that matches an entity cannot be found in the current sentence, a time to be matched is searched within the time window. Number the sentences in the order they appear in the text to form an ordered sequence. ,in Indicates the number of sentences; in the analysis of the first... If no matching time can be found for the first sentence, then start from the previous sentence. Starting with each sentence, the timestamps of each occurrence are used as the timestamps to be matched; thus, the time window... The expression is defined as follows: ; When the time window is determined After the size, proceed sequentially from sentence Select the time to be matched. The expression for the value of is as follows: ; If the time to be matched and the entity are not in the same sentence, the dependency path analysis in step S22 cannot be performed and the shortest dependency path length cannot be obtained. In this case, the positional distance is used instead of the shortest dependency path length. In this process, each sentence is segmented according to its order of appearance to obtain the word sequence of the entire text. The sequence difference between two words in the text is the positional distance, which replaces the shortest dependency path length.
3. The method for aligning time series and knowledge based on bipartite graph matching according to claim 1, characterized in that, Step S3 is as follows: S31. Transform the problem of matching time knowledge into an optimization problem of a bipartite graph model; The matching problem of time knowledge is to find a time vertex in the time point set and match it for each entity vertex in the entity point set in the bipartite graph. When all entity vertices in the entity point set are matched, the overall edge weight is maximized. The problem of matching the time knowledge is formulated as a bipartite partitioning problem. A weighted complete bipartite graph; in, , represents the set of entity vertices, and n represents the positive integer number of entity vertices; Let m represent the set of time vertices, and m represent the number of time vertices as a positive integer. With weight In this weighted bipartite graph, a matching with the largest total weight is found. S32. A bipartite graph matching algorithm is proposed to solve the problem and align the time series with the knowledge. Based on the KM algorithm, an improved matching algorithm is proposed, namely the bipartite graph matching algorithm; The specific bipartite graph matching algorithm is as follows: A1. For point sets The points in, in sequence Find the matching point with the largest weight in the array and use an array. Record The point in The matching point in the middle, for Points in the array Record The point in is The number of point matches in the array, and the corresponding array for each match. The values at each index are incremented by one until the traversal is complete. When the point is in the middle, the corresponding point is obtained. array The value; Among them, for The points in sequence Traversal, The time complexity of traversing all points is O(n). ; After the traversal steps are completed, if the array If the array contains an index with a value of 0, proceed to step A2; if the array... If there is no index with a value of 0, then it means... The points in the middle are all with The algorithm completes the point matching process to obtain the matching results of all entities and time. A2. Regarding the results obtained in step A1 Array traversal, in We obtain the points corresponding to the indices with a value of 0, and treat these points as a set. For sets The point in, and its relationship with The points in the graph are reconstructed into a bipartite graph, and the matching process will... If the points in the set are taken as the complete set of matches, then the KM algorithm is used for matching to obtain the maximum weighted matching result, and then... The matching point records in the data are a set Then, based on the results, the set Midpoint corresponding Array update; After step A2 is completed, a portion of the entity-time matching results are obtained, i.e., a set. points in The points in the algorithm have been matched; and step A2 introduces relaxation to optimize the KM algorithm, reducing the time complexity to... ; A3, from the set Remove the set of points that have already been matched. Get the set and from the set Remove the set of points that have already been matched. Get the set , will set and set Step A1 is re-executed as a new set, and in step A2, the set from step A1 is... Unmatched points in If a match is found in the set, the algorithm ends, and all sets are... Points and sets in All points in the list are matched; Finally, a bipartite graph matching algorithm is used to match temporal knowledge, thus aligning the time series with the knowledge.