Power dispatching knowledge question-answering method and device based on semantic search, terminal equipment and storage medium

By generating candidate entity semantic vectors and multi-dimensional sub-graphs, the problem of weak relevance of question-and-answer results in power dispatch knowledge question answering is solved, and power dispatch question-and-answer results with comprehensive information coverage and strong relevance are achieved.

CN121501959APending Publication Date: 2026-02-10POWER DISPATCHING CONTROL CENT OF GUANGDONG POWER GRID CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511753164.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-26
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

In existing technologies, the knowledge question-answering method of general large language model in the field of power dispatching fails to deeply explore the relationships between entities in the knowledge graph, resulting in weak targeting of question-answering results and incomplete information coverage.

Method used

By generating semantic vectors of candidate entities, anchor entities and their adjacent entities are filtered out, and a multi-dimensional sub-graph is generated. Combining entity importance scores and semantic similarity, the document filtering dimensions are enriched to ensure that the documents cover core related knowledge and implicit extended knowledge.

Benefits of technology

It achieves highly targeted and comprehensive information coverage in the power dispatching Q&A results, which can meet the needs of power dispatching scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121501959A_ABST
    Figure CN121501959A_ABST
Patent Text Reader

Abstract

The invention discloses an electric power dispatching knowledge question-answering method and device based on semantic search, terminal equipment and a storage medium, and belongs to the field of artificial intelligence. The method comprises the steps that anchor point entities and adjacent entities are identified; calculating a first semantic similarity between the adjacent entity and the anchor point entity, and screening out a target adjacent entity to generate a first sub-graph according to the first semantic similarity; to-be-expanded entities are screened out, entities associated with the to-be-expanded entities are recognized and serve as expanded entities corresponding to the to-be-expanded entities, and a second sub-graph is generated according to the expanded entities; calculating the importance score of each entity in the atlas, screening out the entity with the importance score in the front, and generating a third sub-atlas; combining the first sub-atlas, the second sub-atlas and the third sub-atlas to screen out a target document; and inputting the target document and the query statement into the large language model to obtain a power dispatching question and answer result. By implementing the method, the problem of weak pertinence of the power dispatching knowledge question-answer result output by the large language model in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence, and in particular to a method, apparatus, terminal device, and storage medium for answering questions about power dispatching knowledge based on semantic search. Background Technology

[0002] In recent years, general-purpose large language models have been applied on a large scale in many fields, greatly improving the efficiency of information acquisition. However, in the field of power dispatching, their application effect is not satisfactory.

[0003] Currently, the power dispatch knowledge question-answering method, which combines a general large language model, extracts explicit entities based on the user's input query, filters related documents from the knowledge graph through simple and direct matching relationships, and then inputs the query and the filtered documents into the large language model to generate power dispatch knowledge question-answering results. However, this method fails to deeply explore the relationships between entities in the knowledge graph, resulting in the filtered documents being limited to content directly related to explicit entities. This significantly limits the coverage of reference materials, ultimately making the question-answering results output by the large language model less targeted and less comprehensive in information coverage, which is difficult to meet the needs of power dispatching scenarios. Summary of the Invention

[0004] This invention provides a method, apparatus, terminal device, and storage medium for power dispatch knowledge question answering based on semantic search. The method can solve the problem that the power dispatch knowledge question answering results output by existing large language models have weak targeting.

[0005] To address the aforementioned technical problems, one embodiment of the present invention provides a power dispatching knowledge question-answering method based on semantic search, comprising: Generate candidate entity semantic vectors based on the user's input query related to power dispatch; Based on the semantic vectors of the candidate entities, anchor entities are selected from the preset power dispatch knowledge graph, and entities connected to the anchor entities are identified as adjacent entities. Calculate the first semantic similarity between the adjacent entity and the anchor entity, select the top N adjacent entities with the highest first semantic similarity as target adjacent entities, and generate the first sub-graph based on the target adjacent entities; The top M target neighboring entities with the highest semantic similarity are selected as entities to be expanded; entities in the power dispatch knowledge graph that are associated with each entity to be expanded are identified as the expansion entities corresponding to each entity to be expanded; a second sub-graph is generated based on each entity to be expanded and the expansion entities corresponding to each entity to be expanded; where N≥M; Calculate the importance score of each entity in the power dispatch knowledge graph, and select the entities with the highest importance scores from the power dispatch knowledge graph to generate a third subgraph; Based on the first sub-map, the second sub-map, and the third sub-map, target documents associated with the current query statement are selected from a preset set of documents related to power dispatching services. The target document and the query statement are input into a preset large language model to obtain the power dispatching question and answer results output by the large language model.

