A Chinese dialogue knowledge retrieval method and system based on knowledge retrieval graph

By dividing the knowledge map into a sub -map of the theme level and integrating the dialogue information, combined with random voice recognition and intention classification, the problem of difficulty in obtaining dialogue theme related knowledge information in existing technology has been solved, and efficient dialogue generation is realized to ensure the recovery content The context consistency and information diversity.

CN118551004BActive Publication Date: 2025-01-28CHENGDU NUOBIKAN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410596380.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-14
Publication Date
2025-01-28
Estimated Expiration
2044-05-14

AI Technical Summary

Technical Problem

The prior art is difficult to obtain knowledge information related to dialogue topics, and fails to effectively integrate long dialogue context and knowledge graph information, resulting in robots answering non-questions in dialogue.

Method used

By dividing the knowledge map into sub -diagrams at the first -level theme level, capture semantic components and build a BERT -based essay to identify the model, obtain different levels of semantic information, and use the sub -diagram network fusion theme -level dialogue information to obtain the semantic structure of the semantic structure Essence Combined with existing training corpus for random voice recognition and weight training, the introduction of intention classification information to enhance dialogue generation.

Benefits of technology

Realize the knowledge information related to the theme of the dialogue in the dialogue generation, improve the context consistency and information diversity of the dialogue, ensure that the recovery content is related to historical dialogue, and the knowledge correlation achieves the best results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118551004B_ABST
    Figure CN118551004B_ABST
Patent Text Reader

Abstract

The present invention discloses a Chinese dialogue knowledge retrieval method and system based on a knowledge retrieval graph, which relates to the technical field of Chinese dialogue retrieval, including: dividing the knowledge graph into subgraphs of a first-level subject level, capturing the semantic components of the subject level of the input knowledge graph in each subgraph, constructing a contextual intention recognition model for the semantic components, and obtaining semantic information of different levels in the semantic components; fusing the semantic information with dialogue information of the subject level through a subgraph attention network to obtain the semantic structure of the dialogue information; performing weight training on the training corpus using a classification model to obtain intention classification information; introducing the intention classification information into a word embedding matrix of a pre-trained language model and fusing it with a word vector in a dialogue task to obtain dialogue information, which can focus on different subject components of the knowledge graph, extract knowledge information related to historical dialogues, and thus generate replies with consistent context themes and diverse information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Chinese dialogue retrieval, and in particular to a Chinese dialogue knowledge retrieval method and system based on a knowledge retrieval graph. Background Art

[0002] The development of artificial intelligence has gradually enabled people to have a more convenient life experience, and human-computer interaction technology based on artificial intelligence is currently being widely studied. On the road to improving the human-computer interaction experience, how to use artificial intelligence technology to effectively process human natural language has become a problem that urgently needs to be studied and solved.

[0003] With the advancement and development of science and technology, language has become a bridge for humans to interact with machines. Among them, the intelligent dialogue system formed by the use of artificial intelligence technology has lowered the threshold for human-machine interaction, allowing people to directly use natural language to interact with machines in terms of information. Intelligent dialogue systems are mainly divided into domain-oriented task-based dialogue systems and open-domain dialogue systems. Task-based dialogue systems aim to complete specific tasks asked by users in the process of dialogue with users and help users solve problems. For example, Ali Xiaomi replaces manual customer service to answer users' orders and other related questions. With the development of dialogue systems, people are no longer satisfied with human-computer interaction with a single function, and they expect to achieve information and emotional communication and entertainment with robots. Therefore, the Chinese dialogue knowledge retrieval method system came into being. At present, the Chinese dialogue knowledge retrieval method based on the knowledge retrieval graph still has the following problems:

[0004] (1) The huge amount of information in the knowledge graph makes it difficult for the model to obtain knowledge information related to the conversation topic, resulting in the robot answering irrelevant questions during the communication process;

[0005] (2) Due to the long sequence of historical information contained in multi-round dialogues, it is difficult for the knowledge retrieval model to extract topic information related to the overall dialogue. It does not consider the semantic information of the local topic level of the knowledge graph, nor does it effectively integrate the long dialogue context and knowledge graph information into dialogue generation. Summary of the invention

