Power grid intelligent question and answer method and system based on knowledge graph path reasoning

By identifying anchor entities in the power grid knowledge graph and using a reinforcement learning strategy network to optimize path search, combined with time consistency scoring, the problems of entity linking errors and low path search efficiency in the power grid question answering system are solved, achieving a more accurate and efficient question answering process.

CN121480653BActive Publication Date: 2026-05-08INFORMATION & COMMUNICATION BRANCH STATE GRID JIBEI ELECTRIC POWER CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INFORMATION & COMMUNICATION BRANCH STATE GRID JIBEI ELECTRIC POWER CO LTD
Filing Date
2025-11-10
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Traditional power grid question-and-answer systems struggle to understand user query intent, suffer from incorrect entity links and inefficient path searches, and ignore time consistency, leading to incorrect answers.

Method used

A path reasoning method based on knowledge graphs is adopted. Anchor entities are identified by weighting text similarity and attribute satisfaction. A reinforcement learning policy network is used for path search, and the optimal path is selected by combining path time consistency score.

Benefits of technology

It improves the accuracy and efficiency of the question-and-answer system, ensures the rigor of the path logic, avoids the incorrect concatenation of facts in different time contexts, and enhances the reliability of handling complex time-related issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121480653B_ABST
    Figure CN121480653B_ABST
Patent Text Reader

Abstract

The application provides a power grid intelligent question and answer method and system based on a knowledge graph path reasoning, comprising: analyzing user input, extracting question entities, intents and attribute constraints; determining anchor entities through entity linking; taking the anchor entities as a starting point, searching for paths by using a reinforcement learning strategy, pruning low-probability actions, and obtaining multiple candidate paths; calculating the timestamp variance of each path, normalizing to obtain a time consistency score, and weighting and summing the path confidence to obtain a comprehensive score; selecting the path with the highest comprehensive score as the optimal path; and generating a natural language answer output according to the optimal path.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of intelligent question answering, and in particular relates to an intelligent question answering method and system for power grids based on knowledge graph path reasoning. Background Technology

[0002] With the continuous expansion of the power grid and the improvement of its informatization level, massive amounts of multi-source heterogeneous data are generated during the operation, maintenance, and management of the power grid. Traditional question-answering systems based on keyword retrieval or fixed templates struggle to understand user query intent. Knowledge graph-based question-answering methods typically transform the question-answering process into a path reasoning process on the graph, that is, starting from the entities in the question and finding the relational paths connecting to the answer entities to obtain the answer. In the entity linking stage, the names of power grid equipment entities often have abbreviations, aliases, or ambiguities, and relying solely on text similarity for linking can easily lead to entity identification errors. In the path reasoning stage, the power grid knowledge graph is vast and complex, facing a large search space when searching for paths. Traditional path search algorithms are inefficient and prone to getting trapped in local optima, making it difficult to find the correct reasoning path that matches the user's true intent. Facts in the power grid knowledge graph often have strong temporal attributes; for example, equipment status, alarm information, and operation records are all related to specific points in time or time periods. Most existing path reasoning methods ignore the temporal consistency between different facts in the path, which may incorrectly link facts from different time contexts to form a seemingly reasonable but actually illogical reasoning path, resulting in the generation of incorrect answers and affecting the reliability of question answering systems when dealing with complex time-related questions. Summary of the Invention

[0003] This invention proposes a power grid intelligent question-answering method based on knowledge graph path reasoning, which addresses the problem that existing question-answering systems struggle to find the correct reasoning path that matches the user's true intent. The method includes:

[0004] The system obtains a natural language power grid question input by the user, parses the power grid question, and obtains the question entity, question intent, and entity attribute constraints.

[0005] Based on the problem entity, entity attribute constraints, and preset entity type templates, entity links are performed in the power grid knowledge graph. When the weighted sum of the text similarity score and attribute satisfaction of a candidate entity is higher than the link threshold, the candidate entity is determined to be the anchor entity.

[0006] Starting with the anchored entity, a pre-trained reinforcement learning policy network is used to perform path search in the power grid knowledge graph. In each step of the path expansion, actions with a probability lower than a preset pruning threshold given by the policy network are removed to obtain multiple candidate paths that satisfy the intent of the problem. The semantic consistency of each candidate path is verified by using the ontology constraints of the anchored entity and predefined reasoning rules, and candidate paths that contradict the context of the anchored entity or violate domain knowledge are pruned.

[0007] For each candidate path, the timestamp variance of all triplet facts in the path is calculated, and the path time consistency score is obtained by normalizing the inverse of the timestamp variance. The path time consistency score is then weighted and summed with the confidence score of the path output by the policy network to obtain the comprehensive score of the candidate path. The path with the highest comprehensive score is selected as the optimal path. Based on the entities and relations in the optimal path, a natural language answer is generated and output.