[0006] Further, generating candidate entity semantic vectors based on the user-input query includes: Based on the user's query, identify candidate entities; The candidate entities are vectorized to obtain the candidate entity semantic vectors.

[0007] Further, the step of selecting anchor entities from a preset power dispatch knowledge graph based on the candidate entity semantic vector includes: Calculate the third semantic similarity between the candidate entity semantic vector and the semantic vectors of each entity in the preset vector database; wherein, the vector database stores in advance a number of entity semantic vectors corresponding to each entity in the power dispatch knowledge graph; Based on the third semantic similarity, anchor entities are selected from the power dispatch knowledge graph.

[0008] Furthermore, the process of constructing a vector database includes: Obtain the document set related to the power dispatching business; Entity recognition processing is performed on each document in the document set to obtain several entities; Based on the entities, a power dispatch knowledge graph is generated; Each node in the power dispatch knowledge graph is vectorized to obtain several entity semantic vectors. Integrate all entity semantic vectors to generate a vector database.

[0009] Further, the step of generating a second sub-graph based on each entity to be expanded and the corresponding expanded entity includes: For each entity to be expanded, calculate the second semantic similarity between the entity semantic vector corresponding to the current entity to be expanded and the entity semantic vectors of each corresponding expanded entity; select the expanded entities with the highest second semantic similarity as the target expanded entities; Expand entities based on all objectives to generate a second sub-graph.

[0010] Further, the step of filtering target documents associated with the current query statement from a preset set of documents related to power dispatching services based on the first sub-map, the second sub-map, and the third sub-map includes: The candidate entity semantic vectors, the entity semantic vectors corresponding to each entity in the first sub-graph, the entity semantic vectors corresponding to each entity in the second sub-graph, and the entity semantic vectors corresponding to each entity in the third sub-graph are mapped into a preset attention space to obtain an attention representation; Based on the attention representation, the first sub-graph, the second sub-graph, and the third sub-graph are scored respectively to obtain the scoring results; Based on the scoring results, the sub-graph with the highest score is selected from the first sub-graph, the second sub-graph, and the third sub-graph as the sub-graph to be processed, and the remaining sub-graphs are used as backup sub-graphs. Calculate the fourth semantic similarity between the semantic vectors of the candidate entities and the entities in the subgraph to be processed; Based on the fourth semantic similarity, a first threshold is determined; Calculate the fifth semantic similarity between the semantic vector of the candidate entity and each entity in the backup subgraph; Entities with a fifth semantic similarity not lower than the first threshold are selected from the spare sub-graphs and used as entities to be processed. By fusing the entity to be processed and the sub-map to be processed, the target sub-map is obtained; Based on the candidate entities and the target sub-graph, a search is performed in the vector database to obtain the target document.

[0011] An embodiment of the present invention also provides a power dispatching knowledge question-answering device based on semantic search, comprising: The vector generation module is used to generate semantic vectors of candidate entities based on the power dispatch-related query statements input by the user. The adjacent entity identification module is used to filter out anchor entities from a preset power dispatch knowledge graph based on the semantic vector of the candidate entities, and identify entities connected to the anchor entities as adjacent entities. The first sub-graph generation module is used to calculate the first semantic similarity between the adjacent entity and the anchor entity, filter out the top N adjacent entities with the highest first semantic similarity as target adjacent entities, and generate the first sub-graph based on the target adjacent entities. The second subgraph generation module is used to filter out the top M target adjacent entities with the highest first semantic similarity as entities to be expanded; identify entities in the power dispatch knowledge graph that are associated with each entity to be expanded as expanded entities corresponding to each entity to be expanded; and generate the second subgraph based on each entity to be expanded and the expanded entities corresponding to each entity to be expanded; where N≥M. The third subgraph generation module is used to calculate the importance score of each entity in the power dispatch knowledge graph, and to select the entities with the highest importance scores from the power dispatch knowledge graph to generate the third subgraph. The target document filtering module is used to filter out target documents associated with the current query statement from a preset set of documents related to power dispatching services, based on the first sub-map, the second sub-map, and the third sub-map. The result generation module is used to input the target document and the query statement into a preset large language model to obtain the power dispatching question and answer results output by the large language model.