[0006] The purpose of the present invention is to provide a Chinese dialogue knowledge retrieval method and system based on a knowledge retrieval graph, so as to solve the technical problems in the prior art that it is difficult to obtain knowledge information related to the dialogue topic, the semantic information of the local topic level of the knowledge graph is not considered, and the long dialogue context and knowledge graph information are not effectively integrated into the dialogue generation.

[0007] In order to solve the above technical problems, the present invention specifically provides the following technical solutions:

[0008] A first aspect of the present invention provides a Chinese dialogue knowledge retrieval method based on a knowledge retrieval graph, comprising the following steps:

[0009] A knowledge graph is defined by continuously acquiring conversation information, the knowledge graph is segmented into subgraphs at the primary topic level, each subgraph is input into the topic level of the knowledge graph to capture semantic components, a BERT-based contextual intent recognition model is constructed for the semantic components, and semantic information at different levels in the semantic components is obtained;

[0010] The semantic information is fused with the topic-level dialogue information through a subgraph attention network to obtain a semantic structure corresponding to the dialogue information;

[0011] Perform random speech recognition on the semantic structure in combination with existing training corpus to obtain training corpus with different semantic information, perform weight training on the training corpus using a classification model to obtain intent classification information;

[0012] The intent classification information is introduced into the word embedding matrix of the pre-trained language model and fused with the word vector in the dialogue task to obtain dialogue information.

[0013] As a preferred solution of the present invention, the knowledge graph is divided into subgraphs at the primary subject level, including:

[0014] The continuously acquired dialogue information is divided into: current dialogue X n ={x1,x2,…,x m}, historical dialogue Q = {q1,q2,…,q m} and the global knowledge graph G n ={g1,g2,…,g m}, according to the global knowledge graph G n Classifying the knowledge graph into primary subject levels;

[0015] The first-level subject level is used to construct a node-level knowledge graph NG according to the contextual semantic relationship corresponding to the global knowledge graph, and the node-level knowledge graph NG is divided into a group of sub-graphs NG by subject. s ={T1,T2,…,T i ,…,T n}, the NG s Each T i Represents a subgraph;

[0016] According to the number of sub-topic nodes corresponding to the main node of the current first-level topic layer, the current state of the main node is set to a one-to-many state or a one-to-one state;

[0017] The one-to-many state corresponds to different sub-topic nodes N through the main node t The one-to-one state corresponds to only one sub-topic node N through the main node d ;

[0018] The sub-topic node N t And sub-topic node N d Combined with the global knowledge graph G n Construct a subgraph T i .

[0019] As a preferred solution of the present invention, each of the subgraphs captures the semantic components of the subject level of the input knowledge graph, including:

[0020] The subgraph is defined in units of topics, and each main node in the node-level knowledge graph NG is traversed. During the traversal process, the number of child nodes contained in each main node is recorded. If the main node contains multiple child nodes, the main node is taken as a sub-topic, and the sub-topic is taken as the root node of the topic-level subgraph;

[0021] Construct a new knowledge graph with the root node, re-traverse the node-level knowledge graph NG to find all nodes with relationship edges with the root node, connect the corresponding nodes with the root node, and obtain a complete knowledge subgraph;

[0022] When the node-level knowledge graph NG is traversed to a leaf node or to the next node with multiple child nodes, the traversal is stopped, all the traversed child nodes are updated, and the child nodes are divided into new topic-level sub-graphs;

[0023] The topic-level semantics contained in each of the subgraphs is segmented into components, similarity is calculated in units of subgraphs, and semantic components at the first-level topic level are obtained.

[0024] As a preferred solution of the present invention, a contextual intent recognition model based on BERT is constructed for the semantic component to obtain semantic information of different levels in the semantic component, including:

[0025] The semantic components are passed through the Multi-head Self-Attention module to obtain the enhanced semantic vector of the semantic text, and the Attention mechanism is used to use the information of the key words in the enhanced semantic vector to enhance the semantic representation of the target word. The expression of the Attention mechanism is:

[0026]

[0027] Among them, Q represents the target word in the enhanced semantic vector, K represents the key words in the context of the target word, and O represents the original value of the target word. Indicates the weight of the target word in different semantics;

[0028] The enhanced semantic vectors are linearly combined in different semantic spaces to obtain weight parameters of the target word Q in different semantic spaces, and semantic information of different levels in the semantic components is obtained according to the weight parameters.