[0008] Optionally, the step of parsing the power grid problem to obtain the problem entity, problem intent, and entity attribute constraints includes:

[0009] A bidirectional long short-term memory network-conditional random field model is used to perform sequence labeling on the power grid problem, and named entities are identified and extracted as problem entities and entity attribute constraints;

[0010] A text convolutional neural network model is used to classify the power grid problem and determine the intent of the problem.

[0011] Optionally, determining the candidate entity as an anchor entity when the weighted sum of the text similarity score and attribute satisfaction of the candidate entity is higher than the link threshold includes:

[0012] The Jaro-Winkler distance algorithm is used to calculate the text similarity score between the candidate entity and the question entity;

[0013] The proportion of attribute constraints satisfied by candidate entities to the total number of attribute constraints of all entities is used as the attribute satisfaction level.

[0014] The text similarity score and attribute satisfaction are weighted and summed with weights of 0.6 and 0.4 respectively. When the sum is greater than 0.85, the candidate entity is determined to be the anchor entity.

[0015] Optionally, the path search performed in the power grid knowledge graph using a pre-trained reinforcement learning policy network includes:

[0016] The current entity vector is concatenated with the historical path vector and used as the input to the policy network;

[0017] The policy network employs a multilayer perceptron containing two fully connected layers. Each fully connected layer is followed by a modified linear unit activation function. The network's output layer is a softmax function, used to calculate the probability distribution of extensions to next-hop relations and entities.

[0018] Optionally, removing actions with a probability lower than a preset pruning threshold given by the policy network at each step of the path expansion includes:

[0019] At each step of the path search, obtain all possible actions output by the policy network and the probability corresponding to each possible action;

[0020] Actions with an expansion probability lower than a preset pruning threshold are removed from the candidate action set in the current step.

[0021] Optionally, obtaining the path time consistency score by normalizing the reciprocal of the timestamp variance includes:

[0022] Extract the timestamp corresponding to each triplet fact in the path to form a timestamp sequence;

[0023] Calculate the variance of the timestamp sequence. ;

[0024] Through formula Calculate the path time consistency score .

[0025] Optionally, the step of weighted summing of the path temporal consistency score and the path confidence score output by the policy network to obtain the comprehensive score of the candidate path includes:

[0026] Path confidence It is the product of the probabilities of all actions on the path;

[0027] The overall score is calculated using the following formula. :

[0028]

[0029] in, Let k1 and k2 be the path time consistency score, and k1 and k2 be the weights.

[0030] Optionally, generating and outputting a natural language answer based on the entities and relationships in the optimal path includes:

[0031] Extract the starting point anchor entity of the path and the tail entity of the last triple from the optimal path as the answer entity;

[0032] The anchor entity and the answer entity are filled into a preset answer template to obtain a complete natural language answer and output it.

[0033] Furthermore, this invention also relates to a smart question-answering system for power grids based on knowledge graph path reasoning, comprising the following modules:

[0034] The parsing module is used to obtain the user's input of a natural language power grid question, and parse the power grid question to obtain the question entity, question intent, and entity attribute constraints;

[0035] The determination module is used to link entities in the power grid knowledge graph based on the problem entity, entity attribute constraints and preset entity type templates. When the weighted sum of the text similarity score and attribute satisfaction of a candidate entity is higher than the link threshold, the candidate entity is determined to be the anchor entity.

[0036] The removal module is used to perform path search in the power grid knowledge graph starting from the anchored entity using a pre-trained reinforcement learning policy network. At each step of the path expansion, actions with a probability lower than a preset pruning threshold given by the policy network are removed to obtain multiple candidate paths that satisfy the problem intent. The semantic consistency of each candidate path is verified using the ontology constraints of the anchored entity and predefined reasoning rules, and candidate paths that contradict the context of the anchored entity or violate domain knowledge are pruned.

[0037] The generation module is used to calculate the timestamp variance of all triplet facts in each candidate path, obtain the path time consistency score by performing a normalized reciprocal operation on the timestamp variance; weight and sum the path time consistency score with the confidence score of the path output by the policy network to obtain the comprehensive score of the candidate path; select the path with the highest comprehensive score as the optimal path; and generate and output a natural language answer based on the entities and relations in the optimal path.