[0012] Further, the step of selecting anchor entities from a preset power dispatch knowledge graph based on the candidate entity semantic vector includes: Calculate the third semantic similarity between the candidate entity semantic vector and the semantic vectors of each entity in the preset vector database; wherein, the vector database stores in advance a number of entity semantic vectors corresponding to each entity in the power dispatch knowledge graph; Based on the third semantic similarity, anchor entities are selected from the power dispatch knowledge graph.

[0013] This application also provides a terminal device, including: One or more processors; A memory, coupled to the processor, for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the semantic search-based power dispatch knowledge question-answering method as described in the above embodiments of the invention.

[0014] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the power dispatch knowledge question-and-answer method based on semantic search as described in the above embodiments of the invention.

[0015] The following benefits can be obtained by implementing the present invention: This invention provides a method, apparatus, terminal device, and storage medium for power dispatch knowledge question answering based on semantic search. The method calculates the first semantic similarity between adjacent entities and anchor entities, selects the top N adjacent entities with the highest first semantic similarity as target adjacent entities, and generates a first sub-graph based on these target adjacent entities. This focuses on entities directly associated with the anchor entity, ensuring the first sub-graph covers the core association information of the anchor entity, providing basic semantic support for subsequent document selection. Then, the top M target adjacent entities with the highest first semantic similarity are selected as entities to be expanded. Entities in the power dispatch knowledge graph that are associated with each entity to be expanded are identified as the corresponding expanded entities. A second sub-graph is generated based on each entity to be expanded and its corresponding expanded entity; where N ≥ M. By expanding entities, implicit associations of anchor entities are mined, breaking the limitations of single direct associations and enriching the semantic coverage dimensions of subgraphs. The importance score of each entity in the power dispatch knowledge graph is calculated, and entities with the highest importance scores are selected to generate a third subgraph. This prioritizes the retention of core business entities in the power dispatch scenario, strengthening the weight of core knowledge. Finally, based on the first, second, and third subgraphs, target documents related to the current query are selected from a pre-defined set of documents related to power dispatch business. This achieves the fusion and filtering of multi-dimensional subgraph knowledge, ensuring that target documents cover both core directly associated knowledge and implicit extended association knowledge and core business knowledge. The resulting power dispatch question-and-answer results are highly targeted and comprehensive, meeting the needs of power dispatch scenarios. Attached Figure Description

[0016] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0017] Figure 1 This is a flowchart illustrating a semantic search-based power dispatching knowledge question-answering method provided in one embodiment of this application; Figure 2 This is a schematic diagram of the structure of a power dispatch knowledge question-and-answer device based on semantic search provided in a certain embodiment of this application; Figure 3 This is a schematic diagram of the structure of a terminal device provided in a certain embodiment of this application. Detailed Implementation

[0018] 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 with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.

[0020] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.

[0021] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0022] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0023] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).

[0024] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.

[0025] See Figure 1 To address the issue of weak targeting of power dispatch knowledge question-answering results output by existing large language models, an embodiment of the present invention provides a power dispatch knowledge question-answering method based on semantic search, comprising: S1. Generate candidate entity semantic vectors based on the user's input query related to power dispatch; As an illustration, after obtaining the query statement input by the user, it is necessary to first generate a semantic vector of candidate entities based on the query statement; In a preferred embodiment, generating candidate entity semantic vectors based on the user-input query includes: Based on the user's query, identify candidate entities; The candidate entities are vectorized to obtain the candidate entity semantic vectors; Specifically, firstly, based on the user-inputted query statements related to power dispatch... The system identifies candidate entities using a domain-adaptive entity recognition algorithm. Then, it vectorizes the identified candidate entities to obtain semantic vectors that represent their semantic features. The vectorization process is implemented based on a fine-tuned embedding model in the power dispatching domain. It should be noted that this embodiment optimizes the embedding model to improve its semantic understanding and entity correspondence capabilities. The corpus used to train the embedding model has the following format: ; in, This represents a sample answer corresponding to the query statement; This represents randomly selected irrelevant samples; the embedding model is fine-tuned using this corpus to adapt it to the power dispatching domain; the optimized loss function is as follows: ; in, Indicates the first Embedding vector of each query statement; Indicates the first A positive sample of a query statement; This represents all samples, including both positive and negative samples. Indicates the temperature scaling parameter; This is a function for calculating semantic similarity. This represents the loss function value of the optimized embedding model.