[0029] As a preferred solution of the present invention, the semantic information is fused with the topic-level dialogue information through a subgraph attention network to obtain the semantic structure corresponding to the dialogue information, including:

[0030] Constructing a node-level graph NV={V,E} for the semantic information, connecting the first element of the root node to the next element with a directed edge, obtaining a global semantic directed edge, encoding the global semantic directed edge through an attention-based subgraph attention network, and obtaining contextual dialogue information;

[0031] The context dialogue information is merged into a paragraph Q1 consisting of m words = {q 1j ,q 2j ,…,q mj}, a bidirectional gating mechanism is used to perform a forward and backward gating of each word q in the paragraph Q1. j Calculate the bidirectional word embedding representation and obtain the historical conversation encoding R q , whose expression is:

[0032]

[0033] Among them, f j-1 Indicates that by concatenating words q j The bidirectional hidden state obtained, e(q j ) indicates word q j The word embedding vector of , BiGRU() represents the bidirectional gating mechanism;

[0034] According to the historical dialogue encoding R q Calculate the attention weight of each word embedding representation in each node in the historical dialogue and node-level graph NV Its expression is:

[0035]

[0036] in, Represents historical code R q The attention factor of node i in the node-level graph NV;

[0037] Apply the aggregation function to each node i in each word to obtain the neighboring node information, and obtain the semantic structure corresponding to the dialogue information according to the attention weight.

[0038] As a preferred solution of the present invention, random speech recognition is performed on the semantic structure in combination with existing training corpus to obtain training corpus with different semantic information, including:

[0039] The dialogue text in the semantic structure is serialized with characters as the basic unit, denoted as W = {w1, w2, ..., w n}, where n represents the sequence length in the dialogue text, the sequence length n is randomly deleted with probability P to obtain an ordered integer array nLeo, which is expressed as:

[0040]

[0041] in, Indicates that the product of P and n is rounded down, Random indicates a random function, Indicates the number of words that need to be deleted in the sequence;

[0042] Replace the corresponding positions of the text characters in the ordered integer array nLeo with pinyin, search the vocabulary according to the pinyin, and randomly select a character to replace, generate a new training sample, and require that the selected character is different from the character to be replaced in the original sample;

[0043] The new training samples and the original samples are encoded to obtain training corpus with different semantic information.

[0044] As a preferred solution of the present invention, a classification model is used to perform weight training on the training corpus to obtain intent classification information, including:

[0045] The k intentions contained in the training corpus are numbered from 0 to k-1, expressed as Intent = {I0, I1, ..., I k-1}, set the i-th intention I i The corresponding threshold t i ;

[0046] The intention I i Convolution is performed using three different sizes of convolution kernels, intent classification is performed through the maximum pooling layer and the fully connected layer, and sigmoid is used as the activation function to independently predict the score of each intent category;

[0047] The intent classification information is obtained according to the score of each intent category.

[0048] As a preferred solution of the present invention, the intention classification information is introduced into the word embedding matrix of the pre-trained language model and fused with the word vector in the dialogue task to obtain the dialogue information, including:

[0049] Initialize the intent classification information into a word embedding matrix, perform one-hot encoding on the word embedding matrix, convert the one-hot encoding into a word vector of the Transformer model, and use the pre-trained language model to obtain the trained word embedding matrix W word ;

[0050] The word vectors are respectively combined with the word embedding matrix W word Multiply, generate multiple rounds of question-answering dialogues through word fusion method, so as to obtain dialogue information.

[0051] The second aspect of the present invention is a system for Chinese dialogue knowledge retrieval method based on knowledge retrieval graph,

[0052] Includes: Pre-trained language module, used to vectorize natural language text and process text corpus with characters as the basic unit;

[0053] The semantic feature extraction module is used to extract the characteristic meaning of the word in the semantics, combine the meaning of the target word in the text with its context, and use the information of the key word to enhance the semantic representation of the target word;

[0054] A topic-level knowledge graph segmentation module is used to segment the semantic representation into subgraphs based on topics. In the process of fusing the knowledge graph with the conversation context, similarity is calculated based on subgraphs.

[0055] The dialogue module is used to control the generation and response of dialogues, perceive semantic representations in real time, and promptly correct semantic information to complete real-time dialogues.

[0056] Compared with the prior art, the present invention has the following beneficial effects:

[0057] The present invention adopts the topic-level subgraph attention network to fuse the subgraph and the previous rounds of dialogue discourse, and jointly decodes the fused subgraph and the current round of dialogue to obtain the reply content. It can focus on different topic components of the knowledge graph and extract knowledge information related to historical dialogues, thereby generating replies with consistent context themes and diverse information.

[0058] By imitating the problems that may occur in the speech recognition process, random homophone replacement and random deletion operations are performed on the existing training corpus to obtain training corpus with different semantic information. The training corpus is then digitized and represented as a computer-understandable encoding vector and input into the BERT model to obtain text semantic vectors at different levels. Finally, a classification model is constructed to train the weights of the text semantic vectors to obtain intent classification results, thereby achieving the optimal effect in terms of the fluency of the reply text, context consistency, information diversity, and knowledge relevance. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.

[0060] Figure 1 A flow chart of a Chinese dialogue knowledge retrieval method based on a knowledge retrieval graph provided by an embodiment of the present invention;

[0061] Figure 2 A system block diagram of Chinese dialogue knowledge retrieval based on a knowledge retrieval graph provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0063] like Figure 1 and Figure 2 As shown, the present invention provides a Chinese dialogue knowledge retrieval method based on a knowledge retrieval graph, comprising the following steps:

[0064] The knowledge graph is defined by continuously acquiring conversation information, and the knowledge graph is divided into subgraphs at the first-level topic level. Each subgraph is input into the topic level of the knowledge graph to capture semantic components, and a BERT-based contextual intent recognition model is constructed for the semantic components to obtain semantic information at different levels in the semantic components.

[0065] In this embodiment, a topic-level dialogue generation model TKG is used to better integrate the knowledge graph and the dialogue context and to better handle the relationship between the current round of dialogue and the historical dialogue.

[0066] The semantic information is fused with the topic-level dialogue information through the subgraph attention network to obtain the semantic structure corresponding to the dialogue information;

[0067] In this embodiment, a subgraph attention network is used to learn the similarity weights between the node-level knowledge graph and the topic-level knowledge subgraph and the historical conversations, respectively, so as to obtain the semantic representation of the node-level and topic-level knowledge graphs after being enhanced by the historical conversations. After weighting the two according to the same nodes, the final topic-level representation of the knowledge graph is obtained by encoding using a gated graph neural network based on the attention mechanism.

[0068] Combine existing training corpus to perform random speech recognition on semantic structure, obtain training corpus with different semantic information, use classification model to perform weight training on training corpus, and obtain intent classification information;

[0069] In this embodiment, the output of the BERT model is used to perform a linear fully connected layer, and the purpose of intent classification is achieved through a classifier. Using sigmoid as the activation function can independently predict the score of each intent category.

[0070] The intent classification information is introduced into the word embedding matrix of the pre-trained language model and fused with the word vector in the dialogue task to obtain the dialogue information.

[0071] In this embodiment, a subgraph attention network is used to fuse the dialogue discourse and subgraph sets of the previous rounds, and the fused subgraph and the current round of dialogue are decoded to obtain the final reply. By using the topic-level knowledge subgraph, different topic components can be paid attention to, thereby effectively alleviating the shortcomings of knowledge graph-based dialogue generation.

[0072] The knowledge graph is divided into sub-graphs at the first-level subject level, including:

[0073] The continuously acquired dialogue information is divided into the following types according to the task form: current dialogue X n ={x1,x2,…,x m}, historical dialogue Q = {q1,q2,…,q m} and the global knowledge graph G n ={g1,g2,…,g m}, according to the global knowledge graph G n Classify the knowledge graph into first-level topic levels;

[0074] The first-level topic level is constructed into a node-level knowledge graph NG according to the contextual semantic relationship corresponding to the global knowledge graph, and the node-level knowledge graph NG is divided into a set of sub-graphs NG by topic. s ={T1,T2,…,T i ,…,T n},NG s Each T i Represents a subgraph;

[0075] According to the number of sub-topic nodes corresponding to the main node of the current first-level topic layer, the current state of the main node is set to a one-to-many state or a one-to-one state;

[0076] The one-to-many state corresponds to different sub-topic nodes N through the main node t , one-to-one state corresponds to only one sub-topic node N through the main node d ;

[0077] Subtopic node N t And sub-topic node N d Combined with the global knowledge graph G n Construct a subgraph T i .