[0038] Compared to existing technologies, this invention, in the entity linking stage, uses a weighted fusion of text similarity and entity attribute satisfaction to identify entities in the power grid domain that have abbreviations, alternative names, or ambiguities, thus improving the accuracy of question answering. Utilizing a reinforcement learning policy network for path search combined with pruning operations, it can explore reasoning paths that satisfy user intent within the vast power grid knowledge graph, improving the efficiency and targeting of path finding. This invention employs a path temporal consistency scoring mechanism, using the timestamp variance of facts within the path to represent the logical rationality of the reasoning chain in the time dimension. This score is combined with path confidence to select the optimal path with temporal logical coherence, avoiding the erroneous linking of facts from different time contexts and enhancing the logical rigor of the question answering system when handling complex time-related questions. Attached Figure Description

[0039] Figure 1 A flowchart of the first embodiment;

[0040] Figure 2 A schematic diagram of the components of a natural language power grid problem;

[0041] Figure 3 To generate a schematic diagram of candidate paths;

[0042] Figure 4 This is a diagram illustrating the probability of an action. Detailed Implementation

[0043] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with relevant laws, regulations, and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0044] In the first embodiment, the present invention proposes a smart question-answering method for power grids based on knowledge graph path reasoning, such as... Figure 1 ,include:

[0045] S1, Obtain the natural language power grid question input by the user, and parse the power grid question to obtain the question entity, question intent and entity attribute constraints;

[0046] The system acquires user questions via speech recognition or text input boxes, such as querying the most recent maintenance record of the main transformer at 110kV substation A. A pre-trained language model, such as BERT combined with Conditional Random Field (CRF), is used for named entity recognition to extract the question entity "110kV substation A". Simultaneously, a text classification model is used to identify the user's intent, determining that the user's intent is to query maintenance records. Then, through dependency parsing or rule matching, entity attribute constraints are extracted, such as the equipment type being "main transformer" and the time requirement being "most recent". Figure 2 .

[0047] S2, Based on the problem entity, entity attribute constraints and preset entity type template, entity linking is performed in the power grid knowledge graph. When the weighted sum of the text similarity score and attribute satisfaction of the candidate entity is higher than the linking threshold, the candidate entity is determined to be the anchor entity.

[0048] Based on the identified question entity, 110kV substation A, a fuzzy matching algorithm, such as edit distance, is used to recall candidate entities with similar names in the knowledge graph, such as substation A and 110kV Jia substation. The text similarity score between the question entity and each candidate entity name is calculated, for example, by calculating the cosine similarity of their word vectors. Simultaneously, the attributes of the candidate entities are verified to meet the constraints in the question, such as checking if the voltage level attribute of the candidate entity is 110kV. For each constraint met, an attribute satisfaction score is accumulated. The text similarity score and the attribute satisfaction score are weighted and summed. If the total score exceeds a preset link threshold, the candidate entity is determined as the anchor entity for the question-and-answer starting point.

[0049] S3, Starting from the anchored entity, a pre-trained reinforcement learning policy network is used to perform path search in the power grid knowledge graph. In each step of the path expansion, actions with a probability lower than a preset pruning threshold given by the policy network are removed to obtain multiple candidate paths that satisfy the problem intent. The semantic consistency of each candidate path is verified using the ontology constraints of the anchored entity and predefined reasoning rules, and candidate paths that contradict the context of the anchored entity or violate domain knowledge are pruned.

[0050] Using a power grid knowledge graph as the environment for reinforcement learning, the current entity and question vector in the path are considered as states, and choosing the next relation is considered as an action. The policy network is a deep neural network that takes the current state as input and outputs a probability distribution of choosing different relations as actions. Starting from the anchored entity, such as... Figure 3 At each step of path expansion, the policy network predicts the probability of all possible relationships for the next step. For example, starting from the substation entity, the probability of the relationship containing "equipment" is 0.9, and the probability of the relationship containing "geographical location" is 0.05. If the pruning threshold is set to 0.1, the path containing "geographical location" will be pruned and not explored further. The bundle search algorithm retains several partial paths with the highest scores at each step and continues to expand until the preset maximum path length is reached or an answer entity type matching the question's intent is found, thus generating multiple candidate inference paths.

[0051] Based on the ontology library of the knowledge graph, the type and attribute values ​​of each entity in the path are verified to conform to a preset pattern, with a focus on checking whether this information is consistent with the known context of the anchor entity at the starting point, such as voltage level and region. Predefined power grid domain inference rules, such as equipment connection rules and operating safety procedures, are invoked to check the complete logical chain expressed by the path, determining whether it violates physical laws or industry standards. Any path that fails to pass ontology constraints or rule verification will be identified as semantically inconsistent and pruned, ensuring that only logically valid paths can proceed to the next step. For example, a predefined inference rule is R1: IF A device's query intent is a status query THEN The endpoint of the inference path must be the status of that device, not the status of other related devices. Semantic consistency means that the meaning expressed by a inference path must logically conform to domain knowledge and ontology constraints, and its content must not contradict the context and intent of the question. Ontology constraints are syntactic rules that specify the logical restrictions that entity types, attributes, and relationships must follow, including type constraints and value constraints. For example, the operating status attribute of a circuit breaker entity can only be one of closed, open, or fault.

