Digital human interaction method and system based on knowledge graph, medium and product program
By using a knowledge graph-based digital human interaction method, key entities and entity relationships are extracted, knowledge subgraphs are generated, and depth-first traversal is performed. This solves the limitations of traditional digital human interaction in understanding users' deep semantics and cross-domain knowledge interaction, and achieves efficient and logical response generation.
Patent Information
- Application Number
- CN202411902560.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2044-12-23
AI Technical Summary
Traditional digital human interaction methods struggle to accurately understand users' deep semantics and have limitations in cross-domain knowledge interaction, making it difficult to achieve a high degree of integration of multi-dimensional information.
The knowledge graph-based digital human interaction method extracts key entities and entity relationships, locates core nodes in a pre-defined knowledge graph, generates a knowledge subgraph, calculates the weights of close and distant relationships and performs pruning, constructs a multi-level knowledge structure, and generates a knowledge reasoning chain through depth-first traversal.
It achieves precise matching between questions and knowledge graphs, improves the accuracy and efficiency of digital human interaction, and generates highly logical and interpretable responses, reducing the limitations of cross-domain knowledge interaction.
Smart Images

Figure CN119884388B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of digital cultural creative design, and particularly relates to a digital human interaction method and system based on a knowledge graph, a medium, and a product program. BACKGROUND
[0002] With the development of artificial intelligence technology, digital humans are increasingly widely applied in various fields. Traditional digital human interaction methods mainly rely on pre-set question and answer libraries and simple pattern matching algorithms. In this way, the digital human's understanding of user input is relatively superficial, and it is difficult to accurately grasp the deep semantics of user intent, resulting in a rigid interaction process and difficulty in meeting user demand for natural and smooth conversations.
[0003] To improve the interaction ability of digital humans, related technologies use a natural language processing method based on deep learning to analyze text information input by users by establishing a semantic understanding model and generate appropriate responses in combination with context information. This method can understand user expression intent to some extent and improve the coherence and naturalness of conversations.
[0004] However, in actual applications, users often involve complex problems in multiple professional fields, which require the comprehensive use of professional knowledge in different fields to obtain reasonable answers. Related technologies mainly focus on semantic understanding and conversation generation within a single field, and use independent model structures to process different types of problems, which leads to limitations of digital humans in processing cross-domain knowledge interaction and difficulty in achieving high integration of multi-dimensional information. SUMMARY
[0005] The application provides a digital human interaction method and system based on a knowledge graph, a medium, and a product program, which are used to reduce the limitations in processing cross-domain knowledge interaction and achieve high integration of multi-dimensional information.
[0006] In a first aspect, the application provides a digital human interaction method based on a knowledge graph, which receives problem information input by a user and extracts key entities and entity relationships from the problem information;
[0007] determines a core node with the highest association degree with the key entities in a pre-set knowledge graph, and generates a knowledge subgraph with a maximum depth of a pre-set value based on the core node;
[0008] calculates the shortest paths between nodes in the knowledge subgraph, and determines the close and distant relationship weights between the nodes according to the lengths of the shortest paths;
[0009] prunes the knowledge subgraph based on the close and distant relationship weights, retains nodes and corresponding associated edges with close and distant relationship weights higher than a pre-set threshold, and obtains an optimized knowledge subgraph;
[0010] Clustering each node in the optimized knowledge subgraph according to the type of the corresponding connection edge to obtain a multi-level knowledge structure;
[0011] Performing depth-first traversal in the multi-level knowledge structure according to the entity relationship to generate a knowledge reasoning chain;
[0012] Generating reply information based on the knowledge reasoning chain and controlling the digital person to output the reply information.
[0013] By adopting the above technical solutions, the key entities and entity relationships are extracted from the question information, the core nodes are located in the preset knowledge graph, and the knowledge subgraph is generated, thereby realizing accurate matching of the question and the knowledge graph. The close and distant relationship weights are calculated based on the shortest path, and pruning is performed, thereby retaining the most relevant knowledge nodes and associated edges of the question and reducing the interference of irrelevant knowledge. The knowledge subgraph after pruning is clustered according to the connection edge type to obtain a multi-level structure, thereby making the hierarchical relationship of knowledge more clear. Depth-first traversal is performed based on this to generate a knowledge reasoning chain, thereby ensuring the coherence and logicality of the reasoning process. The system can quickly extract the knowledge related to the question from the massive knowledge graph, and generate accurate reply information through a structured reasoning process. Through multi-dimensional analysis and hierarchical processing of knowledge, the accuracy and efficiency of digital human interaction are improved, the logicality and explainability of the reply are ensured, the limitations in processing cross-domain knowledge interaction are reduced, and high integration of multi-dimensional information is realized.
[0014] In combination with some embodiments of the first aspect, in some embodiments, the core node with the highest association degree with the key entity in the preset knowledge graph is determined, and specifically includes:
[0015] Calculating the semantic similarity of each key entity and the nodes in the preset knowledge graph;
[0016] Based on the semantic similarity, the nodes in the preset knowledge graph are sorted in descending order, and candidate nodes with the top preset number of semantic similarity are selected;
[0017] Statistically summing the out-degree and in-degree of each candidate node, the out-degree representing the number of edges starting from the candidate node, and the in-degree representing the number of edges ending at the candidate node;
[0018] Based on the sum of the out-degree and the in-degree, the candidate nodes are sorted in descending order, and the candidate node at the top of the sorting is determined as the core node.
[0019] By adopting the technical solution, the semantic similarity and the connection degree of the nodes are comprehensively considered when the core node is determined. The semantic similarity between the key entity and the nodes of the knowledge graph is calculated and sorted in descending order, and the candidate nodes with high semantic correlation are preliminarily screened out. Further, the sum of the out-degree and the in-degree of the candidate nodes is calculated, and the node with the highest connection degree is selected as the core node. The relevance of the core node to the problem semantics is improved, and it is ensured that the node has rich associated information in the knowledge graph. The sum of the out-degree and the in-degree reflects the information carrying capacity of the node, and the selected core node can connect more related knowledge, providing more complete knowledge coverage for subsequent generation of the knowledge sub-graph, improving the accuracy of the selection of the core node, and making the generated knowledge sub-graph more in line with the problem requirements.
[0020] In combination with some embodiments of the first aspect, in some embodiments, the shortest paths between the nodes in the knowledge sub-graph are calculated, specifically including:
[0021] A node adjacency matrix is constructed, and each element in the node adjacency matrix represents whether there is a direct connection relationship between the corresponding nodes;
[0022] A distance matrix is constructed based on the node adjacency matrix, and in the initial value of the distance matrix, the distance between the directly connected nodes is a preset value, and the distance between the nodes not connected is infinite;
[0023] The distance matrix is iteratively updated to obtain the shortest paths between the nodes.
[0024] By adopting the technical solution, the shortest paths between the nodes are calculated in the manner of the adjacency matrix and the distance matrix, so that the path calculation process is more standardized and efficient. The direct connection relationship is recorded by the node adjacency matrix, and the initial distance matrix accurately reflects the direct distance relationship between the nodes. In the process of iteratively updating the distance matrix, all possible path combinations can be comprehensively considered. The redundant calculation of the traditional graph traversal algorithm is reduced, and the calculation efficiency is improved. The calculation result of the shortest path can accurately quantify the close or distant relationship between the nodes, providing reliable data support for subsequent pruning of the knowledge graph, and making the knowledge extraction more accurate.
[0025] In combination with some embodiments of the first aspect, in some embodiments, before performing the depth-first traversal in the multi-level knowledge structure according to the entity relationship to generate the knowledge reasoning chain, the method further includes:
[0026] A state transition matrix is constructed based on the multi-level knowledge structure, and the element value of the state transition matrix is determined according to the connection edge type between the nodes;
[0027] The state transition matrix is subjected to eigenvalue decomposition to obtain a feature vector corresponding to the maximum eigenvalue, and the components of the feature vector are taken as the importance scores of the nodes;
[0028] The nodes are ranked in importance based on the importance scores, and the nodes are divided into a plurality of importance levels according to a preset level threshold;
[0029] The connection relationship between the nodes in adjacent levels in the multi-level knowledge structure is retained according to the importance levels, and the multi-level knowledge structure after level optimization is obtained.
[0030] By using the above technical solutions, the importance of the nodes in the knowledge structure is analyzed by using the state transition matrix and the eigenvalue decomposition method, and the quantitative ranking and layering of the nodes are realized. The element values in the state transition matrix are determined based on the connection edge types, and the semantic information of the relationship between the nodes is retained. The components of the eigenvector obtained by the eigenvalue decomposition are used as the importance scores of the nodes, and the positions of the nodes in the overall knowledge structure are reflected. The layering of the nodes based on the importance scores and the retention of the connection relationship make the optimized knowledge structure not only maintain the original hierarchical relationship, but also highlight the role of important nodes.
[0031] In combination with some embodiments of the first aspect, in some embodiments, the state transition matrix is constructed based on the multi-level knowledge structure, specifically including:
[0032] The number distribution of each type of connection edge in the multi-level knowledge structure is counted;
[0033] The weight coefficients of each type of connection edge are calculated based on the number distribution, and the weight coefficients are inversely proportional to the number of the corresponding type of connection edge;
[0034] The state transition probability is calculated according to the type of the connection edge between each node and the corresponding weight coefficient;
[0035] The state transition probability is normalized to obtain the state transition matrix.
[0036] By using the above technical solutions, the number distribution of each type of connection edge in the multi-level knowledge structure is counted, and the weight coefficients of each type of connection edge are calculated, so that the weight of the connection edge is related to the scarcity of the connection edge in the knowledge structure. The state transition probability is calculated according to the type of the connection edge between each node and the corresponding weight coefficient, which can reflect the importance of different types of knowledge association. Through the quantitative analysis of the connection relationship in the knowledge structure, the accuracy of the knowledge association strength is realized, so that the state transition matrix can accurately describe the transition rule between the knowledge nodes, and provide more reasonable probability support for subsequent knowledge reasoning, and improve the accuracy of the knowledge association in the digital human interaction process.
[0037] In combination with some embodiments of the first aspect, in some embodiments, after obtaining the multi-level knowledge structure after level optimization, the method further includes:
[0038] construct a context knowledge base, the context knowledge base includes dialogue scene description, node access sequence and corresponding traversal effect score;
[0039] extract historical traversal paths with similar scene characteristics from the context knowledge base to obtain candidate traversal sequences;
[0040] perform dynamic programming analysis on the candidate traversal sequences to calculate the cumulative returns of each traversal path;
[0041] Sort the candidate traversal sequences in descending order based on the cumulative returns, and select the first traversal sequence in the descending order as the optimized traversal path.
[0042] By adopting the above technical solutions, a context knowledge base containing dialogue scene description, node access sequence and traversal effect score is constructed, and historical traversal paths with similar scene characteristics are extracted from the context knowledge base, which can draw on historical interaction experience to guide current knowledge traversal. Through dynamic programming analysis, the cumulative returns of each traversal path are calculated, considering the long-term impact of path selection on knowledge reasoning effect. Based on the cumulative returns, the candidate traversal sequences are sorted in descending order, and the optimal traversal path is selected, so that the knowledge reasoning process is more in line with the cognitive rules. Through the accumulation and optimization of historical experience, the dynamic adjustment of knowledge traversal strategy is realized, the knowledge organization ability of digital people in different dialogue scenes is improved, and the generated reply information is more coherent and in line with user cognitive habits.
[0043] In combination with some embodiments of the first aspect, in some embodiments, extracting historical traversal paths with similar scene characteristics from the context knowledge base specifically includes:
[0044] convert the current dialogue scene into a feature vector representation, the feature vector representation including entity type, relationship type and hierarchical distribution features;
[0045] calculate the similarity of the feature vector with each scene description in the context knowledge base;
[0046] filter out historical traversal paths corresponding to similar scenes with a similarity greater than a preset similarity threshold;
[0047] perform clustering analysis on the historical traversal paths to extract traversal patterns to form candidate traversal sequences.
[0048] By adopting the above technical solutions, the current dialogue scene is converted into a vector representation containing entity type, relationship type and hierarchical distribution features, and the similarity with each scene description in the context knowledge base is calculated, so that historical scenes with similar interaction characteristics can be accurately identified. Through in-depth analysis and pattern extraction of historical traversal paths, effective reuse of knowledge traversal experience is realized, the knowledge organization efficiency of digital people in similar scenes is improved, and the interaction process is more intelligent.
[0049] In a second aspect, the embodiments of the present application provide a digital human interaction system based on a knowledge graph, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is configured to store computer program codes, the computer program codes comprising computer instructions, and the one or more processors are configured to invoke the computer instructions to cause the system to perform the method described in the first aspect and any possible implementation manner of the first aspect.
[0050] In a third aspect, the embodiments of the present application provide a computer-readable storage medium, comprising instructions, when the instructions are run on a system, the system performs the method described in the first aspect and any possible implementation manner of the first aspect.
[0051] In a fourth aspect, the embodiments of the present application provide a computer program product, characterized in that when the computer program product is run on a system, the system performs the method described in any possible implementation manner of the first aspect.
[0052] The one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0053] 1. The present application provides a digital human interaction method based on a knowledge graph, which extracts key entities and entity relationships from problem information, locates core nodes in a preset knowledge graph and generates a knowledge subgraph, thereby realizing accurate matching of the problem and the knowledge graph. Based on the shortest path, the closeness relationship weight is calculated and pruned, the most relevant knowledge nodes and associated edges are retained, and the interference of irrelevant knowledge is reduced. The knowledge subgraph after pruning is clustered according to the connection edge type to obtain a multi-level structure, so that the hierarchical relationship of knowledge is more clear. On this basis, a knowledge reasoning chain is generated by depth-first traversal, thereby ensuring the coherence and logicality of the reasoning process. The system can quickly extract knowledge related to the problem from a large amount of knowledge graph, and generate accurate reply information through a structured reasoning process. Through multi-dimensional analysis and hierarchical processing of knowledge, the accuracy and efficiency of digital human interaction are improved, while the logicality and explainability of the reply are ensured, the limitations in processing cross-domain knowledge interaction are reduced, and high integration of multi-dimensional information is realized.
[0054] 2. The application provides a digital human interaction method based on a knowledge graph, which uses a state transition matrix and eigenvalue decomposition method to analyze the importance of nodes in the knowledge structure, realizes the quantitative sorting and layering of the nodes. The element value in the state transition matrix is determined based on the connection edge type, which retains the semantic information of the relationship between nodes. The eigenvector component obtained by eigenvalue decomposition is used as the node importance score, which reflects the position of the node in the overall knowledge structure. Based on the importance score of the node layering and the connection relationship retention, the optimized knowledge structure not only maintains the original hierarchical relationship, but also highlights the role of important nodes.
[0055] 3. The application provides a digital human interaction method based on a knowledge graph, which constructs a context knowledge base containing dialogue scene description, node access sequence and traversal effect score, extracts historical traversal paths with similar scene characteristics from it, and can learn from historical interaction experience to guide current knowledge traversal. The cumulative benefits of each traversal path are calculated through dynamic programming analysis, which comprehensively considers the long-term impact of path selection on knowledge reasoning effect. Based on the cumulative benefits, the candidate traversal sequences are sorted in descending order, and the optimal traversal path is selected, so that the knowledge reasoning process is more in line with the cognitive rules. Through the accumulation and optimization of historical experience, the dynamic adjustment of the knowledge traversal strategy is realized, the knowledge organization ability of the digital human in different dialogue scenes is improved, and the generated reply information is more coherent and in line with the user's cognitive habits. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 is a flowchart of a digital human interaction method based on a knowledge graph in an embodiment of the application.
[0057] Figure 2 is another flowchart of a digital human interaction method based on a knowledge graph in an embodiment of the application.
[0058] Figure 3 is an entity device structure diagram of a digital human interaction system based on a knowledge graph provided in an embodiment of the application. DETAILED DESCRIPTION
[0059] The terms used in the following embodiments of the application are only for the purpose of describing the specific embodiments of the application, and are not intended to be limiting to the application. As used in the specification and the appended claims of the application, the singular forms "a," "an," and "the" are intended to include both singular and plural forms, unless the context clearly indicates otherwise. It will be further understood that the terms "and / or" used in the application means any or all possible combinations of one or more of the listed items.
[0060] Hereinafter, the terms "first", "second", "third", etc. are used only for descriptive purposes and cannot be construed as implying or suggesting relative importance or an implied indication of the number of indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, the meaning of "a plurality of" is two or more, unless otherwise specified.
[0061] The following will be described by using an embodiment and combining with Figure 1 An embodiment of a knowledge graph-based digital human interaction method is described.
[0062] Please refer to Figure 1 A flowchart of a knowledge graph-based digital human interaction method in an embodiment of the present application is shown.
[0063] S101, receiving user input question information, and extracting key entities and entity relationships from the question information;
[0064] Firstly, the system performs semantic analysis and structured representation on the user input question information through natural language understanding technology, and identifies the key information elements contained in the question, such as core nouns, verbs, adjectives, etc. Then, the system uses named entity recognition technology to further extract entities with specific semantic types from these key information elements, such as names, place names, organization names, proper nouns, etc. Finally, the system reveals the association between different entities on the syntactic and semantic levels through dependency analysis technology, and constructs an entity relationship graph.
[0065] In specific implementation, the system can use various natural language processing technologies to realize the analysis of question information and the extraction of entity relationships. For example, the system can use a rule-based method to quickly identify key entities and relationship types according to pre-defined grammar templates and dictionary resources, and perform pattern matching and part-of-speech tagging on question information. At the same time, the system can also introduce statistical learning-based methods such as conditional random fields, support vector machines, etc., to automatically learn discriminant models for entity recognition and relationship classification through training on large-scale annotated corpora, thereby improving the accuracy and generalization ability of information extraction. In addition, the system can also use deep learning technology to construct an end-to-end question understanding model, which directly maps question information to entity relationship representation space, reducing the dependence on manual feature engineering.
[0066] S102, determining the core node with the highest association degree with the key entity in the preset knowledge graph, and generating a knowledge subgraph with a maximum depth of a preset value based on the core node;
[0067] The system determines the core node with the highest association degree with the key entity in the preset knowledge graph, and generates a knowledge subgraph with a preset maximum depth based on the core node. The core node with the highest association degree with the key entity is determined as follows: the semantic similarity between each key entity and the nodes in the preset knowledge graph is calculated;
[0068] The nodes in the preset knowledge graph are sorted in descending order based on the semantic similarity, and candidate nodes with the top preset number of semantic similarity are selected;
[0069] The sum of the out-degree and in-degree of each candidate node is counted, where the out-degree represents the number of edges starting from the candidate node, and the in-degree represents the number of edges ending at the candidate node;
[0070] The candidate nodes are sorted in descending order based on the sum of the out-degree and in-degree, and the candidate node at the top of the sorted list is determined as the core node.
[0071] To explore the position and associated context of key entities in the entire knowledge system, the system needs to quickly locate the most relevant knowledge nodes in a large amount of knowledge graph data. The association degree evaluation here not only considers the semantic similarity between nodes and key entities, but also considers the importance and centrality of the nodes themselves. Specifically, the system first calculates the semantic similarity between each key entity and the nodes in the knowledge graph, uses semantic embedding models such as Word2Vec to map entity words and node labels to continuous vector space, and measures their semantic proximity through vector cosine distance, Jaccard coefficient and other indicators. Then, the nodes in the knowledge graph are sorted by semantic similarity, and a set of candidate nodes is selected. Next, the system counts the sum of the out-degree and in-degree of each candidate node, i.e. the number of edges starting and ending at the node, as an importance indicator of the node, and sorts the candidate nodes again. The higher the out-degree and in-degree, the more central the node is in the topology of the knowledge graph, and the more closely connected it is to other nodes. After two rounds of sorting, the system selects the node with the highest comprehensive score as the core node.
[0072] In practical applications, the system can flexibly select algorithms for semantic similarity calculation and node importance evaluation. Besides traditional word vector methods, the system can also employ representation learning methods based on graph neural networks, such as GraphAttention Network, to simultaneously consider node content attributes and topological structure information, learning more accurate semantic embedding representations of nodes. Simultaneously, the system can introduce more factors influencing node importance, such as node clustering coefficients and PageRank values, characterizing the central position of nodes in the knowledge graph from multiple dimensions. Furthermore, for large-scale knowledge graphs, the system can use approximate calculations and data compression techniques to significantly improve the efficiency of node association analysis while sacrificing a small amount of accuracy. One possible solution is for the system to perform hierarchical partitioning and local indexing of the knowledge graph, first ranking nodes within each subgraph, and then comparing the association scores of core nodes across subgraphs, thereby significantly reducing the search space for candidate nodes at each processing stage.
[0073] S103. Calculate the shortest path between nodes in the knowledge subgraph and determine the affinity weight between nodes based on the length of the shortest path.
[0074] The system calculates the shortest path between nodes in the knowledge subgraph and determines the affinity weight between nodes based on the length of the shortest path. Specifically, calculating the shortest path between nodes in the knowledge subgraph includes:
[0075] Construct a node adjacency matrix, where each element represents whether there is a direct connection between the corresponding nodes;
[0076] A distance matrix is constructed based on the node adjacency matrix. In the initial value of the distance matrix, the distance between directly connected nodes is a preset value, and the distance between unconnected nodes is infinite.
[0077] The distance matrix is iteratively updated to obtain the shortest path between each node.
[0078] The shortest path reflects the closest connection between nodes within a knowledge subgraph. The shorter the path, the more direct the semantic association between nodes, and the higher its importance in inference chain construction. To efficiently calculate the shortest path between each pair of nodes, the system employs a classic graph theory algorithm. First, the knowledge subgraph is transformed into a node adjacency matrix, where each element indicates whether a corresponding node has a direct edge. Then, an initial distance matrix is constructed based on the adjacency matrix, initializing the distance between directly connected nodes to 1 and the distance between unconnected nodes to infinity. Next, the system uses the distance matrix as input and performs dynamic programming using the Floyd-Warshall algorithm to solve the problem, continuously updating the distance values between each pair of nodes in the distance matrix until it converges to the shortest path length between all nodes.
[0079] In practical applications, the system can select different shortest path algorithms according to the size and sparsity of the knowledge subgraph. For dense graphs, the time complexity of the Floyd-Warshall algorithm is cubic, while for sparse graphs, heuristic methods such as Dijkstra's algorithm or A* search can converge faster. At the same time, in order to handle large-scale knowledge subgraphs, the system can also introduce distributed computing frameworks such as Spark GraphX, etc., to decompose the shortest path calculation task to multiple parallel processing units, significantly improving the scalability of the algorithm. A possible optimization scheme is that the system performs community discovery and modularization division on the knowledge subgraph, first performs shortest path calculation independently within the community, and then propagates distance updates between communities, reducing unnecessary node pair comparisons and improving calculation efficiency. In addition, considering the dynamic evolution characteristics of real-world knowledge graphs, the system can also use incremental shortest path algorithms, which only update the newly added or deleted edges locally based on the original distance matrix, avoiding re-computation from scratch and improving the time sensitivity of the algorithm.
[0080] S104, pruning the knowledge subgraph based on the close and distant relationship weight, retaining nodes and corresponding associated edges with close and distant relationship weight higher than a preset threshold, to obtain an optimized knowledge subgraph;
[0081] The system prunes the knowledge subgraph based on the close and distant relationship weight, retains nodes and corresponding associated edges with close and distant relationship weight higher than a preset threshold, to obtain an optimized knowledge subgraph. The knowledge subgraph contains a large amount of redundant and noisy information, which will interfere with the generation of subsequent reasoning chains and the extraction of answers. In order to optimize the quality and efficiency of the knowledge subgraph, the system needs to appropriately prune and simplify it. Here, the node close and distant relationship weight calculated by the shortest path length is used as a measure of the importance of the node. The larger the close and distant relationship weight, the closer the association between the node and the core node, and the more critical the role in the reasoning chain. Therefore, the system sets a weight threshold to filter all nodes in the knowledge subgraph, only retaining nodes with weight greater than the threshold and their associated edges, eliminating a large number of low-relevance redundant nodes, and obtaining a smaller and denser optimized knowledge subgraph.
[0082] S105, clustering each node in the optimized knowledge subgraph according to the type of the corresponding connection edge to obtain a multi-level knowledge structure;
[0083] The knowledge subgraph usually contains multiple different types of semantic relations, such as attribute, location, causality, and parallelism, which require fine-grained relation modeling and organization. The system uses a node clustering method based on connection edge types to classify nodes with similar semantics into the same category and construct a hierarchical knowledge structure graph. Specifically, the system traverses each edge in the optimized knowledge subgraph and extracts its semantic type label, such as "attribute_of", "located", "caused", etc. Then, for each node, the system counts the type distribution of its connected edges to obtain a relation type feature vector. Next, the system uses clustering algorithms such as K-Means to automatically cluster nodes based on the relation type feature vector. During the clustering process, nodes with similar distances in the feature space are divided into the same class, forming a semantically close knowledge cluster. Different knowledge clusters form a hierarchical nested relationship according to the diversity of their connected edges.
[0084] In practical applications, the class label of a knowledge cluster is usually difficult to accurately obtain, and the system needs to automatically infer it based on the semantic similarity of the edges. One possible method is to train a relation classifier based on a large-scale corpus, taking the text description of the connected edge as input to predict its semantic type. A neural network classifier with attention mechanism can model both local semantic information and global structure information of the edge, improving the accuracy of classification. At the same time, to improve the explainability of the knowledge cluster, the system can perform statistical analysis on the text labels of the nodes within the cluster and extract high-frequency co-occurring words as representative labels of the cluster. For large-scale knowledge subgraphs, the computational overhead of hierarchical clustering is high, and the system can use an approximate algorithm based on random walk to estimate the neighborhood similarity of nodes by sampling subgraph structures, reducing the time complexity of clustering. A possible improvement is to introduce a multi-view learning mechanism, which not only integrates the relation type features but also incorporates the content semantic features of the nodes, achieving more comprehensive semantic modeling and improving the cohesion and difference of the knowledge clusters.
[0085] S106, performing depth-first traversal in the multi-level knowledge structure according to the entity relations to generate a knowledge reasoning chain;
[0086] Based on the optimized and clustered knowledge sub-graphs, the system needs to construct a reasoning evidence chain related to the question according to the entity and relationship clues in the original question. Here, a depth-first search strategy is adopted, taking the core entity in the original question as the starting point, and exploring the nodes associated most closely with the core entity in the depth direction first, until all key entities in the question appear in the reasoning chain. At the same time, in the traversal process, the system also needs to record the knowledge cluster type of the passing node to obtain the hierarchical structure information of the reasoning chain. Specifically, the system first adds the core entity node to a stack of nodes to be visited and marks it as visited, and then enters the loop: pops the top node of the stack and adds it to the current reasoning chain. Check all outgoing edges of the popped node, for each outgoing edge, if the target node it connects contains a key entity in the question and has not been visited, push the target node into the stack and mark it as visited, and recursively execute the next round of loop; if the current node does not contain new key entities, add it and the relationship label on the corresponding edge to the current reasoning chain, and continue to pop the next top node of the stack. Until the stack is empty, that is, all nodes to be visited have been traversed, the loop ends, and the final reasoning chain is output.
[0087] S107, generate reply information based on the knowledge reasoning chain, and control the digital person to output the reply information.
[0088] This step is aimed at the end user, and converts the knowledge reasoning chain built in the previous step into an answer text expressed in natural language. Specifically, the system first performs semantic parsing on the nodes and edge relationships in the reasoning chain, extracting key information elements such as attribute values, numerical values, entity names, etc. Then, combined with the question type and the hierarchical structure of the reasoning chain, it selects appropriate answer templates, such as definition judgment, method steps, causal analysis, etc. Next, the system fills the extracted information elements into the slots of the answer template, and according to the semantic type of the edge relationship, generates transitional sentences connecting the template slots, forming complete answer sentences. Finally, the system controls the digital person to output the answer sentences to the user in a natural dialogue manner. At the same time of output, the system can also generate a visual version of the answer sentences, providing the user with a graphical reasoning chain evidence, enhancing the explainability and credibility of the answer.
[0089] In practical applications, due to the flexibility of natural language expression, there are often grammatical errors, logical conflicts, information redundancy and other problems in the answer generation process, which affect the quality of the answer. Therefore, the system can introduce answer optimization technology based on language model, automatically learn the grammar and semantic features of the question and answer text through the deep neural network pre-trained on a large-scale corpus, and polish and rewrite the generated answer. One approach is to use attention mechanism models such as Transformer, taking the knowledge reasoning chain as input and the answer text as output, and training the conditional language generation model end-to-end. At the same time, the system can also integrate the structural information of the reasoning chain and design an encoder-decoder architecture based on graph neural networks to explicitly model the semantic dependency relationship between nodes and edges. Considering the differences in reading comprehension level and information needs of different users, the system can also support personalized answer generation, dynamically adjusting the degree of detail, language style and information granularity of the answer according to the user's knowledge background, focus and other attributes. One possible optimization direction is to introduce an active learning mechanism to score and correct the answer through user feedback, continuously optimizing the effect of the answer generation model.
[0090] In the above embodiments, key entities and entity relationships are extracted from the question information, core nodes are located in the preset knowledge graph, and a knowledge subgraph is generated, realizing accurate matching of the question and the knowledge graph. Based on the shortest path, the close and distant relationship weights are calculated and pruned, retaining the most relevant knowledge nodes and associated edges to the question and reducing irrelevant knowledge interference. The pruned knowledge subgraph is clustered by connection edge type to obtain a multi-level structure, making the hierarchical relationship of knowledge clearer. On this basis, a knowledge reasoning chain is generated by depth-first traversal, ensuring the coherence and logic of the reasoning process. This enables the system to quickly extract relevant knowledge from massive knowledge graphs and generate accurate reply information through a structured reasoning process. Through multi-dimensional analysis and hierarchical processing of knowledge, the accuracy and efficiency of digital human interaction are improved, while ensuring the logic and explainability of the reply, reducing the limitations in processing cross-domain knowledge interaction, and achieving high integration of multi-dimensional information.
[0091] To further improve the accuracy and efficiency of knowledge reasoning in digital human interaction, the embodiments of the present application introduce a state transition matrix and a context knowledge base to deeply optimize the multi-level knowledge structure and dynamically adjust the knowledge traversal strategy based on historical experience. The following describes the embodiments of the present application in combination with Figure 2 Another knowledge graph-based digital human interaction method in the embodiments of the present application is described as follows:
[0092] Please refer to Figure 2 for another flowchart of the knowledge graph-based digital human interaction method in the embodiments of the present application.
[0093] S201. Construct a state transition matrix based on the multi-level knowledge structure;
[0094] The system constructs a state transition matrix based on the multi-level knowledge structure, and the element values of the state transition matrix are determined according to the connection edge types between nodes. Specifically: count the number distribution of each type of connection edge in the multi-level knowledge structure;
[0095] Calculate the weight coefficient of each type of connection edge based on the number distribution, and the weight coefficient is inversely proportional to the number of the corresponding type of connection edge;
[0096] Calculate the state transition probability according to the type of connection edge between nodes and its corresponding weight coefficient;
[0097] Normalize the state transition probability to obtain the state transition matrix.
[0098] In this step, the system constructs a state transition matrix based on the existing multi-level knowledge structure. The multi-level knowledge structure is a way to organize and represent knowledge, which represents concept entities and their associated relationships through nodes and connection edges, and reflects the abstract level of knowledge through hierarchical structure. The state transition matrix is used to describe the probability of transitioning from one node to another in this knowledge structure. By analyzing the topological characteristics and node connection relationships of the multi-level knowledge structure, the element values in the state transition matrix can be calculated.
[0099] Specifically, the system first counts the number distribution of each type of connection edge in the multi-level knowledge structure to understand the distribution characteristics of different relationship types in the knowledge base. Then, the system calculates the weight coefficient of each type of connection edge based on the number distribution, and the weight coefficient is inversely proportional to the number of the corresponding type of connection edge. The relationship type with lower frequency is given higher weight to balance the influence of each relationship type on state transition. Next, the system calculates the state transition probability between nodes according to the type of connection edge between nodes and its corresponding weight coefficient. Finally, all state transition probabilities are normalized to satisfy the properties of probability distribution, thereby obtaining a complete state transition matrix.
[0100] S202. Perform eigenvalue decomposition on the state transition matrix to obtain the eigenvector corresponding to the maximum eigenvalue, and take the components of the eigenvector as the importance scores of each node;
[0101] In this step, the system performs eigenvalue decomposition on the constructed state transition matrix to reveal the internal structural characteristics of the state transition matrix through matrix decomposition. Eigenvalue decomposition is a common matrix decomposition technique that decomposes a matrix into a linear combination of eigenvalues and eigenvectors. By solving the eigenvalue problem, the eigenvalues and corresponding eigenvectors of the state transition matrix can be obtained. Among them, the eigenvector corresponding to the largest eigenvalue has important physical significance, which reflects the steady-state distribution of the state transition matrix, i.e., the equilibrium probability distribution of each state after a long time evolution of the system.
[0102] Based on this principle, the system takes the components of the eigenvector corresponding to the largest eigenvalue as the importance scores of each node. Each component of the eigenvector represents the probability value of the corresponding node in the steady-state distribution. The larger the value, the more important the node is in the knowledge structure, and the more likely it is to be accessed in the state transition process. Therefore, the eigenvector components can be directly used to measure the importance of the nodes.
[0103] S203, ranking the importance of each node based on the importance score, and dividing each node into several importance levels according to a preset level threshold;
[0104] After obtaining the importance scores of each node, the system needs to rank and layer the nodes based on the importance scores. Through importance ranking, the core nodes and edge nodes in the knowledge structure can be quickly identified, and the relative importance of the nodes in the entire knowledge system can be understood. At the same time, by setting a level threshold to layer the nodes, the knowledge structure can be divided into different importance levels, forming a hierarchical knowledge organization form.
[0105] Specifically, the system first ranks the nodes in descending order based on the importance scores of the nodes using appropriate sorting algorithms. The higher the importance score, the higher the node is ranked. Common sorting algorithms such as quicksort, mergesort, etc. can be used. The system can choose appropriate sorting algorithms according to the number of nodes and hardware environment, taking into account the sorting efficiency and stability. After sorting, the system divides the nodes into several importance levels according to the preset level threshold. The level threshold can be set according to the size of the knowledge structure, the distribution of node importance, etc. The division method is usually equidistant or equifrequent. Each importance level corresponds to an importance score interval, and the nodes within the interval are classified into the corresponding level.
[0106] S204, preserving the connection relationship between adjacent level nodes in the multi-level knowledge structure according to the importance level, obtaining the multi-level knowledge structure after level optimization;
[0107] In this step, the system optimizes the multi-level knowledge structure by level, and obtains a simplified and efficient knowledge structure representation by retaining the connection relationship between adjacent important level nodes. This optimization process is based on the importance level information of the nodes, aiming to filter out redundant or low-value connections, highlight the main context of the knowledge structure, and improve the efficiency of subsequent knowledge reasoning and interaction.
[0108] Specifically, the system traverses all connection edges in the multi-level knowledge structure. For each connection edge, it judges whether the two end nodes belong to adjacent importance levels. If the two end points of the connection edge are located in adjacent levels, the connection relationship is retained; otherwise, the connection relationship is removed. After this screening process, the original multi-level knowledge structure is simplified into a level-optimized knowledge structure, which only contains connections between adjacent importance levels. This optimization method can effectively remove cross-level redundant connections and reduce the complexity of the knowledge structure.
[0109] In implementing level optimization, the system can use appropriate data structures and algorithms to improve processing efficiency. For example, the system can store the knowledge structure based on an adjacency list or adjacency matrix to facilitate fast retrieval of node connection information; the system can also use a parallel computing framework to use multi-core processors or distributed environments to accelerate the screening process of connection edges. At the same time, the system can introduce some preprocessing techniques, such as sorting, hashing indexing, etc. for nodes and connection edges, to further optimize the time complexity of level screening.
[0110] S205, constructing a context knowledge base, extracting historical traversal paths with similar scene characteristics from the context knowledge base to obtain candidate traversal sequences;
[0111] The system constructs a context knowledge base, extracts historical traversal paths with similar scene characteristics from the context knowledge base to obtain candidate traversal sequences, specifically: converts the current dialogue scene into a feature vector representation, which includes entity type, relationship type and hierarchical distribution features;
[0112] Calculate the similarity of the feature vector with each scene description in the context knowledge base;
[0113] Filter out the historical traversal paths corresponding to the similar scenes with a similarity greater than a preset similarity threshold;
[0114] Cluster analysis is performed on the historical traversal paths to extract traversal patterns and form candidate traversal sequences.
[0115] In this step, the system constructs a context knowledge base to store and manage knowledge and experience related to specific interaction scenarios. The context knowledge base not only contains information about the multi-level knowledge structure itself, but also includes a series of historical traversal paths, i.e., the node sequences actually accessed by the system in previous interaction processes. By analyzing and utilizing these historical experiences, the system can better adapt to the current interaction needs and provide personalized, context-related knowledge services.
[0116] Specifically, the system first converts the current dialogue scenario into a feature vector representation, taking into account factors such as the types of entities involved, the types of relationships, and their distribution in the knowledge structure. Then, based on this feature vector, the system calculates the similarity between the current scenario and each historical scenario in the context knowledge base. Similarity calculation can use common measurement methods such as cosine similarity and Jaccard coefficient. Next, the system filters out historical scenarios with a similarity to the current scenario exceeding a pre-set threshold, and extracts the corresponding historical traversal paths to form a set of candidate traversal sequences. These candidate sequences reflect the system's successful experiences in similar scenarios and have important reference value for guiding the current interaction.
[0117] In implementing the context knowledge base, the system can use appropriate database technologies for design and optimization, such as relational databases, NoSQL databases, etc., to support efficient data storage, retrieval, and updating. At the same time, the system can introduce content-based recommendation algorithms, collaborative filtering algorithms, etc., to make personalized historical path recommendations based on scenario similarity and user preferences. In addition, for massive historical traversal data, the system can use big data processing frameworks such as Hadoop, Spark, etc., to realize distributed computing and real-time analysis, improving the performance and effectiveness of context matching.
[0118] S206, dynamic programming analysis of candidate traversal sequences to calculate the cumulative benefits of each traversal path;
[0119] After obtaining the candidate traversal sequences, the system needs to evaluate the quality and utility of each traversal path to select the optimal path to guide the current knowledge interaction. In this step, the system uses dynamic programming to analyze the candidate traversal sequences, calculates the cumulative benefits of each path, and quantifies the comprehensive value of the path to provide a basis for subsequent decision-making.
[0120] Dynamic programming is a common optimization algorithm that breaks down complex problems into interrelated sub-problems and uses the optimal solutions of sub-problems to construct the optimal solution of the original problem. In the traversal path analysis, the system regards each path as a sequence of nodes and designs a cumulative revenue function to evaluate the quality of the node sequence. The cumulative revenue function considers factors such as the importance of nodes, the correlation between nodes, and the access cost, and obtains the comprehensive revenue value of the path through weighted summation or nonlinear combination. Using the idea of dynamic programming, the system can efficiently calculate the optimal cumulative revenue of each candidate path, avoiding repeated calculation and exhaustive search.
[0121] In specific implementation, the system can represent the candidate traversal sequence as a directed acyclic graph, where the nodes correspond to entities in the knowledge structure, and the edges represent the relationships between entities. On this graph, the dynamic programming algorithm is applied to calculate the optimal cumulative revenue of the nodes from bottom to top. For each node, the system considers all possible predecessor nodes, and combines the revenue value of the current node and the transition cost of the edge to update the optimal cumulative revenue of the node. Through the recursive formula and the memoization technique, the system can efficiently solve the optimal cumulative revenue distribution of the entire candidate sequence.
[0122] S207, sort the candidate traversal sequences in descending order of cumulative revenue, and select the first traversal sequence in the descending order as the optimized traversal path.
[0123] After completing the cumulative revenue calculation of the candidate traversal sequence, the system needs to sort the sequence according to the revenue value and select the optimal path as the guide for the current interaction. In this step, the system uses descending order sorting to place the traversal sequence with the highest cumulative revenue at the top and determines it as the optimized traversal path, which is used to guide subsequent knowledge reasoning and information presentation.
[0124] In specific implementation, the system can use common sorting algorithms such as quicksort, mergesort, heapsort, etc. to arrange the traversal sequences in descending order according to their cumulative revenue values. Since the number of candidate sequences is usually limited, the time complexity of the sorting process will not become a performance bottleneck. After sorting, the system directly selects the first sequence in the sorting result as the optimized traversal path, which has the highest cumulative revenue value among all candidate paths and represents the optimal choice in the current interaction scenario.
[0125] After selecting the optimized traversal path, the system can navigate and traverse the knowledge structure according to the path, access the key nodes on the path, extract relevant knowledge, and present it to the user in an appropriate manner. The optimized path has a wide range of node coverage and high information density, and can provide the user with maximum knowledge benefits within a limited number of interaction steps. At the same time, the system can also use the structural characteristics and node attributes of the optimized path to dynamically adjust the interaction strategy and presentation method, such as adjusting the amount of information, controlling the depth of interaction, introducing multimedia elements, etc., to improve the user's understanding and experience.
[0126] In response to real-time interaction requirements, the system can adopt an incremental optimization strategy, dynamically updating the cumulative benefit value of the candidate sequence based on the latest user feedback and scenario changes, and adjusting the optimized traversal path accordingly. This dynamic optimization mechanism enables the system to adapt to the user's knowledge preferences and interaction intentions in a timely manner, providing continuous optimization of knowledge services. In addition, the system can also learn and analyze a large number of optimized paths, summarize general traversal patterns and rules, and form knowledge navigation templates for different scenarios, further improving interaction efficiency and quality.
[0127] In the above embodiments, the importance of the nodes in the knowledge structure is analyzed using the state transition matrix and eigenvalue decomposition method, achieving the quantification and layering of the nodes. The element values in the state transition matrix are determined based on the connection edge type, preserving the semantic information of the relationship between nodes. The eigenvector components obtained by eigenvalue decomposition are used as the node importance scores, reflecting the position of the nodes in the overall knowledge structure. The node layering based on the importance scores and the preservation of connection relationships ensure that the optimized knowledge structure maintains the original hierarchical relationship and highlights the role of important nodes.
[0128] The system in the embodiments of the present application will be described from the perspective of hardware processing. Please refer to Figure 3 An entity device structure schematic diagram of a digital human interaction system based on a knowledge graph provided by the embodiments of the present application.
[0129] It should be noted that Figure 3 The structure of the system shown is only one example and should not impose any limitations on the functions and use range of the embodiments of the present application.
[0130] As Figure 3As shown, the system includes a Central Processing Unit (CPU) 301 which can perform various appropriate actions and processes, such as executing the methods in the above embodiments, according to programs stored in a Read-Only Memory (ROM) 302 or loaded from a storage section 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data required for operation of the system are also stored. The CPU 301, the ROM 302, and the RAM 303 are connected to each other through a bus 304. An Input / Output (I / O) interface 305 is also connected to the bus 304.
[0131] Connected to the I / O interface 305 are an input section 306 including a camera, an infrared sensor, and the like; an output section 307 including a Liquid Crystal Display (LCD), a speaker, and the like; the storage section 308 including a hard disk, and the like; and a communication section 309 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as necessary. A removable media 311 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is attached to the drive 310 as necessary, so that a computer program read therefrom is installed into the storage section 308 as necessary.
[0132] In particular, according to embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing a computer program for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication section 309, and / or installed from the removable media 311. When the computer program is executed by the Central Processing Unit (CPU) 301, various functions defined in the present application are performed.
[0133] It should be noted that the computer-readable medium in the embodiments of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the present application, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable computer programs. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above.
[0134] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. Each block in the flowcharts or block diagrams can represent a module, a program segment or a part of code containing one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and sometimes in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams or flowcharts, and the combination of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0135] As another aspect, the present application also provides a computer readable storage medium, which can be included in the system described in the above embodiments, or can exist independently without being assembled into the system. The above storage medium carries one or more computer programs, which, when executed by a processor of a system, enable the system to implement the method provided in the above embodiments.
[0136] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit the present application; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still make modifications to the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0137] In the above embodiments, according to the context, the term "when" can be interpreted as meaning "if" or "after" or "in response to determining" or "in response to detecting". Similarly, according to the context, the phrase "upon determining" or "if detecting (the stated condition or event)" can be interpreted as meaning "if determining" or "in response to determining" or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)".
[0138] In the above embodiments, all or some of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or some of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or some of the processes or functions described in the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer readable storage medium, or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium accessible by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (such as floppy disk, hard disk, magnetic tape), optical media (such as DVD), or semiconductor media (such as solid state disk) and the like.
[0139] Those skilled in the art can understand that all or part of the processes in the above-mentioned method embodiments can be implemented by a computer program instructing relevant hardware to complete, the program can be stored in a computer readable storage medium, and the program can include the processes of the above-mentioned method embodiments when executed. The aforementioned storage medium includes ROM or random storage memory RAM, magnetic disc or optical disc and various storage code medium.
Claims
1. A knowledge graph-based digital human interaction method, characterized in that, The method comprises the following steps: receiving user input question information and extracting key entities and entity relationships from the question information; determining a core node with the highest association degree with the key entities in a preset knowledge graph, and generating a knowledge subgraph with a preset maximum depth based on the core node, wherein the determination of the core node with the highest association degree with the key entities in the preset knowledge graph comprises the following steps: calculating the semantic similarity between each key entity and a node in the preset knowledge graph; descendingly sorting the nodes in the preset knowledge graph based on the semantic similarity, and selecting candidate nodes with a semantic similarity in a front preset number; counting the sum of out-degree and in-degree of each candidate node, wherein the out-degree represents the number of edges starting from the candidate node, and the in-degree represents the number of edges ending at the candidate node; descendingly sorting the candidate nodes based on the sum of out-degree and in-degree, and determining the candidate node at the first position after sorting as the core node; calculating the shortest path between each node in the knowledge subgraph, and determining the close-remote relationship weight between each node according to the length of the shortest path; pruning the knowledge subgraph based on the close-remote relationship weight, retaining nodes and corresponding associated edges with a close-remote relationship weight higher than a preset threshold to obtain an optimized knowledge subgraph; clustering each node in the optimized knowledge subgraph according to the type of the corresponding connection edge to obtain a multi-level knowledge structure; constructing a state transition matrix based on the multi-level knowledge structure, wherein the element value of the state transition matrix is determined according to the type of the connection edge between each node; performing eigenvalue decomposition on the state transition matrix to obtain a feature vector corresponding to the maximum eigenvalue, and taking the components of the feature vector as the importance scores of each node; importance sorting of each node based on the importance score, and dividing each node into several importance levels according to a preset level threshold; retaining the connection relationship between adjacent level nodes in the multi-level knowledge structure according to the importance level to obtain a hierarchical optimized multi-level knowledge structure; constructing a context knowledge base, wherein the context knowledge base contains dialogue scene description, node access order and corresponding traversal effect score; extracting historical traversal paths with similar scene characteristics from the context knowledge base to obtain candidate traversal sequences, specifically comprising: converting the current dialogue scene into a feature vector representation, which includes entity type, relationship type and hierarchical distribution characteristics; calculating the similarity between the feature vector and each scene description in the context knowledge base; selecting historical traversal paths corresponding to similar scenes with a similarity greater than a preset similarity threshold; performing cluster analysis on the historical traversal paths to extract traversal patterns and form candidate traversal sequences; performing dynamic programming analysis on the candidate traversal sequences to calculate the cumulative benefits of each traversal path; descendingly sorting the candidate traversal sequences based on the cumulative benefits, and selecting the first traversal sequence in the descending order as the optimized traversal path; performing depth-first traversal in the multi-level knowledge structure according to the entity relationship to generate a knowledge reasoning chain; Generate reply information based on the knowledge reasoning chain, and control the digital human to output the reply information.
2. The method of claim 1, wherein, The shortest path between each node in the knowledge subgraph is calculated, specifically including: A node adjacency matrix is constructed, and each element in the node adjacency matrix represents whether there is a direct connection relationship between the corresponding nodes. A distance matrix is constructed based on the node adjacency matrix, and in the initial value of the distance matrix, the distance between directly connected nodes is a preset value, and the distance between unconnected nodes is infinity. Iterative updating is performed on the distance matrix to obtain the shortest path between each node.
3. The method of claim 1, wherein, The state transition matrix is constructed based on the multi-level knowledge structure, specifically including: The number distribution of each type of connection edge in the multi-level knowledge structure is counted. The weight coefficients of each type of connection edge are calculated based on the number distribution, and the weight coefficients are inversely proportional to the number of corresponding types of connection edges. The state transition probability is calculated according to the type of the connection edge between each node and the corresponding weight coefficient. The state transition probability is normalized to obtain the state transition matrix.
4. A knowledge graph based digital human interaction system, characterized in that, The system includes: One or more processors and memories; the memory is coupled with the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors invoke the computer instructions to enable the system to perform the method of any one of claims 1-3.
5. A computer-readable storage medium comprising instructions, characterized in that, When the instructions run on the system, the system performs the method of any one of claims 1-3.
6. A computer program product, characterised in that, When the computer program product runs on the system, the system performs the method of any one of claims 1-3.
Citation Information
Patent Citations
Knowledge graph semantic question-answering method and device, computer equipment and storage medium
CN112487168A
Knowledge graph retrieval method and device, medium and product
CN118227668A
Clinical test questionnaire generation method and device, equipment and storage medium
CN119007900A