[0026] In a preferred embodiment, the process of constructing the vector database includes: Obtain the document set related to the power dispatching business; Entity recognition processing is performed on each document in the document set to obtain several entities; Based on the entities, a power dispatch knowledge graph is generated; Each node in the power dispatch knowledge graph is vectorized to obtain several entity semantic vectors. Integrate all entity semantic vectors to generate a vector database; Specifically, the process begins by acquiring structured monitoring data and unstructured procedures and records related to power dispatching operations. This includes power system monitoring data, power dispatching procedure texts, and power dispatching record texts. Power system monitoring data encompasses grid topology, equipment information, real-time power flow, equipment status, and setting parameters, recording the physical attributes of actual grid equipment. Power dispatching procedures include dispatcher operation manuals, dispatching manuals, and safety regulations, covering specific dispatching operational clauses. Power dispatching records are manually compiled unstructured documents such as historical dispatching operation tickets and dispatching orders, and this volume continues to grow over time. These multi-source data are then collected uniformly and converted into a standard format to generate a document collection. ; In this illustrative embodiment, a large language model (LLM) is used to perform entity recognition processing on each document in the document collection. The text in the document collection is input into the large language model by designing specific prompts. The prompt template is: given a text, identify all entity types in it and the relationships between these entities.

[0027] Specifically, based on the generated document collection Identify all entities; for each identified entity, extract the following information: entity_name: The name of the entity, keeping it in the same language as the input text; Then, from the identified entities, find all explicitly related entity pairs (source_entity, target_entity); for each entity pair, extract the following information: source_entity: The name of the source entity; target_entity: The name of the target entity; relationship_description: Explains why there is a relationship between the source entity and the target entity.

[0028] Based on these prompts, the large language model automatically identifies entities and their relationships from the text and outputs them in the form of structured triples. These triples integrate the physical topology information of the power system and related semantic knowledge, ultimately generating a power dispatch knowledge graph. ,in, Represents the physical nodes in a power system. It represents the edges between entities; the power dispatch knowledge graph provides important knowledge support for subsequent power dispatch decisions and analysis.

[0029] After generating the power dispatch knowledge graph, the entities in the power dispatch knowledge graph are vectorized using a fine-tuned embedding model to generate a vector database. This is to support entity matching in subsequent retrieval processes; Through the above steps, a complete power dispatch knowledge graph was obtained. and vector database .

[0030] S2. Based on the semantic vector of the candidate entity, filter out anchor entities from the preset power dispatch knowledge graph, and identify entities connected to the anchor entities as adjacent entities. In a preferred embodiment, the step of selecting anchor entities from a preset power dispatch knowledge graph based on the candidate entity semantic vector includes: Calculate the third semantic similarity between the candidate entity semantic vector and the semantic vectors of each entity in the preset vector database; wherein, the vector database stores in advance a number of entity semantic vectors corresponding to each entity in the power dispatch knowledge graph; Based on the third semantic similarity, anchor entities are selected from the power dispatch knowledge graph; Specifically, calculating the semantic vector of candidate entities semantic vectors of each entity in the vector database Third semantic similarity between them: ; The top H entity semantic vectors with the highest third semantic similarity are selected, and the corresponding entities are used as anchor entities. The candidate entity semantic vectors are then... Mapping to the most relevant entities in the power dispatch knowledge graph yields the anchor entities associated with the query statement. .

[0031] S3. Calculate the first semantic similarity between the adjacent entity and the anchor entity, select the top N adjacent entities with the highest first semantic similarity as target adjacent entities, and generate the first sub-graph based on the target adjacent entities. In illustrative terms, in order to make full use of the contextual information related to each entity in the power dispatch knowledge graph, this embodiment considers one-hop relationships and multi-hop relationships between entities in the power dispatch knowledge graph; wherein, the one-hop relationship refers to the relationship established between two entities in the power dispatch knowledge graph through a direct connection; that is, starting from one entity, it is possible to directly reach another entity through an edge (relationship); Specifically, for the identified anchor entities Determine the set of adjacent entities ; Calculate anchor point entities in this set. With each adjacent entity Based on the first semantic similarity between the entities, the top N neighboring entities with the highest first semantic similarity are selected as target neighboring entities, and a first sub-graph is generated based on the target neighboring entities. : ; in, This refers to selecting the top N entities from the first semantic similarity ranking results; finally, the entity representation is enriched by the contextual information provided by the N neighboring entities of the anchor entity.