[0052] For example, the anchor entity is Chengxi Substation, whose ontology attributes include: Type = Substation, Voltage Level = 220kV. Candidate path A: Chengxi Substation - [Owned Equipment] - Main Transformer No. 1 - [Real-time Status] - Normal Operation. Chengxi Substation is a "substation", and Main Transformer No. 1 is a "main transformer". The relationship [Owned Equipment] connecting "substation" and "main transformer" is allowed; the voltage level of the anchor entity Chengxi Substation is 220kV, and the ontology attributes of Main Transformer No. 1 in the knowledge graph also indicate that it is a 220kV transformer, so the context is consistent; furthermore, path A is a device and its status, which does not violate any known physical or operational rules, so candidate path A is approved.

[0053] S4, For each candidate path, calculate the timestamp variance of all triplet facts in the path, and obtain the path time consistency score by performing a normalized reciprocal operation on the timestamp variance; weight the path time consistency score and the confidence score of the path output by the policy network to obtain the comprehensive score of the candidate path; select the path with the highest comprehensive score as the optimal path; generate and output a natural language answer based on the entities and relations in the optimal path.

[0054] For a candidate path, such as substation A connecting to the main transformer main transformer Connection maintenance record Extract the timestamp of each triplet fact along the path, such as the installation of the main transformer at substation A. The time period is 2010, main transformer Maintenance records The time period is 2023. The variance of the timestamps is calculated. The variance is normalized, and the path time consistency score is obtained by taking the reciprocal of this value; the smaller the variance, the higher the score. Simultaneously, the probability of each action on the path is multiplied together to obtain the path's confidence score. The path time consistency score and the path confidence score are then weighted and summed to obtain the path's overall score. Among all candidate paths, the one with the highest overall score is selected as the optimal path.

[0055] Extract the answer entity, such as maintenance record, from the terminal node of the optimal path. Detailed information. Based on the identified question intent, query maintenance records and call the preset answer generation template. For example, the [entity attribute constraint] of [question entity] is [answer entity]. Fill the template with entities from the optimal path, generate and output a complete natural language answer to the user, such as the most recent maintenance record of the main transformer of 110kV substation A being a Class C maintenance performed on May 10, 2023.

[0056] In an optional embodiment, the step of parsing the power grid problem to obtain the problem entity, problem intent, and entity attribute constraints includes:

[0057] A bidirectional long short-term memory network-conditional random field model is used to perform sequence labeling on the power grid problem, and named entities are identified and extracted as problem entities and entity attribute constraints;

[0058] A text convolutional neural network model is used to classify the power grid problem and determine the intent of the problem.

[0059] Specifically, the input is a power grid problem, such as querying the main transformer capacity of substation A with a voltage level of 110kV in 2023. A bidirectional Long Short-Term Memory Network-Conditional Random Field model receives this text sequence and assigns a label to each character or word using sequence labeling techniques. For example, substation A is labeled as the problem entity, while the voltage level and main transformer capacity are labeled as entity attributes, and 110kV and 2023 are used as attribute values. In this way, the model extracts the problem entity as substation A, the entity attribute constraints as voltage level equal to 110kV, and the requirement to query the main transformer capacity.

[0060] The same question text is input into a text convolutional neural network model. This model learns key features in the text through convolutional and pooling layers, thereby classifying the overall intent of the question. In the example above, the model analyzes keywords such as "query" and "capacity," classifying them as attribute query intent. Combining the results of the two models, the model understands the user's need: to query the value of an unknown attribute of substation A under specific attribute constraints.

[0061] In an optional embodiment, determining the candidate entity as an anchor entity when the weighted sum of the text similarity score and attribute satisfaction of the candidate entity is higher than the link threshold includes:

[0062] The Jaro-Winkler distance algorithm is used to calculate the text similarity score between the candidate entity and the question entity;

[0063] The proportion of attribute constraints satisfied by candidate entities to the total number of attribute constraints of all entities is used as the attribute satisfaction level.

[0064] The text similarity score and attribute satisfaction are weighted and summed with weights of 0.6 and 0.4 respectively. When the sum is greater than 0.85, the candidate entity is determined to be the anchor entity.

[0065] Suppose the question entity extracted from the problem is Station A, and there are two candidate entities in the knowledge graph: Substation A and Substation B. The Jaro-Winkler distance algorithm is used to calculate text similarity. The calculated score between Station A and Substation A might be 0.92, while the score between Station A and Substation B is only 0.5. The similarity between the candidate entities and the question entity in terms of name is then evaluated.