[0078] In this embodiment, the global knowledge graph G n After segmentation based on topics, a group of subgraphs are obtained. Each subgraph contains topic-level semantic information. In the process of fusion with the conversation context, similarity calculation is performed based on subgraphs to extract topic-level information.

[0079] In this embodiment, each element of the first-level topic layer is regarded as a node. Then, starting from the first element of the root node, a directed edge is used to connect the next element. All elements can be connected to each other to form a complete directed graph, so that the node-level knowledge graph has more nodes than the original knowledge graph and can obtain richer semantic information.

[0080] Each subgraph captures the topic-level semantic components of the input knowledge graph, including:

[0081] Define the subgraph in terms of themes, traverse each main node in the node-level knowledge graph NG, and record the number of subnodes contained in each main node during the traversal process. If the main node contains multiple subnodes, take the main node as a sub-theme, and take the sub-theme as the root node of the theme-level subgraph;

[0082] Construct a new knowledge graph with the root node, re-traverse the node-level knowledge graph NG to find all nodes with relationship edges to the root node, connect the corresponding nodes to the root node, and obtain the complete knowledge subgraph;

[0083] When the node-level knowledge graph NG is traversed to a leaf node or to the next node with multiple child nodes, the traversal is stopped, all the traversed child nodes are updated, and the child nodes are split into new topic-level sub-graphs;

[0084] The topic-level semantics contained in each subgraph is divided into components, and the similarity is calculated in units of subgraphs to obtain the semantic components of the first-level topic level.

[0085] In this embodiment, by traversing the node-level knowledge graph NG to find all nodes that have relationship edges with the root node, the similarity weights of the node-level knowledge graph and the topic-level knowledge subgraph with the historical conversations are learned respectively, so as to obtain the semantic representation of the node-level and topic-level knowledge graphs after being enhanced by the historical conversations. After weighting the two according to the same nodes, the final topic-level representation of the knowledge graph is obtained by encoding using a gated graph neural network based on the attention mechanism.

[0086] A BERT-based contextual intent recognition model is built for semantic components to obtain semantic information at different levels in the semantic components, including:

[0087] The semantic components are passed through the Multi-head Self-Attention module to obtain the enhanced semantic vector of the semantic text. The Attention mechanism is used to enhance the semantic representation of the target word using the information of the key words in the enhanced semantic vector. The expression of the Attention mechanism is:

[0088]

[0089] Among them, Q represents the target word in the enhanced semantic vector, K represents the key words in the context of the target word, and O represents the original value of the target word. Indicates the weight of the target word in different semantics;

[0090] In this embodiment, the Self-Attention module is used to extract the enhanced semantic vector of each word in the text, and Multi-head is used to use multiple Self-Attention units in different semantic spaces to extract the enhanced semantic vector of each word in the text, so as to obtain a more powerful enhanced semantic vector.

[0091] In this embodiment, the Attention mechanism is to solve the similarity between the target word and each word in the context, and effectively use the information of the key word to enhance the semantic representation of the target word.

[0092] The enhanced semantic vectors are linearly combined in different semantic spaces to obtain the weight parameters of the target word Q in different semantic spaces, and the semantic information of different levels in the semantic components is obtained according to the weight parameters.

[0093] In this embodiment, a BERT-based contextual intent recognition model is used to focus "attention" on key words. The meaning of the target word in the text is usually related to its context, but it is not related to all the words in the context. Therefore, by using the Attention mechanism, the information of the key words can be effectively used to enhance the semantic representation of the target words.

[0094] The semantic information is fused with the topic-level dialogue information through the subgraph attention network to obtain the semantic structure corresponding to the dialogue information, including:

[0095] Construct a node-level graph NV = {V, E} for the semantic information, connect the first element of the root node with a directed edge to the next element, obtain the global semantic directed edge, encode the global semantic directed edge through the attention-based subgraph attention network, and obtain the contextual dialogue information;

[0096] Merge the context dialogue information into a paragraph Q1 consisting of m words = {q 1j ,q 2j ,…,q mj}, a bidirectional gating mechanism is used to control each word q in paragraph Q1 from front to back. j Calculate the bidirectional word embedding representation and obtain the historical conversation encoding R q , whose expression is:

[0097]

[0098] Among them, f j-1 Indicates that by concatenating words q j The bidirectional hidden state obtained, e(q j ) indicates word q j The word embedding vector of , BiGRU() represents the bidirectional gating mechanism;