[0032] S4. Select the top M target neighboring entities with the highest first semantic similarity as entities to be expanded; identify entities in the power dispatch knowledge graph that are associated with each entity to be expanded as the corresponding expanded entities; generate a second sub-graph based on each entity to be expanded and the corresponding expanded entities; where N≥M. In a preferred embodiment, generating the second sub-graph based on each entity to be expanded and the corresponding expanded entity includes: For each entity to be expanded, calculate the second semantic similarity between the entity semantic vector corresponding to the current entity to be expanded and the entity semantic vectors of each corresponding expanded entity; select the expanded entities with the highest second semantic similarity as the target expanded entities; Expand entities based on all objectives to generate a second sub-graph; In illustrative terms, the multi-hop relationship refers to the relationship established between two entities in the power dispatch knowledge graph through multiple intermediate entities; that is, starting from one entity, it may be necessary to go through multiple nodes or relationships to reach that entity. Specifically, the top M target neighboring entities with the highest semantic similarity ranking are selected as entities to be expanded. To identify multi-hop relationships; For each entity to be expanded, identify entities in the power dispatch knowledge graph that are associated with the current entity to be expanded, and integrate them into an expansion set as expanded entities. ; Calculate the second semantic similarity between the entity semantic vector corresponding to the current entity to be expanded and the entity semantic vector of each corresponding expanded entity, and select the expanded entity with the highest second semantic similarity as the target expanded entity; Based on the target extended entity, a second sub-graph is generated. : .

[0033] S5. Calculate the importance score of each entity in the power dispatch knowledge graph, and select the entities with the highest importance scores from the power dispatch knowledge graph to generate a third subgraph. Specifically, importance scores are used to measure the strength of relationships between entities; in this embodiment, the Personalized PageRank (PPR) algorithm is used to calculate the importance scores of each entity in the power dispatch knowledge graph. It should be noted that since the personalized PageRank algorithm is a mature graph structure node importance evaluation algorithm in the existing technology, the relevant calculation principles and implementation process have been fully disclosed in existing technical literature and industry standards, and the specific calculation process will not be repeated here. Then, the importance score was calculated. Sort in descending order and select by importance score. Located in front One entity, generating a third subgraph .

[0034] S6. Based on the first sub-map, the second sub-map, and the third sub-map, filter out the target document associated with the current query statement from the preset document set related to power dispatching business; In a preferred embodiment, the step of filtering target documents associated with the current query statement from a preset set of documents related to power dispatching services, based on the first sub-map, the second sub-map, and the third sub-map, includes: The candidate entity semantic vectors, the entity semantic vectors corresponding to each entity in the first sub-graph, the entity semantic vectors corresponding to each entity in the second sub-graph, and the entity semantic vectors corresponding to each entity in the third sub-graph are mapped into a preset attention space to obtain an attention representation; Based on the attention representation, the first sub-graph, the second sub-graph, and the third sub-graph are scored respectively to obtain the scoring results; Based on the scoring results, the sub-graph with the highest score is selected from the first sub-graph, the second sub-graph, and the third sub-graph as the sub-graph to be processed, and the remaining sub-graphs are used as backup sub-graphs. Calculate the fourth semantic similarity between the semantic vectors of the candidate entities and the entities in the subgraph to be processed; Based on the fourth semantic similarity, a first threshold is determined; Calculate the fifth semantic similarity between the semantic vector of the candidate entity and each entity in the backup subgraph; Entities with a fifth semantic similarity not lower than the first threshold are selected from the spare sub-graphs and used as entities to be processed. By fusing the entity to be processed and the sub-map to be processed, the target sub-map is obtained; Based on the candidate entities and the target sub-graph, a search is performed in the vector database to obtain the target document; Indicatively, this application introduces a reward model to score the first subgraph, the second subgraph, and the third subgraph. The training set for constructing the reward model includes several labeled subgraph samples from the power dispatching domain and corresponding scoring dimensions. The scoring dimensions include the richness of the knowledge graph, the relevance of the query statement, and the connectivity of the query statement. The reward model adopts a hybrid scoring model architecture based on gradient boosting trees (XGBoost). By performing domain-adaptive training and hyperparameter optimization on the reward model (based on the power dispatching knowledge graph sample set, minimizing the weighted loss function of the scoring dimensions, using grid search to optimize key hyperparameters such as learning rate and tree depth, and avoiding model overfitting through five-fold cross-validation), a reward model adapted to the power dispatching scenario is obtained. Specifically, in order to integrate the semantic information of the query statement into the input data and feed it into the reward model, this invention introduces an attention mechanism between the candidate entity semantic vectors and each sub-graph, thereby highlighting information regions that are highly relevant to the query semantics and ultimately enhancing the discriminative ability of the reward model; specifically, the query input is first obtained. Candidate entity semantic vectors and knowledge graph subgraphs The entity semantic vectors are then generated, and then the candidate entity semantic vectors, the entity semantic vectors corresponding to each entity in the first subgraph, the entity semantic vectors corresponding to each entity in the second subgraph, and the entity semantic vectors corresponding to each entity in the third subgraph are mapped to a preset attention space to generate a query for the attention mechanism. ,key Sum : in, , and is a trainable weight matrix; Then, the attention points are calculated and pieced together: Finally, the attention representation is obtained. in, For trainable weight matrix, This is a concatenation function; Then, the reward model is used to score the first subgraph, the second subgraph, and the third subgraph to obtain the scoring results. Based on the scoring results, the subgraph with the highest score is selected from the first subgraph, the second subgraph, and the third subgraph as the subgraph to be processed, and the remaining subgraphs are used as backup subgraphs. ; in, Reward model, To select the highest score from the output of the reward model and return the subgraph with the highest score.