[0066] Suppose the problem also includes two attribute constraints: the voltage level is 110kV and the commissioning year is 2020. Examine the attributes of the two candidate entities in the knowledge graph. If the records of substation A show that the voltage level is indeed 110kV and the commissioning year is 2020, then both constraints are satisfied, and the attribute satisfaction degree is 1.0. If the voltage level of substation B is 220kV but the commissioning year is 2020, then only one constraint is satisfied, and the attribute satisfaction degree is 0.5.

[0067] The comprehensive score for each candidate entity is calculated based on preset weights of 0.6 and 0.4. Substation A scores 0.952. Substation B scores 0.5. Since the link threshold is set to 0.85, Substation A's score of 0.952 is higher than this threshold, therefore it is successfully identified as the anchoring entity, while Substation B is excluded.

[0068] In an optional embodiment, the path search performed by the pre-trained reinforcement learning policy network in the power grid knowledge graph includes:

[0069] The current entity vector is concatenated with the historical path vector and used as the input to the policy network;

[0070] The policy network employs a multilayer perceptron containing two fully connected layers. Each fully connected layer is followed by a modified linear unit activation function. The network's output layer is a softmax function, used to calculate the probability distribution of extensions to next-hop relations and entities.

[0071] Specifically, path search begins with a defined anchor entity, such as substation A. A pre-trained entity vector for substation A is obtained; this entity vector is a 100-dimensional numerical vector. Simultaneously, since this is the starting point of the search, the historical path is empty, and therefore the historical path vector is a 100-dimensional zero vector. The two vectors are concatenated to obtain a 200-dimensional input vector, which serves as the initial input to the policy network.

[0072] A 200-dimensional input vector is fed into a multilayer perceptron consisting of two fully connected layers. The vector undergoes a linear transformation through the first fully connected layer and then non-linear processing through a modified linear unit activation function. The processed result is then fed into a second fully connected layer and another modified linear unit activation function for further feature extraction. This process simulates the thought process of deciding the next action from the current state.

[0073] The final layer of the network is the Softmax function, which transforms the values ​​output from the second layer into a probability distribution. This probability distribution corresponds to all possible relationships and next-hop entity combinations originating from substation A. For example, the output might show that the probability of selecting the relationship as voltage level and the entity as 110kV is 0.7, the probability of selecting the relationship as city and the entity as a specific city is 0.2, and the combined probability of all other possible actions is 0.1. The search agent will then select the most promising path for expansion based on this probability distribution.

[0074] In an optional embodiment, removing actions with a probability lower than a preset pruning threshold given by the policy network at each step of path expansion includes:

[0075] At each step of the path search, obtain all possible actions output by the policy network and the probability corresponding to each possible action;

[0076] Actions with an expansion probability lower than a preset pruning threshold are removed from the candidate action set in the current step.

[0077] Specifically, suppose a reinforcement learning agent is searching in a knowledge graph and has already moved from entity A (substation) to entity main transformer number one. At this point, the agent needs to decide which edge to take next. It inputs the vector information of the current entity (main transformer number one) and the current path into the policy network. The policy network then outputs all possible actions starting from main transformer number one, i.e., relation-entity pairs, and the probability of choosing each action.

[0078] The output of the policy network might be a list containing hundreds of possible actions. For example, action one selects the rated capacity relation, the entity is 50 MVA, and the probability is 0.85; action two selects the equipment model relation, the entity is SFZ11, and the probability is 0.12; action three selects the manufacturer relation, the entity is Manufacturer C, and the probability is 0.009; action four selects the maintenance record relation, the entity is record XYZ, and the probability is 0.001, and so on. Figure 4 .

[0079] The probability of each action is compared to a preset pruning threshold of 0.01. Action 1 (0.85) and Action 2 (0.12) are both greater than 0.01, therefore they are retained in the candidate action set for the current step. Action 3 (0.009) and Action 4 (0.001) are both less than 0.01, therefore these two actions are considered low-value extensions and directly removed from the candidate set. The search algorithm avoids exploring paths that are highly unlikely to lead to the correct answer, thus improving search efficiency.

[0080] In an optional embodiment, obtaining the path time consistency score by normalizing the reciprocal of the timestamp variance includes:

[0081] Extract the timestamp corresponding to each triplet fact in the path to form a timestamp sequence;

[0082] Calculate the variance of the timestamp sequence. ;

[0083] Through formula Calculate the path time consistency score .