[0099] In this embodiment, a bidirectional gating mechanism BiGRU is used to calculate word embedding representations from front to back and from back to front, thereby avoiding the problem of information gradient explosion while retaining relevant information and saving it to the next unit.

[0100] In this embodiment, the representation of the historical conversation from the front to the back and from the back to the front is calculated, and a hidden state from the back to the front containing the information of the entire historical conversation is obtained. After obtaining the bidirectional representation of the entire historical conversation, it is spliced ​​to obtain the final historical conversation code R q .

[0101] Encoding R based on historical dialogue q Calculate the attention weight of each word embedding representation in each node in the historical dialogue and node-level graph NV Its expression is:

[0102]

[0103] in, Represents historical code R q The attention factor of node i in the node-level graph NV;

[0104] Apply the aggregation function to each node i in each word to obtain the neighboring node information, and obtain the semantic structure corresponding to the dialogue information according to the attention weight.

[0105] In this embodiment, the attention weight of each word embedding representation is calculated To represent the weight distribution of the topic-level knowledge graph, after context weighting, it constitutes the final node-enhanced semantic structure at the topic level.

[0106] Combine existing training corpus to perform random speech recognition on semantic structures and obtain training corpus with different semantic information, including:

[0107] The dialogue text in the semantic structure is serialized with words as the basic unit, denoted as W = {w1,w2,…,w n}, where n represents the sequence length in the dialogue text. The sequence length n is randomly deleted with probability P to obtain an ordered integer array nLeo, which is expressed as:

[0108]

[0109] in, Indicates that the product of P and n is rounded down, Random indicates a random function, Indicates the number of words that need to be deleted in the sequence;

[0110] In this embodiment, the elements in the ordered integer array nLeo represent the sequence positions to be deleted, and the newly generated samples and the original samples are encoded and input into the intent classification model for training and fitting.

[0111] Replace the corresponding position of the text word in the ordered integer array nLeo with pinyin, search the vocabulary according to the pinyin, and randomly select a word to replace it to generate a new training sample. The selected word is required to be different from the word to be replaced in the original sample;

[0112] In this embodiment, the conversation text in the semantic structure is trained for intent through a data augmentation strategy of homophone replacement. A random deletion and random replacement strategy of homophones is adopted to solve the intent recognition task when the training samples are insufficient, which can effectively improve the robustness of the model.

[0113] The new training samples and the original samples are encoded to obtain training corpus with different semantic information.

[0114] Use the classification model to perform weight training on the training corpus to obtain intent classification information, including:

[0115] The k intents contained in the training corpus are numbered from 0 to k-1, expressed as Intent = {I0, I1, ..., I k-1}, set the i-th intention I i The corresponding threshold t i ;

[0116] Intention I i Three different sizes of convolution kernels are used for convolution, and intent classification is performed through the maximum pooling layer and the fully connected layer. Sigmoid is used as the activation function to independently predict the score of each intent category.

[0117] Get intent classification information based on the score of each intent category.

[0118] In this embodiment, the classification model uses BERT to extract a more robust text feature vector to initialize the convolution kernel input, calculates the intent score through the sigmoid layer, and marks the final intent label on the conversation text, thereby obtaining intent classification information in real time.

[0119] Introduce the intent classification information into the word embedding matrix of the pre-trained language model and fuse it with the word vector in the dialogue task to obtain dialogue information, including:

[0120] Initialize the intent classification information into a word embedding matrix, perform one-hot encoding on the word embedding matrix, convert the one-hot encoding into the word vector of the Transformer model, and use the pre-trained language model to obtain the trained word embedding matrix W word ;

[0121] The word vectors are respectively combined with the word embedding matrix W word Multiply, generate multiple rounds of question-answering dialogues through word fusion method, so as to obtain dialogue information.

[0122] In this embodiment, word-fused Embedding is used as the word vector, and the word is used as the basic unit for input, which not only retains the word meaning information brought by the pre-trained word vector model based on word segmentation, but also retains the diversity when training the word vector.

[0123] Second embodiment: A system for Chinese dialogue knowledge retrieval method based on knowledge retrieval graph,

[0124] Includes: Pre-trained language module, used to vectorize natural language text and process text corpus with characters as the basic unit;