[0035] Specifically, for the alternative subgraph, although the score is low, it may still contain important triples that are highly relevant to the query. To fully explore this potentially valuable information, firstly, the fourth semantic similarity between the semantic vectors of the candidate entities and each entity in the subgraph to be processed is calculated, and the fourth semantic similarity is used as the first threshold. : ; Then, the semantic vectors of the candidate entities and the entities in the alternative subgraphs are calculated. Fifth semantic similarity between The fifth semantic similarity is selected from the backup sub-graph. Not lower than the first threshold The entities are taken as entities to be processed, and the entities to be processed are integrated to construct a set of triples. By fusing the entity to be processed and the sub-graph to be processed, the target sub-graph is obtained. : ; Specifically, from the target sub-map Extract entity set Relationship set and triple set The process involves concatenating candidate entities with each entity, relation, and triplet to form multiple distinct search terms, thereby generating semantically richer enhanced queries. These enhanced queries are then used to retrieve documents from the vector database, and the retrieved candidate documents are ultimately aggregated into a candidate document set Doc. To further enhance the alignment between the retrieved paragraphs and the query task, a bge-rerank re-ranking model is employed. This model scores all candidate documents in the candidate document set Doc based on relevance, and then selects the top-ranked documents based on the ranking results. One document, as the target document : .

[0036] S7. Input the target document and the query statement into the preset large language model to obtain the power dispatching question and answer results output by the large language model; Specifically, the target document and the query statement are input into a preset large language model. Based on the input data, the large language model maps the correspondence between query requirements and professional knowledge, and the output power dispatching Q&A results are more in line with the actual operation scenario of dispatching business.

[0037] See Figure 2 This is an embodiment of the present invention providing a power dispatching knowledge question-answering device based on semantic search, comprising: The vector generation module is used to generate semantic vectors of candidate entities based on the power dispatch-related query statements input by the user. The adjacent entity identification module is used to filter out anchor entities from a preset power dispatch knowledge graph based on the semantic vector of the candidate entities, and identify entities connected to the anchor entities as adjacent entities. The first sub-graph generation module is used to calculate the first semantic similarity between the adjacent entity and the anchor entity, filter out the top N adjacent entities with the highest first semantic similarity as target adjacent entities, and generate the first sub-graph based on the target adjacent entities. The second subgraph generation module is used to filter out the top M target adjacent entities with the highest first semantic similarity as entities to be expanded; identify entities in the power dispatch knowledge graph that are associated with each entity to be expanded as expanded entities corresponding to each entity to be expanded; and generate the second subgraph based on each entity to be expanded and the expanded entities corresponding to each entity to be expanded; where N≥M. The third subgraph generation module is used to calculate the importance score of each entity in the power dispatch knowledge graph, and to select the entities with the highest importance scores from the power dispatch knowledge graph to generate the third subgraph. The target document filtering module is used to filter out target documents associated with the current query statement from a preset set of documents related to power dispatching services, based on the first sub-map, the second sub-map, and the third sub-map. The result generation module is used to input the target document and the query statement into a preset large language model to obtain the power dispatching question and answer results output by the large language model.