[0084] Specifically, suppose a candidate path consists of two triplet facts: the first triplet is Substation A, associated with the main transformer, Main Transformer No. 1, with a timestamp of 2020 in the knowledge graph; the second triplet is Main Transformer No. 1, rated capacity, 50 MVA, with a timestamp of 2021. These two timestamps are extracted to form a timestamp sequence, i.e., data points 2020 and 2021.

[0085] Calculate the variance of this timestamp sequence. Calculate the mean of the sequence, which is equal to 2020.5. Calculate the squared difference between each data point and the mean, which is 0.25 for each data point. Variance It is the average of the squared differences, which is 0.25. A smaller variance means that the facts on the path are closely related in time.

[0086] Substitute the calculated variance of 0.25 into the formula. Path time consistency score. The calculated result is 0.8. The score measures the consistency of facts in the path over time; the higher the score, the better the consistency.

[0087] In an optional embodiment, the step of weighted summing of the path temporal consistency score and the path confidence score output by the policy network to obtain the comprehensive score of the candidate path includes:

[0088] Path confidence It is the product of the probabilities of all actions on the path;

[0089] The overall score is calculated using the following formula. :

[0090]

[0091] in, Let k1 and k2 be the path time consistency score, and k1 and k2 be the weights.

[0092] Specifically, suppose a candidate path consists of two steps, where the probability of the action in the first step, given by the policy network, is 0.9, and the probability of the action in the second step is 0.8. Then, what is the confidence level of this path? The product of the two probabilities, 0.72, represents the degree of certainty with which the reinforcement learning agent selects the path according to the policy. Further, the temporal consistency score of this path is obtained. Assuming that the temporal consistency score has already been calculated for this path using the aforementioned method... The score is 0.8. This score represents the temporal correlation between multiple facts contained in the path. The path confidence score and the temporal consistency score are weighted and summed to calculate the overall score. Substituting the above value into the formula, the overall score is 0.76. The same three-step calculation is performed on all searched candidate paths, and the path with the highest overall score is selected as the optimal path.

[0093] In an optional embodiment, generating and outputting a natural language answer based on the entities and relationships in the optimal path includes:

[0094] Extract the starting point anchor entity of the path and the tail entity of the last triple from the optimal path as the answer entity;

[0095] The anchor entity and the answer entity are filled into a preset answer template to obtain a complete natural language answer and output it.

[0096] Specifically, among all candidate paths, an optimal path was determined based on the comprehensive score. For example, for the problem of querying the main transformer capacity of substation A, the optimal path is to start from the entity substation A, pass through the related main transformer, reach the entity main transformer No. 1, then pass through the related rated capacity, and reach the entity 50 MVA.

[0097] Key information is extracted from the optimal path. The starting entity, Substation A, is identified as the anchor entity, i.e., the core object of interest in the question. The ending entity, 50 MVA, which is the tail entity of the last triple, is identified as the answer entity, i.e., the result of the user's query. The extracted anchor and answer entities are filled into a pre-defined answer template. For example, using the template, the query result for [anchor entity] is [answer entity]. Substation A is replaced with [anchor entity], and 50 MVA is replaced with [answer entity]. A complete and fluent natural language answer is generated, i.e., the query result for Substation A is 50 MVA. The answer is presented to the user, completing the entire question-and-answer process.

[0098] In the second embodiment, the present invention also proposes a smart question-answering system for power grids based on knowledge graph path reasoning, comprising the following modules:

[0099] The parsing module is used to obtain the user's input of a natural language power grid question, and parse the power grid question to obtain the question entity, question intent, and entity attribute constraints;

[0100] The determination module is used to link entities in the power grid knowledge graph based on the problem entity, entity attribute constraints and preset entity type templates. When the weighted sum of the text similarity score and attribute satisfaction of a candidate entity is higher than the link threshold, the candidate entity is determined to be the anchor entity.

[0101] The removal module is used to perform path search in the power grid knowledge graph starting from the anchored entity using a pre-trained reinforcement learning policy network. At each step of the path expansion, actions with a probability lower than a preset pruning threshold given by the policy network are removed to obtain multiple candidate paths that satisfy the problem intent. The semantic consistency of each candidate path is verified using the ontology constraints of the anchored entity and predefined reasoning rules, and candidate paths that contradict the context of the anchored entity or violate domain knowledge are pruned.

[0102] The generation module is used to calculate the timestamp variance of all triplet facts in each candidate path, obtain the path time consistency score by performing a normalized reciprocal operation on the timestamp variance; weight and sum the path time consistency score with the confidence score of the path output by the policy network to obtain the comprehensive score of the candidate path; select the path with the highest comprehensive score as the optimal path; and generate and output a natural language answer based on the entities and relations in the optimal path.

[0103] In an optional embodiment, the step of parsing the power grid problem to obtain the problem entity, problem intent, and entity attribute constraints includes:

[0104] A bidirectional long short-term memory network-conditional random field model is used to perform sequence labeling on the power grid problem, and named entities are identified and extracted as problem entities and entity attribute constraints;

[0105] A text convolutional neural network model is used to classify the power grid problem and determine the intent of the problem.

[0106] In an optional embodiment, determining the candidate entity as an anchor entity when the weighted sum of the text similarity score and attribute satisfaction of the candidate entity is higher than the link threshold includes:

[0107] The Jaro-Winkler distance algorithm is used to calculate the text similarity score between the candidate entity and the question entity;

[0108] The proportion of attribute constraints satisfied by candidate entities to the total number of attribute constraints of all entities is used as the attribute satisfaction level.

[0109] The text similarity score and attribute satisfaction are weighted and summed with weights of 0.6 and 0.4 respectively. When the sum is greater than 0.85, the candidate entity is determined to be the anchor entity.

[0110] In an optional embodiment, the path search performed by the pre-trained reinforcement learning policy network in the power grid knowledge graph includes:

[0111] The current entity vector is concatenated with the historical path vector and used as the input to the policy network;

[0112] The policy network employs a multilayer perceptron containing two fully connected layers. Each fully connected layer is followed by a modified linear unit activation function. The network's output layer is a softmax function, used to calculate the probability distribution of extensions to next-hop relations and entities.

[0113] In an optional embodiment, removing actions with a probability lower than a preset pruning threshold given by the policy network at each step of path expansion includes:

[0114] At each step of the path search, obtain all possible actions output by the policy network and the probability corresponding to each possible action;

[0115] Actions with an expansion probability lower than a preset pruning threshold are removed from the candidate action set in the current step.

[0116] In an optional embodiment, obtaining the path time consistency score by normalizing the reciprocal of the timestamp variance includes:

[0117] Extract the timestamp corresponding to each triplet fact in the path to form a timestamp sequence;

[0118] Calculate the variance of the timestamp sequence. ;

[0119] Through formula Calculate the path time consistency score .

[0120] In an optional embodiment, the step of weighted summing of the path temporal consistency score and the path confidence score output by the policy network to obtain the comprehensive score of the candidate path includes:

[0121] Path confidence It is the product of the probabilities of all actions on the path;

[0122] The overall score is calculated using the following formula. :

[0123]

[0124] in, Let k1 and k2 be the path time consistency score, and k1 and k2 be the weights.

[0125] In an optional embodiment, generating and outputting a natural language answer based on the entities and relationships in the optimal path includes:

[0126] Extract the starting point anchor entity of the path and the tail entity of the last triple from the optimal path as the answer entity;

[0127] The anchor entity and the answer entity are filled into a preset answer template to obtain a complete natural language answer and output it.

[0128] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0129] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A smart question-answering method for power grids based on knowledge graph path reasoning, characterized in that, Includes the following steps: The system obtains a natural language power grid question input by the user, parses the power grid question, and obtains the question entity, question intent, and entity attribute constraints. Based on the problem entity, entity attribute constraints, and preset entity type templates, entity links are performed in the power grid knowledge graph. When the weighted sum of the text similarity score and attribute satisfaction of a candidate entity is higher than the link threshold, the candidate entity is determined to be the anchor entity. Starting with the anchored entity, a pre-trained reinforcement learning policy network is used to perform path search in the power grid knowledge graph. In each step of the path expansion, actions with a probability lower than a preset pruning threshold given by the policy network are removed to obtain multiple candidate paths that satisfy the intent of the problem. The semantic consistency of each candidate path is verified by using the ontology constraints of the anchored entity and predefined reasoning rules, and candidate paths that contradict the context of the anchored entity or violate domain knowledge are pruned. For each candidate path, the timestamp variance of all triplet facts in the path is calculated, and the path time consistency score is obtained by normalizing the inverse of the timestamp variance. The path time consistency score is weighted and summed with the confidence score of the path output by the policy network to obtain the comprehensive score of the candidate path; the path with the highest comprehensive score is selected as the optimal path; and a natural language answer is generated and output based on the entities and relationships in the optimal path. The step of determining the candidate entity as an anchor entity when the weighted sum of the text similarity score and attribute satisfaction of the candidate entity is higher than the link threshold includes: The Jaro-Winkler distance algorithm is used to calculate the text similarity score between the candidate entity and the question entity; The proportion of attribute constraints satisfied by candidate entities to the total number of attribute constraints of all entities is used as the attribute satisfaction level. The text similarity score and attribute satisfaction are weighted and summed with weights of 0.6 and 0.4 respectively. When the sum is greater than 0.85, the candidate entity is determined to be the anchor entity.