[0125] The semantic feature extraction module is used to extract the characteristic meaning of the word in the semantics, combine the meaning of the target word in the text with its context, and use the information of the key word to enhance the semantic representation of the target word;

[0126] The topic-level knowledge graph segmentation module segments the semantic representation into subgraphs based on topics. In the process of fusing the knowledge graph with the conversation context, the similarity is calculated based on subgraphs.

[0127] The dialogue module is used to control the generation and response of dialogues, perceive semantic representations in real time, and promptly correct semantic information to complete real-time dialogues.

[0128] The present invention adopts the topic-level subgraph attention network to fuse the subgraph and the previous rounds of dialogue discourse, and jointly decodes the fused subgraph and the current round of dialogue to obtain the reply content. It can focus on different topic components of the knowledge graph and extract knowledge information related to historical dialogues, thereby generating replies with consistent context themes and diverse information.

[0129] By imitating the problems that may occur in the speech recognition process, random homophone replacement and random deletion operations are performed on the existing training corpus to obtain training corpus with different semantic information. The training corpus is then digitized and represented as a computer-understandable encoding vector and input into the BERT model to obtain text semantic vectors at different levels. Finally, a classification model is constructed to train the weights of the text semantic vectors to obtain intent classification results, thereby achieving the optimal effect in terms of the fluency of the reply text, context consistency, information diversity, and knowledge relevance.

[0130] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.

Claims

1. A Chinese dialogue knowledge retrieval method based on a knowledge retrieval graph, characterized in that: The following steps are involved: A knowledge graph is defined by continuously acquiring conversation information, the knowledge graph is segmented into subgraphs at the primary topic level, each subgraph is input into the topic level of the knowledge graph to capture semantic components, a BERT-based contextual intent recognition model is constructed for the semantic components, and semantic information at different levels in the semantic components is obtained; The semantic information is fused with the topic-level dialogue information through a subgraph attention network to obtain a semantic structure corresponding to the dialogue information; Perform random speech recognition on the semantic structure in combination with existing training corpus to obtain training corpus with different semantic information, perform weight training on the training corpus using a classification model to obtain intent classification information; The intent classification information is introduced into the word embedding matrix of the pre-trained language model and is fused with the word vector in the dialogue task to obtain dialogue information; The knowledge graph is divided into subgraphs at the first-level subject level, including: The continuously acquired dialogue information is divided into: current dialogue X n ={x1,x2,…,x m }, historical dialogue Q = {q1,q2,…,q m } and the global knowledge graph G n ={g1,g2,…,g m }, according to the global knowledge graph G n Classifying the knowledge graph into primary subject levels; The first-level subject level is used to construct a node-level knowledge graph NG according to the contextual semantic relationship corresponding to the global knowledge graph, and the node-level knowledge graph NG is divided into a group of sub-graphs NG by subject. s ={T1,T2,…,T i ,…,T n }, the NG s Each T i Represents a subgraph; According to the number of sub-topic nodes corresponding to the main node of the current first-level topic layer, the current state of the main node is set to a one-to-many state or a one-to-one state; The one-to-many state corresponds to different sub-topic nodes N through the main node t The one-to-one state corresponds to only one sub-topic node N through the main node d ; The sub-topic node N t And sub-topic node N d Combined with the global knowledge graph G n Construct a subgraph T i ; Each of the subgraphs is input into the topic level of the knowledge graph to capture semantic components, including: The subgraph is defined in units of topics, and each main node in the node-level knowledge graph NG is traversed. During the traversal process, the number of child nodes contained in each main node is recorded. If the main node contains multiple child nodes, the main node is taken as a sub-topic, and the sub-topic is taken as the root node of the topic-level subgraph; Construct a new knowledge graph with the root node, re-traverse the node-level knowledge graph NG to find all nodes with relationship edges with the root node, connect the corresponding nodes with the root node, and obtain a complete knowledge subgraph; When the node-level knowledge graph NG is traversed to a leaf node or to the next node with multiple child nodes, the traversal is stopped, all the traversed child nodes are updated, and the child nodes are divided into new topic-level sub-graphs; The topic-level semantics contained in each of the subgraphs is divided into components, similarity is calculated in units of subgraphs, and semantic components at the first-level topic level are obtained; The semantic information is fused with the topic-level dialogue information through a subgraph attention network to obtain a semantic structure corresponding to the dialogue information, including: Constructing a node-level graph NV={V,E} of the semantic information, connecting the first element of the root node to the next element with a directed edge, obtaining a global semantic directed edge, encoding the global semantic directed edge through an attention-based subgraph attention network, and obtaining contextual dialogue information; The context dialogue information is merged into a paragraph Q1 consisting of m words = {q 1j ,q 2j ,…,q mj }, a bidirectional gating mechanism is used to perform a forward and backward gating of each word q in the paragraph Q1. j Calculate the bidirectional word embedding representation and obtain the historical conversation encoding R q , whose expression is: Among them, f j-1 Indicates that by concatenating words q j The obtained bidirectional hidden state, e(q j ) indicates word q j The word embedding vector of , BiGRU() represents the bidirectional gating mechanism; According to the historical dialogue encoding R q Calculate the attention weight r of each word embedding representation in each node in the historical dialogue and node-level graph NV i α , whose expression is: in, Represents historical code R q The attention factor of node i in the node-level graph NV; Apply the aggregation function to each node i in each word to obtain the neighboring node information, and obtain the semantic structure corresponding to the dialogue information according to the attention weight.