[0038] In a preferred embodiment, the step of selecting anchor entities from a preset power dispatch knowledge graph based on the candidate entity semantic vector includes: Calculate the third semantic similarity between the candidate entity semantic vector and the semantic vectors of each entity in the preset vector database; wherein, the vector database stores in advance a number of entity semantic vectors corresponding to each entity in the power dispatch knowledge graph; Based on the third semantic similarity, anchor entities are selected from the power dispatch knowledge graph.

[0039] See Figure 3 One embodiment of this application also provides a terminal device, including: One or more processors; A memory, coupled to the processor, for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the semantic search-based power dispatch knowledge question-answering method as described above.

[0040] The processor controls the overall operation of the terminal device to complete all or part of the steps of the semantic search-based power dispatch knowledge question-answering method described above. The memory stores various types of data to support the operation of the terminal device. This data may include, for example, instructions for any application or method used to operate on the terminal device, as well as application-related data. The memory can be implemented using any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0041] In an exemplary embodiment, the terminal device may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to execute the semantic search-based power dispatch knowledge question-answering method as described in any of the above embodiments, and achieve the same technical effect as the above method.

[0042] In another exemplary embodiment, a computer-readable storage medium including a computer program is also provided. When executed by a processor, the computer program implements the steps of the semantic search-based power dispatch knowledge question-answering method as described in any of the foregoing embodiments. For example, the computer-readable storage medium may be the aforementioned memory including the computer program, which may be executed by a processor of a terminal device to complete the semantic search-based power dispatch knowledge question-answering method as described in any of the foregoing embodiments and achieve the same technical effects as the aforementioned method.

[0043] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A power dispatching knowledge question-answering method based on semantic search, characterized in that, include: Generate candidate entity semantic vectors based on the user's input query related to power dispatch; Based on the semantic vectors of the candidate entities, anchor entities are selected from the preset power dispatch knowledge graph, and entities connected to the anchor entities are identified as adjacent entities. Calculate the first semantic similarity between the adjacent entity and the anchor entity, select the top N adjacent entities with the highest first semantic similarity as target adjacent entities, and generate the first sub-graph based on the target adjacent entities; The top M target neighboring entities with the highest semantic similarity are selected as entities to be expanded; entities in the power dispatch knowledge graph that are associated with each entity to be expanded are identified as the expansion entities corresponding to each entity to be expanded; a second sub-graph is generated based on each entity to be expanded and the expansion entities corresponding to each entity to be expanded; where N≥M; Calculate the importance score of each entity in the power dispatch knowledge graph, and select the entities with the highest importance scores from the power dispatch knowledge graph to generate a third subgraph; Based on the first sub-map, the second sub-map, and the third sub-map, target documents associated with the current query statement are selected from a preset set of documents related to power dispatching services. The target document and the query statement are input into a preset large language model to obtain the power dispatching question and answer results output by the large language model.

2. The power dispatching knowledge question-answering method based on semantic search as described in claim 1, characterized in that, The step of generating candidate entity semantic vectors based on the user-input query includes: Based on the user's query, identify candidate entities; The candidate entities are vectorized to obtain the candidate entity semantic vectors.

3. The power dispatching knowledge question-answering method based on semantic search as described in claim 2, characterized in that, The step of selecting anchor entities from a preset power dispatch knowledge graph based on the candidate entity semantic vectors includes: Calculate the third semantic similarity between the candidate entity semantic vector and the semantic vectors of each entity in the preset vector database; wherein, the vector database stores in advance a number of entity semantic vectors corresponding to each entity in the power dispatch knowledge graph; Based on the third semantic similarity, anchor entities are selected from the power dispatch knowledge graph.