2. The method according to claim 1, characterized in that, The process of analyzing the power grid problem to obtain the problem entity, problem intent, and entity attribute constraints includes: A bidirectional long short-term memory network-conditional random field model is used to perform sequence labeling on the power grid problem, and named entities are identified and extracted as problem entities and entity attribute constraints; A text convolutional neural network model is used to classify the power grid problem and determine the intent of the problem.

3. The method according to claim 1, characterized in that, The method of using a pre-trained reinforcement learning policy network to perform path search in the power grid knowledge graph includes: The current entity vector is concatenated with the historical path vector and used as the input to the policy network; The policy network employs a multilayer perceptron containing two fully connected layers. Each fully connected layer is followed by a modified linear unit activation function. The network's output layer is a softmax function, used to calculate the probability distribution of extensions to next-hop relations and entities.

4. The method according to claim 1, characterized in that, In each step of the path expansion, removing actions whose probability given by the policy network is lower than a preset pruning threshold includes: At each step of the path search, obtain all possible actions output by the policy network and the probability corresponding to each possible action; Actions with an expansion probability lower than a preset pruning threshold are removed from the candidate action set in the current step.

5. The method according to claim 1, characterized in that, The step of obtaining the path time consistency score by normalizing and reciprocalizing the timestamp variance includes: Extract the timestamp corresponding to each triplet fact in the path to form a timestamp sequence; Calculate the variance of the timestamp sequence. ; Through formula Calculate the path time consistency score .

6. The method according to claim 1, characterized in that, The step of weighted summing of the path time consistency score and the path confidence score output by the policy network to obtain the comprehensive score of the candidate path includes: Path confidence It is the product of the probabilities of all actions on the path; The overall score is calculated using the following formula. : in, Let k1 and k2 be the path time consistency score, and k1 and k2 be the weights.

7. The method according to claim 1, characterized in that, The step of generating and outputting a natural language answer based on the entities and relationships in the optimal path includes: Extract the starting point anchor entity of the path and the tail entity of the last triple from the optimal path as the answer entity; The anchor entity and the answer entity are filled into a preset answer template to obtain a complete natural language answer and output it.

8. A smart question-answering system for power grids based on knowledge graph path reasoning, characterized in that, Includes the following modules: The parsing module is used to obtain the user's input of a natural language power grid question, and parse the power grid question to obtain the question entity, question intent, and entity attribute constraints; The determination module is used to link entities in the power grid knowledge graph based on the problem entity, entity attribute constraints and preset entity type templates. When the weighted sum of the text similarity score and attribute satisfaction of a candidate entity is higher than the link threshold, the candidate entity is determined to be the anchor entity. The removal module is used to perform path search in the power grid knowledge graph starting from the anchored entity using a pre-trained reinforcement learning policy network. At each step of the path expansion, actions with a probability lower than a preset pruning threshold given by the policy network are removed to obtain multiple candidate paths that satisfy the problem intent. The semantic consistency of each candidate path is verified using the ontology constraints of the anchored entity and predefined reasoning rules, and candidate paths that contradict the context of the anchored entity or violate domain knowledge are pruned. The generation module is used to calculate the timestamp variance of all triplet facts in each candidate path, and obtain the path time consistency score by performing a normalized reciprocal operation on the timestamp variance. The path time consistency score is weighted and summed with the confidence score of the path output by the policy network to obtain the comprehensive score of the candidate path; the path with the highest comprehensive score is selected as the optimal path; and a natural language answer is generated and output based on the entities and relationships in the optimal path. The step of determining the candidate entity as an anchor entity when the weighted sum of the text similarity score and attribute satisfaction of the candidate entity is higher than the link threshold includes: The Jaro-Winkler distance algorithm is used to calculate the text similarity score between the candidate entity and the question entity; The proportion of attribute constraints satisfied by candidate entities to the total number of attribute constraints of all entities is used as the attribute satisfaction level. The text similarity score and attribute satisfaction are weighted and summed with weights of 0.6 and 0.4 respectively. When the sum is greater than 0.85, the candidate entity is determined to be the anchor entity.

9. The system according to claim 8, characterized in that, The process of analyzing the power grid problem to obtain the problem entity, problem intent, and entity attribute constraints includes: A bidirectional long short-term memory network-conditional random field model is used to perform sequence labeling on the power grid problem, and named entities are identified and extracted as problem entities and entity attribute constraints; A text convolutional neural network model is used to classify the power grid problem and determine the intent of the problem.

Citation Information

Patent Citations

  • Method for improving questions and answers of context learning knowledge base based on thinking chain and visualization

    CN117076653A

  • Intelligent property right retrieval and matching system based on knowledge graph

    CN120911573A