2. According to claim 1, a Chinese dialogue knowledge retrieval method based on a knowledge retrieval graph is characterized in that: A BERT-based contextual intent recognition model is constructed for the semantic component to obtain semantic information of different levels in the semantic component, including: The semantic components are passed through the Multi-head Self-Attention module to obtain the enhanced semantic vector of the semantic text, and the Attention mechanism is used to use the information of the key words in the enhanced semantic vector to enhance the semantic representation of the target word. The expression of the Attention mechanism is: Among them, Q represents the target word in the enhanced semantic vector, K represents the key words in the context of the target word, and O represents the original value of the target word. Indicates the weight of the target word in different semantics; The enhanced semantic vectors are linearly combined in different semantic spaces to obtain weight parameters of the target word Q in different semantic spaces, and semantic information of different levels in the semantic components is obtained according to the weight parameters.

3. According to claim 2, a Chinese dialogue knowledge retrieval method based on a knowledge retrieval graph is characterized in that: Combining the existing training corpus with random speech recognition of the semantic structure, obtaining training corpus with different semantic information, including: The dialogue text in the semantic structure is serialized with characters as the basic unit, denoted as W = {w1, w2, ..., w n }, where n represents the sequence length in the dialogue text, the sequence length n is randomly deleted with probability P to obtain an ordered integer array nLeo, the expression is: in, Indicates that the product of P and n is rounded down, Random indicates a random function, Indicates the number of words that need to be deleted in the sequence; Replace the corresponding positions of the text characters in the ordered integer array nLeo with pinyin, search the vocabulary according to the pinyin, and randomly select a character to replace, generate a new training sample, and require that the selected character is different from the character to be replaced in the original sample; The new training samples and the original samples are encoded to obtain training corpus with different semantic information.

4. According to claim 3, a Chinese dialogue knowledge retrieval method based on a knowledge retrieval graph is characterized in that: The classification model is used to perform weight training on the training corpus to obtain intent classification information, including: The k intentions contained in the training corpus are numbered from 0 to k-1, expressed as Intent = {I0, I1, ..., I k-1 }, set the i-th intention I i The corresponding threshold t i ; The intention I i Convolution is performed using three different sizes of convolution kernels, intent classification is performed through the maximum pooling layer and the fully connected layer, and sigmoid is used as the activation function to independently predict the score of each intent category; The intent classification information is obtained according to the score of each intent category.

5. According to claim 4, a Chinese dialogue knowledge retrieval method based on a knowledge retrieval graph is characterized in that: The intent classification information is introduced into the word embedding matrix of the pre-trained language model and fused with the word vector in the dialogue task to obtain dialogue information, including: Initialize the intent classification information into a word embedding matrix, perform one-hot encoding on the word embedding matrix, convert the one-hot encoding into a word vector of the Transformer model, and use the pre-trained language model to obtain the trained word embedding matrix W word ; The word vectors are respectively combined with the word embedding matrix W word Multiply, generate multiple rounds of question-answering dialogues through word fusion method to obtain dialogue information.

Citation Information

Patent Citations

  • Heterogeneous graph structure multi-dialogue sentiment analysis method based on topic semantic enhancement

    CN114911932A