4. The power dispatching knowledge question-answering method based on semantic search as described in claim 3, characterized in that, The process of building a vector database includes: Obtain the document set related to the power dispatching business; Entity recognition processing is performed on each document in the document set to obtain several entities; Based on the entities, a power dispatch knowledge graph is generated; Each node in the power dispatch knowledge graph is vectorized to obtain several entity semantic vectors. Integrate all entity semantic vectors to generate a vector database.

5. The power dispatching knowledge question-answering method based on semantic search as described in claim 4, characterized in that, The step of generating a second sub-graph based on each entity to be expanded and the corresponding expanded entity includes: For each entity to be expanded, calculate the second semantic similarity between the entity semantic vector corresponding to the current entity to be expanded and the entity semantic vectors of each corresponding expanded entity; select the expanded entities with the highest second semantic similarity as the target expanded entities; Expand entities based on all objectives to generate a second sub-graph.

6. The power dispatching knowledge question-answering method based on semantic search as described in claim 5, characterized in that, The step of filtering target documents associated with the current query statement from a preset set of documents related to power dispatching services, based on the first sub-map, the second sub-map, and the third sub-map, includes: The candidate entity semantic vectors, the entity semantic vectors corresponding to each entity in the first subgraph, the entity semantic vectors corresponding to each entity in the second subgraph, and the entity semantic vectors corresponding to each entity in the third subgraph are mapped into a preset attention space to obtain an attention representation; Based on the attention representation, the first sub-graph, the second sub-graph, and the third sub-graph are scored respectively to obtain the scoring results; Based on the scoring results, the sub-graph with the highest score is selected from the first sub-graph, the second sub-graph, and the third sub-graph as the sub-graph to be processed, and the remaining sub-graphs are used as backup sub-graphs. Calculate the fourth semantic similarity between the candidate entity semantic vector and each entity in the subgraph to be processed; Based on the fourth semantic similarity, a first threshold is determined; Calculate the fifth semantic similarity between the semantic vector of the candidate entity and each entity in the backup subgraph; Entities with a fifth semantic similarity not lower than the first threshold are selected from the spare sub-graphs and used as entities to be processed. By fusing the entity to be processed and the sub-map to be processed, the target sub-map is obtained; Based on the candidate entities and the target sub-graph, a search is performed in the vector database to obtain the target document.

7. A power dispatching knowledge question-answering device based on semantic search, characterized in that, include: The vector generation module is used to generate semantic vectors of candidate entities based on the power dispatch-related query statements input by the user. The adjacent entity identification module is used to filter out anchor entities from a preset power dispatch knowledge graph based on the semantic vector of the candidate entities, and identify entities connected to the anchor entities as adjacent entities. The first sub-graph generation module is used to calculate the first semantic similarity between the adjacent entity and the anchor entity, filter out the top N adjacent entities with the highest first semantic similarity as target adjacent entities, and generate the first sub-graph based on the target adjacent entities. The second subgraph generation module is used to filter out the top M target adjacent entities with the highest first semantic similarity as entities to be expanded; identify entities in the power dispatch knowledge graph that are associated with each entity to be expanded as expanded entities corresponding to each entity to be expanded; and generate the second subgraph based on each entity to be expanded and the expanded entities corresponding to each entity to be expanded; where N≥M. The third subgraph generation module is used to calculate the importance score of each entity in the power dispatch knowledge graph, and to select the entities with the highest importance scores from the power dispatch knowledge graph to generate the third subgraph. The target document filtering module is used to filter out target documents associated with the current query statement from a preset set of documents related to power dispatching services, based on the first sub-map, the second sub-map, and the third sub-map. The result generation module is used to input the target document and the query statement into a preset large language model to obtain the power dispatching question and answer results output by the large language model.

8. The power dispatching knowledge question-answering device based on semantic search as described in claim 7, characterized in that, The step of selecting anchor entities from a preset power dispatch knowledge graph based on the candidate entity semantic vectors includes: Calculate the third semantic similarity between the candidate entity semantic vector and the semantic vectors of each entity in the preset vector database; wherein, the vector database stores in advance a number of entity semantic vectors corresponding to each entity in the power dispatch knowledge graph; Based on the third semantic similarity, anchor entities are selected from the power dispatch knowledge graph.

9. A terminal device, characterized in that, include: One or more processors; A memory, coupled to the processor, for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the semantic search-based power dispatch knowledge question answering method as described in any one of claims 1-6.

10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the power dispatch knowledge question-answering method based on semantic search as described in any one of claims 1-6.