CN-122019582-A - Information query method and electronic equipment
Abstract
The application discloses an information query method and electronic equipment, the method comprises the steps of analyzing sentences to be queried to obtain thinking chains responding to the sentences to be queried, querying in a knowledge graph according to the sentences to be queried to obtain query subgraphs corresponding to the sentences to be queried, screening paths formed by nodes in the query subgraphs according to the thinking chains to obtain candidate path sets, constructing candidate path diagrams according to the candidate path sets, querying in the candidate path diagrams according to the sentences to be queried to obtain target query information corresponding to the sentences to be queried, and generating query results corresponding to the sentences to be queried according to the target query information. The technical scheme of the application provides clear logic guidance for sub-graph query and path screening through the thinking chain, avoids the situation of global traversal, effectively reduces unnecessary calculation amount, improves query response speed while guaranteeing query precision, and is particularly suitable for complex query scenes of large-scale knowledge maps such as banks.
Inventors
- Luo Juanyun
- LI XUFENG
- QIAN JIN
Assignees
- 深圳前海微众银行股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251113
Claims (10)
- 1. An information query method, comprising: Analyzing the sentence to be queried to obtain a thinking chain responding to the sentence to be queried; inquiring in a knowledge graph according to the sentence to be inquired, and obtaining an inquiry subgraph corresponding to the sentence to be inquired; screening paths formed by nodes in the query subgraph according to the thinking chain to obtain a candidate path set; Constructing a candidate path diagram according to the candidate path set, and inquiring in the candidate path diagram according to the statement to be inquired to obtain target inquiry information corresponding to the statement to be inquired; and generating a query result corresponding to the statement to be queried according to the target query information.
- 2. The information query method according to claim 1, wherein the query sub-graph corresponding to the statement to be queried is obtained by querying the statement to be queried in a knowledge graph, and the method comprises the following steps: Obtaining a center node of the knowledge graph, wherein the center node is a node with the degree larger than a threshold value in the knowledge graph; Calculating target query hop count according to the type of the edge connected with the center node and the degree of the center node, wherein the target query hop count indicates the maximum distance when querying in the knowledge graph; Inquiring in a knowledge graph according to the statement to be inquired and the target inquiry hop count, and obtaining an inquiry subgraph corresponding to the statement to be inquired.
- 3. The information query method of claim 2, wherein calculating a target query hop count based on the type of edge to which the center node is connected and the degree of the center node, comprises: determining the number of edges corresponding to each edge type connected with the central node; taking the ratio of the number of the edges to the degree of the central node as the edge occurrence probability corresponding to the edge type; Calculating shannon entropy according to the edge occurrence probability corresponding to each edge type to obtain path information entropy; and compensating the path information entropy based on a preset hop count to obtain a target query hop count.
- 4. The information query method according to claim 2, wherein the query sub-graph corresponding to the statement to be queried is obtained by querying in a knowledge graph according to the statement to be queried and the target query hop count, and the method comprises the following steps: Extracting an anchor point entity set in the sentence to be queried, wherein the anchor point entity refers to an object which can be matched with a node in the knowledge graph; extracting keywords from the sentences to be queried, and mapping the extracted keywords to a relation subset corresponding to the knowledge graph, wherein the relation subset comprises relations among nodes corresponding to the keywords in the knowledge graph, and edges among the nodes in the knowledge graph represent the relations among the nodes; taking anchor point entities in the anchor point entity set as root nodes, inquiring in the knowledge graph along the relation direction indicated by the relation subsets, and taking target nodes, of which the distances between the knowledge graph and the root nodes are in the target inquiry hop range, as nodes in the inquiry subgraph; and taking the relationship belonging to the relationship subset in the relationship of the target node as the node relationship in the query subgraph.
- 5. The information query method of claim 2, wherein obtaining the central node of the knowledge-graph comprises: for one node of the knowledge graph, calculating the number of outgoing edges and the number of incoming edges of the node, and taking the sum of the number of outgoing edges and the number of incoming edges as the degree of the node; And sequencing all the nodes in the knowledge graph according to the sequence of the degrees from large to small, and selecting a preset number of nodes with the front sequencing as the center node of the knowledge graph.
- 6. The information query method of claim 1, wherein the screening paths formed by nodes in the query subgraph according to the thought chain to obtain a candidate path set comprises: And if the semantic similarity between the relation between the first node and the second node in the query sub-graph and the thought chain is greater than a first threshold value and the semantic similarity between the second node and the thought chain is greater than a second threshold value, splicing the second node to a candidate path where the first node is located, wherein the first node is a node on the candidate path obtained by the previous query in the query sub-graph.
- 7. The information query method of claim 1, wherein constructing a candidate path graph from the set of candidate paths comprises: taking the candidate paths in the candidate path set as path nodes in the candidate path diagram; if the first candidate path and the second candidate path have the public sub-path with the length larger than the preset length threshold, adding an undirected edge between the path node corresponding to the first candidate path and the path node corresponding to the second candidate path.
- 8. The information query method according to claim 1, wherein the candidate path graph includes path nodes and edges between the path nodes, the query is performed in the candidate path graph according to the statement to be queried to obtain target query information corresponding to the statement to be queried, and the method comprises the steps of: calculating the similarity between the sentence to be queried and each path node in the candidate path diagram; calculating the sorting score of the path nodes according to the number of neighbors corresponding to the path nodes and the similarity, wherein the neighbors of the path nodes comprise other path nodes with edges established with the path nodes; and generating target query information corresponding to the statement to be queried according to the path nodes with the sorting scores larger than a preset score threshold.
- 9. The information query method according to any one of claims 1 to 8, wherein generating a query result corresponding to the statement to be queried according to the target query information includes: Converting the target query information into a query text; And inputting the query text and the sentence to be queried into a large language model to obtain a query result corresponding to the sentence to be queried.
- 10. An electronic device, comprising: Processor, and A memory for storing executable instructions of the processor; Wherein the processor is configured to execute the executable instructions to implement the information query method of any one of claims 1 to 9.
Description
Information query method and electronic equipment Technical Field The application belongs to the technical field of computers, and particularly relates to an information query method and electronic equipment. Background In the digitized transformation wave of the financial industry, banking business systems face integration challenges of massive heterogeneous data and accurate response requirements of complex decision scenes. In a bank risk identification scenario, graph analysis algorithms are often used to model a transaction network to identify high risk entities. Among the existing algorithms, the conventional PageRank algorithm is widely used because it can calculate the global importance of nodes based on a linked structure. However, conventional PageRank requires processing the entire transaction graph (which may contain millions of nodes and edges), calculating the rank of all nodes. In banking scenarios, queries tend to be dynamic and targeted, and the global computation of PageRank ignores the context of the query, and must traverse the entire graph, even though most nodes are not related to the query. This results in high computational overhead and large memory consumption, and inefficient queries. Disclosure of Invention The application aims to provide an information query method and electronic equipment, which are used for reducing the calculation cost of knowledge graph query to a certain extent and improving the query efficiency. Other features and advantages of the application will be apparent from the following detailed description, or may be learned by the practice of the application. According to an aspect of an embodiment of the present application, there is provided an information query method, including: Analyzing the sentence to be queried to obtain a thinking chain responding to the sentence to be queried; inquiring in a knowledge graph according to the sentence to be inquired, and obtaining an inquiry subgraph corresponding to the sentence to be inquired; screening paths formed by nodes in the query subgraph according to the thinking chain to obtain a candidate path set; Constructing a candidate path diagram according to the candidate path set, and inquiring in the candidate path diagram according to the statement to be inquired to obtain target inquiry information corresponding to the statement to be inquired; and generating a query result corresponding to the statement to be queried according to the target query information. According to an aspect of an embodiment of the present application, there is provided an information query apparatus including: the analysis module is used for analyzing the statement to be queried to obtain a thinking chain responding to the statement to be queried; the first query module is used for querying in the knowledge graph according to the statement to be queried to obtain a query sub-graph corresponding to the statement to be queried; The screening module is used for screening paths formed by nodes in the query subgraph according to the thinking chain to obtain a candidate path set; The second query module is used for constructing a candidate path diagram according to the candidate path set, and querying in the candidate path diagram according to the statement to be queried to obtain target query information corresponding to the statement to be queried; and the result generation module is used for generating a query result corresponding to the statement to be queried according to the target query information. According to an aspect of the embodiments of the present application, there is provided a computer-readable medium having stored thereon a computer program which, when executed by a processor, implements the information query method as in the above technical solution. According to one aspect of the embodiment of the application, the electronic device comprises a processor and a memory, wherein the memory is used for storing executable instructions of the processor, and the processor executes the executable instructions to enable the electronic device to execute the information query method in the technical scheme. According to an aspect of embodiments of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the information query method as in the above technical solution. According to the technical scheme provided by the embodiment of the application, firstly, the sentence to be queried is analyzed to obtain the thinking chain for responding to the sentence to be queried, then the query sub-graph corresponding to the sentence to be queried is obtained according to the query in the knowledge graph, then the paths formed by the nodes i