Standard detection method, system and equipment for providing judgment basis, medium and product
By using knowledge graphs and topic-aware graph neural networks in stance detection, the problem of lack of interpretability and background knowledge utilization in stance detection results in the existing technology is solved, and more accurate and transparent stance detection results are achieved.
Patent Information
- Application Number
- CN202410697910.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-09-17
AI Technical Summary
Existing stance detection methods are difficult to describe the semantic information of text, lack background knowledge considerations, and lack interpretability of detection results, making it difficult for users to evaluate the judgment results of the model.
It uses preset knowledge graphs and topic-aware graph neural networks to provide natural language explanations through knowledge subgraph construction and explanation path generation, enhancing the model's interpretability and background knowledge utilization.
The accuracy and transparency of stance detection are improved, making the judgment results more accurate, fine-grained and credible. Users can intuitively understand the reasoning chain and basis for judgment.
Smart Images

Figure CN118657156A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of natural language processing and artificial intelligence technology, and in particular to a stance detection method, system, electronic device, non-transitory computer-readable storage medium, and computer program product for providing a judgment basis. Background Art
[0002] With the development of society and the advancement of science and technology, the application of stance detection based on natural language processing technology or artificial intelligence technology (for example, public opinion analysis, product review mining, social media analysis, etc.) is becoming more and more widespread. The stance detection aims to automatically determine the stance of the text author on a given topic, that is, support, opposition or neutrality, so it can help governments, enterprises, etc. quickly understand the public's true views on an event or entity and gain insight into the development trend of the topic.
[0003] The existing solutions for stance detection are difficult to characterize the semantic information of the text and the detection results lack background knowledge considerations; in addition, the detection results also lack explainable information or provide limited explanatory information, making it difficult for users to evaluate the detection results. Summary of the invention
[0004] The present disclosure provides a stance detection method, system, electronic device, non-transitory computer-readable storage medium, and computer program product that provide a judgment basis, so as to solve the defects in the prior art.
[0005] The present disclosure provides a stance detection method for providing a judgment basis, comprising:
[0006] In response to receiving the target text data, based on the target text data and a pre-established knowledge graph, a knowledge subgraph associated with the target text data is established using a preset knowledge subgraph establishment rule; wherein the target text data is text data that needs to be subjected to stance detection;
[0007] Determine the stance representation vector and stance label associated with the knowledge subgraph by using a preset graph neural network; wherein the preset graph neural network has a topic-aware attention mechanism;
[0008] Determining a natural language interpretation text representing a basis for position judgment using the position representation vector;
[0009] The stance label and the natural language interpretation text are pushed to the client terminal.
[0010] The present disclosure also provides a stance detection system for providing a judgment basis, comprising:
[0011] The knowledge subgraph construction module is configured to: in response to receiving target text data, based on the target text data and a pre-established knowledge graph, establish a knowledge subgraph associated with the target text data using a preset knowledge subgraph establishment rule; wherein the target text data is text data that needs to be subjected to stance detection;
[0012] The topic perception module is configured to: determine the stance representation vector and stance label associated with the knowledge subgraph using a preset graph neural network; wherein the preset graph neural network has a topic perception attention mechanism;
[0013] An interpretative analysis module is configured to: determine a natural language interpretation text representing a basis for stance judgment using the stance representation vector;
[0014] The output module is configured to push the stance label and the natural language interpretation text to the client terminal.
[0015] The present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a position detection method providing a judgment basis as described in any one of the above is implemented.
[0016] The present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the position detection method providing a judgment basis as described in any one of the above is implemented.
[0017] The present disclosure also provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the position detection method for providing a judgment basis as described in any one of the above is implemented.
[0018] As described above, the standpoint detection method for providing a basis for judgment provided by the embodiment of the present disclosure, by integrating innovative designs such as external knowledge base, topic-aware graph neural network and knowledge subgraph interpretation, greatly enhances the interpretability of the model judgment process while improving the standpoint detection performance. In addition, the standpoint detection method can also extract background knowledge that is highly relevant to the text from the knowledge graph, and dynamically adjust the importance of knowledge according to the topic, so as to obtain accurate and fine-grained standpoint representation. At the same time, based on the generation of explanation paths and natural language descriptions of knowledge subgraphs, the reasoning chain and basis of judgments are intuitively presented, making the judgment results more transparent and credible. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present disclosure or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 It is one of the flow diagrams of the stance detection method for providing a judgment basis provided by the present disclosure;
[0021] Figure 2 This is the second flow chart of the stance detection method for providing a judgment basis provided by the present disclosure;
[0022] Figure 3 This is the third flow chart of the stance detection method for providing a judgment basis provided by the present disclosure;
[0023] Figure 4 This is the fourth flow chart of the stance detection method for providing a judgment basis provided by the present disclosure;
[0024] Figure 5 It is one of the structural schematic diagrams of the position detection device for providing a judgment basis provided by the present disclosure;
[0025] Figure 6 This is the second structural schematic diagram of the position detection device for providing a judgment basis provided by the present disclosure;
[0026] Figure 7 It is a schematic diagram of the structure of an electronic device provided by the present disclosure. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the technical solutions in the present disclosure will be clearly and completely described below in conjunction with the drawings in the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0028] Summary of the invention concept:
[0029] After research, the inventors of the present disclosure found that the reasons for the problems of the prior art are: First, the stance detection methods of the prior art are mainly based on machine learning models, such as support vector machines, naive Bayes, etc., and train binary or multi-classifiers by manually designing text features (such as word bags, parts of speech, etc.). The limitation of this type of method is that feature engineering relies on artificial experience, which makes it difficult to characterize the semantic information of the text. Second, with the development of deep learning, a series of neural network models have been introduced into the stance detection task in the prior art. These models automatically extract deep semantic features of text through end-to-end learning, which significantly improves the performance of stance detection. However, these models still mainly rely on the information of the text itself, and rarely consider the importance of external knowledge to stance judgment, which leads to the lack of background knowledge consideration in the detection results. Third, in recent years, some studies in related technologies have attempted to apply knowledge graphs to stance detection, and enhance the representation ability of the model through technologies such as entity linking and knowledge representation learning. However, most of the methods in the prior art use static knowledge representation, and the knowledge utilization is not accurate enough, and the gain effect of the knowledge graph is not fully utilized, so the detection results lack interpretable information. Fourth, traditional deep learning models are usually regarded as "black boxes", and their internal decision-making process is difficult for humans to understand. This opacity is particularly prominent in tasks involving subjective judgment. Users not only care about the judgment results of the model, but also want to understand the reasoning process and basis of the judgment to evaluate its credibility. Therefore, developing an interpretable stance detection model has become another important challenge in this field. Some existing works use attention mechanisms, feature importance analysis and other methods to try to provide explanations for the model's judgments. However, these explanations are often limited to shallow features and lack a global and semantic description of the reasoning process, resulting in limited explanatory information provided by the detection results.
[0030] In view of this, the inventors of the present disclosure considered "effectively integrating external knowledge into the stance detection model and constructing high-quality, comprehensive judgment interpretations" as the design core of the present disclosure, that is, the key problem to be solved in this field; thus, the "stance detection scheme that provides a basis for judgment" as described in the following embodiment was proposed.
[0031] Example:
[0032] The following describes the stance detection scheme for providing a judgment basis in the present disclosure in conjunction with the accompanying drawings.
[0033] Figure 1 FIG. 1 is a flow chart of a method for detecting a position that provides a basis for judgment provided by an exemplary embodiment of the present disclosure. This embodiment can be applied to electronic devices (eg, servers or cloud computing platforms), such as Figure 1 As shown, the stance detection method providing a judgment basis includes the following steps:
[0034] S110. In response to receiving the target text data, based on the target text data and a pre-established knowledge graph, a knowledge subgraph associated with the target text data is established using preset knowledge subgraph establishment rules.
[0035] The target text data is text data that needs to be subjected to stance detection.
[0036] Optionally, the pre-established knowledge graph may be stored in an external knowledge base. The external knowledge base may provide rich, structured background knowledge for the stance detection task. In this embodiment, ConceptNet may be used as the basic knowledge base. ConceptNet includes an open common sense knowledge graph, which contains a large number of concept entities and their relationships.
[0037] The execution entity of the above step S110 of the present disclosure (for example, a server or a cloud computing platform) can communicate with the terminal to which the external knowledge base belongs to obtain the pre-established knowledge graph.
[0038] Optionally, the “pre-established knowledge graph” covering a wide range of fields is constructed by using methods such as entity extraction and relationship extraction, wherein entities are represented by nodes and relationships are represented by edges.
[0039] In addition, the timeliness and domain limitations of the pre-established knowledge graph (for example, the above-mentioned ConceptNet) are taken into account. Optionally, the stance detection method also includes: using a large language model to regularly update the pre-established knowledge graph. Among them, the present disclosure does not limit the "large language model". In addition, in order to improve the query and reasoning efficiency of the knowledge base, this embodiment filters and merges the relationship types in ConceptNet. On the one hand, relationship types that are not related to the stance detection task can be removed; on the other hand, relationship types with similar semantics can be merged. In the end, 16 relationship types are retained in the knowledge base, which not only ensures the richness of knowledge, but also takes into account the efficiency of storage and calculation.
[0040] Optionally, the target text data needs to be preprocessed before being used to construct the knowledge subgraph. The preprocessing may include but is not limited to word segmentation, stop word removal, syntactic analysis, etc.
[0041] S120: Using a preset graph neural network, determine a stance representation vector and a stance label associated with the knowledge subgraph.
[0042] Among them, the preset graph neural network has a topic-aware attention mechanism.
[0043] Optionally, the network structure of the preset graph neural network may include a topic representation learning unit, a topic-aware attention calculation unit, a graph neural network reasoning unit, a pooling layer, and a classifier.
[0044] Among them, the topic representation learning unit can use a pre-trained language model (for example, BERT) to model the topic information of the input target text data to obtain a semantic representation vector of the topic. The semantic representation vector will serve as an additional input of the topic-aware attention calculation unit to guide the calculation of the attention weight. The topic-aware attention calculation unit, at each layer of its neural network, calculates the importance weight of the entity corresponding node through the attention mechanism according to the semantic relevance between the semantic representation vector of the topic and the entity corresponding node representation. The entity corresponding node with a higher weight indicates that it is more relevant to the current topic and will be given a greater weight in the message passing of the neural network. The graph neural network reasoning unit takes the structure of the knowledge subgraph and the initial entity corresponding node features as input, and uses the above-mentioned importance weight to update the hidden state of the entity corresponding node. After multi-layer propagation, the entity corresponding node representation that integrates the topic information and the structural information is obtained for the subsequent position tendency judgment task. The pooling layer pools the node representation output by the graph neural network reasoning unit to obtain a text-level position representation vector. The classifier classifies based on the position representation vector and predicts the position label of the target text data. The position label may include support, opposition, neutrality, etc. The classifier may be, for example, a softmax layer.
[0045] S130: Determine a natural language interpretation text representing a basis for stance judgment by using the stance representation vector.
[0046] In step S130, the position representation vector may be used to generate an interpretation path first, and then an interpretation text, namely the natural language interpretation text, may be generated based on the interpretation path. The specific implementation will be described below and will not be repeated here.
[0047] S140: Push the stance tag and the natural language interpretation text to the client terminal.
[0048] Among them, since the execution subject of the method in the above embodiment is generally a server, pushing the detection results to the client can facilitate user viewing, thereby improving user experience.
[0049] As described above, the standpoint detection method for providing a basis for judgment provided by the embodiment of the present disclosure, by integrating innovative designs such as external knowledge base, topic-aware graph neural network and knowledge subgraph interpretation, greatly enhances the interpretability of the model judgment process while improving the standpoint detection performance. In addition, the standpoint detection method can also extract background knowledge that is highly relevant to the text from the knowledge graph, and dynamically adjust the importance of knowledge according to the topic, so as to obtain accurate and fine-grained standpoint representation. At the same time, based on the generation of explanation paths and natural language descriptions of knowledge subgraphs, the reasoning chain and basis of judgments are intuitively presented, making the judgment results more transparent and credible.
[0050] exist Figure 1 Based on the embodiment, as an optional implementation method, refer to Figure 2 Step S110 "in response to receiving the target text data, based on the target text data and the pre-established knowledge graph, using the preset knowledge subgraph establishment rules to establish a knowledge subgraph associated with the target text data" may include the following steps:
[0051] S1110 , using preset relevance evaluation rules, determining associated entities related to the stance expression from the target text data.
[0052] As an optional example, step S1110 may be implemented in the following manner:
[0053] I), using a preset named entity recognition model, extracting initial entities and corresponding contexts from the target text data.
[0054] The present disclosure does not limit the “preset named entity recognition model”. For example, it can be spaCy. Specifically, the initial entity E and the corresponding context C can be extracted from the target text data based on spaCy.
[0055] II), using semantic similarity evaluation rules to estimate the semantic similarity between the initial entity and the corresponding context.
[0056] Optionally, a pre-trained language model (e.g., BERT) is used to obtain the vector representation V of the initial entity E E , and the corresponding vector representation V of context C C Then, the semantic similarity between the two is determined by the following cosine similarity calculation formula:
[0057]
[0058] Where Sim(E, C) represents the semantic similarity between the initial entity E and the corresponding context C; ||V E ||The vector representation V of the initial entity E EThe Euclidean norm of ||V C || The vector representation V representing the context C C The Euclidean norm of .
[0059] III), using dependency evaluation rules to estimate the dependency score between the initial entity and the corresponding context.
[0060] Define a context dependency score Dep(E, C). This score is calculated based on the syntactic position of the entity in the text and its relationship with key verbs and adjectives. By parsing the syntactic dependency tree of the text, calculate the shortest path length L from the entity to the text topic or opinion expression verb EP , and combined with the dependency distance L from the entity to the adjective EA , comprehensively calculate the context dependency score:
[0061]
[0062] Among them, α represents the weight coefficient used to adjust the influence of the shortest path length; β represents the weight coefficient used to adjust the influence of the dependency distance from the entity to the adjective.
[0063] IV), using the semantic similarity and dependency score, based on screening rules, determining the associated entity from the initial entity.
[0064] The comprehensive score Score(E, C) of entity E and its corresponding context C is obtained by weighting the semantic similarity and context dependency score, which can be expressed as follows:
[0065] Score(E,C)=γ·Sim(E,C)+δ·Dep(E,C)
[0066] Among them, γ and δ represent weight parameters, which are used to balance the influence of semantic similarity and context dependency on the final score.
[0067] As mentioned above, the scoring mechanism can effectively identify and associate entities that are highly relevant to stance expression, providing accurate input information for subsequent stance detection.
[0068] S1120. Using a preset neighborhood expansion rule, expand the neighborhood of the node corresponding to the associated entity in the pre-established knowledge graph to obtain an initial knowledge subgraph.
[0069] As an optional example, step S1120 may be implemented in the following manner:
[0070] First, in the pre-established knowledge graph, taking the node corresponding to the associated entity as the central node, based on the k-hop algorithm, the neighborhood of the node corresponding to the associated entity is expanded layer by layer through k recursive traversals to obtain the corresponding k-order neighborhood nodes.
[0071] Wherein, k represents the preset hop count threshold of the recursive traversal.
[0072] Define the knowledge graph G = (V, E), where V represents the entity set and E represents the set of relationships between entities. For the entity e identified in the text i , we hope to find the entity e in the knowledge graph G i The corresponding node v i .
[0073] Once the entity corresponding to the node v is identified i , using k-hop algorithm from v i Start by exploring its k-order neighborhood in the knowledge graph. Specifically, the algorithm will perform the following steps: Step 1): Initialize the neighborhood set and set the initial node set That is, the 0th-order neighborhood only contains the entity corresponding node itself; Step 2): Iteratively expand the k-order neighborhood, for each step k (from 1 to K, where K is the preset maximum number of hops), calculate the entity corresponding node v i The k-order neighborhood of The specific calculation formula is as follows:
[0074]
[0075] That is, the kth order neighborhood is the k-1th order neighborhood plus all neighbors with Other nodes directly connected to the node, excluding those already in The nodes in the j Indicates the entity corresponding to the node v i The neighbor entity corresponds to the node.
[0076] Then, the k-order neighboring nodes are merged to obtain an initial knowledge subgraph of the nodes corresponding to the associated entity.
[0077] Specifically, after completing the expansion of the k-order neighborhood, the neighborhood nodes of all orders are merged to obtain entity e i The initial knowledge subgraph G i :
[0078]
[0079] Among them, the initial knowledge subgraph G i Contains entity e iAll relevant entity corresponding nodes and their relationships within the K-hop neighborhood in the pre-established knowledge graph. Initial knowledge subgraph G i Provide entity i The local structural information in the pre-established knowledge graph helps subsequent models better understand and utilize entity i semantic background.
[0080] S1130 , using preset subgraph optimization rules to perform pruning optimization on the initial knowledge subgraph to obtain the knowledge subgraph.
[0081] As an optional example, step S1130 may be implemented by the following steps:
[0082] Step 1: Determine the first correlation score between each entity corresponding node in the initial knowledge subgraph and the target text data using a preset correlation scoring rule; Step 2: Sort the first correlation scores of each entity corresponding node in the initial knowledge subgraph in descending order according to the absolute value of the values to obtain a first correlation scoring sequence; Step 3: Determine the entity corresponding node sequence based on the first correlation scoring sequence; Step 4: Based on the entity corresponding node sequence, retain a preset number of entity corresponding nodes with the top rankings in the initial knowledge subgraph, and delete the remaining entity corresponding nodes.
[0083] Optionally, in order to control the size of the knowledge subgraph and improve its relevance, the initial knowledge subgraph may be pruned and optimized based on a subgraph optimization mechanism of entity relevance scoring.
[0084] Specifically, for the initial knowledge subgraph G i Each entity in corresponds to a node v j , calculate its relevance score with the original text (i.e., the input target text data) Where C represents the context representation of the input text. The calculation of the relevance score can adopt a method similar to that in step S1110, comprehensively considering the semantic similarity and context dependency between the entity corresponding node and the context representation of the text.
[0085] According to the calculated relevance score, the initial knowledge subgraph G i Prune and retain only the Top-N entities with the highest scores to obtain the optimized knowledge subgraph
[0086]
[0087] Among them, Top-N represents the operation of selecting the N nodes with the highest scores, and N is the preset subgraph scale threshold parameter.
[0088] As mentioned above, through the above-mentioned knowledge subgraph construction and optimization process, an information-rich and highly text-relevant knowledge subgraph can be generated for each identified entity, providing high-quality structured knowledge input for subsequent topic-aware graph neural network encoding, and improving the stance detection model's ability to understand and utilize background knowledge.
[0089] exist Figure 1 Based on the embodiment, as an optional implementation method, refer to Figure 3 , step S120 "using a preset graph neural network to determine a stance representation vector and a stance label associated with the knowledge subgraph" may include the following steps:
[0090] S1210: Encode the target text data using a preset language model, and extract a semantic representation vector representing a topic level.
[0091] The semantic representation vector may characterize the stance detection topic to which the target text data belongs.
[0092] The present disclosure does not limit the preset language model. For example, it can be a BERT model, which is called Bidirectional Encoder Representations from Transformers. BERT is a pre-trained language model that obtains a representation of a text containing rich semantic information, i.e., a semantic representation of the text, through large-scale unlabeled corpus training. The semantic representation of the text is then fine-tuned in a specific natural language processing (NLP) task and finally applied to the NLP task.
[0093] S1220. Based on a preset attention weight calculation rule, determine the semantic relevance score between each entity corresponding node in the knowledge subgraph and the semantic representation vector as the attention weight of the entity corresponding node.
[0094] As an optional example, S1220 may determine the attention weight using the following calculation formula:
[0095]
[0096] Among them, α ij represents the attention weight from the entity corresponding node i to the entity corresponding node j in the knowledge subgraph; e ij represents the semantic relevance score from the entity corresponding node i to the entity corresponding node j in the knowledge subgraph; i and j both represent the serial numbers of the entity corresponding nodes; u i Indicates the type of entity corresponding to node i; u jIndicates the type of entity corresponding to node j; is the embedding representation of the entity corresponding to the node i in the lth layer network of the preset graph neural network; is the embedding representation of the entity corresponding to node j in the lth layer network of the preset graph neural network; f α represents the mapping function of the preset graph neural network; N(i) represents the set of neighbor entity corresponding nodes of entity corresponding node i; t represents the semantic representation vector; || represents the vector splicing operation.
[0097] Based on the above example, the more relevant an entity is to the topic, the greater the attention weight of its corresponding node, that is, the greater the weight in the graph information transfer.
[0098] S1230. Using the attention weight of each entity corresponding node, update the hidden state of the corresponding entity corresponding node in the knowledge subgraph to obtain the stance representation vector corresponding to each entity corresponding node.
[0099] As an optional example, multi-layer graph convolution operations can be used to realize the transmission and aggregation of the information of the corresponding nodes in the knowledge subgraph, so as to obtain a stance representation that integrates the subject information and background knowledge; that is, node-level representation learning of stance tendency can be realized.
[0100] Further, based on the above example, the “stance representation” may be input into the pooling layer to obtain the stance representation vector.
[0101] S1240: Classify the stance representation vector using a preset classifier to obtain a corresponding stance label. The present disclosure does not limit the specific category of the preset classifier. For example, it may be a softmax layer. The "stance label" may include, but is not limited to, support, oppose, and neutral.
[0102] exist Figure 1 Based on the embodiment, as an optional implementation, the stance representation vector includes information representing the fusion of the embedding representation of the node corresponding to the entity in the preset graph neural network and the attention weight of the node corresponding to the entity.
[0103] exist Figure 1 Based on the embodiment, as an optional implementation method, refer to Figure 4 Step S130 "using the stance representation vector to determine a natural language interpretation text representing a stance judgment basis" may include the following steps:
[0104] S1310, based on the embedding representation of the entity corresponding node in the preset graph neural network and the attention weight of the entity corresponding node, using the gradient integration method, locate the key entity corresponding node in the knowledge subgraph that has the greatest impact on the stance classification. S1320, based on the key entity corresponding node, construct an explanation path.
[0105] As an optional example, steps S1310 to S1320 may be implemented in the following manner:
[0106] Step 1: Use the preset graph neural network to process the input target text data T to obtain the embedding representation of the corresponding node of the entity associated with the last layer of the preset graph neural network. Wherein L is the number of layers of the preset graph neural network, and n is the number of nodes corresponding to entities in the knowledge subgraph.
[0107] Step 2: Perform stance prediction based on the embedding representation of the node corresponding to the entity to obtain the stance label y corresponding to the target text data T.
[0108] Step 3: Calculate the contribution of each entity’s corresponding node to the stance prediction result.
[0109] Specifically, the integrated gradients method is used to calculate the embedding identity of the node corresponding to the entity The attributed value relative to the stance label y
[0110]
[0111] in, represents the reference point (usually a zero vector or random noise); F represents the stance prediction function; α is the integral path parameter, with a value range of [0, 1], which can be adjusted according to the attention weight α ij Determine; the attributed value A quantitative indicator that represents the influence of entity corresponding node i on stance label y.
[0112] Step 4: Sort the entity corresponding nodes according to the attribution value, and select the top-K entity corresponding nodes with the largest attribution value as the key entity corresponding nodes of the explanation path. Assume that the selected key entity corresponding node set is P = v1, v2, ..., v K .
[0113] Step 5: Search the knowledge subgraph for the shortest path between nodes in the node set P corresponding to the key entity, and obtain the explanation path connecting these nodes.
[0114] Assume that the final interpretation path is E = e1, e2, ..., eM , where e1, e2, ..., e M Each of represents an edge in the path, and M is the path length.
[0115] As mentioned above, the output information of the preset graph neural network can be used to extract a key entity path that has the greatest impact on the stance prediction result from the knowledge subgraph, forming a high-level abstract representation of the stance detection decision process; and this structured interpretation path provides the basis for the subsequent generation of natural language interpretations.
[0116] S1330. Based on the interpretation path and the pre-established knowledge graph, using a preset natural language generation model, output the natural language interpretation text.
[0117] As an optional example, step S1330 may be implemented in the following manner:
[0118] Step ①: First, map the explanation path E back to the pre-established knowledge graph to obtain the relationship description r1, r2, ..., e corresponding to each edge in the path. M , where r i Represents the entity relationship text description corresponding to the “i-th edge”. Then, the relationship description is preprocessed, including word segmentation, stop word removal, etc., to obtain the keyword sequence w corresponding to each relationship description i 1, w i 2, ..., w i L, where L is the length of the keyword sequence.
[0119] Step ②: Use the pre-trained language model (such as BERT, GPT, etc.) to learn the text representation of the keyword sequence of each relationship description to obtain the semantic embedding vectors σ1, σ2, ..., σ M ; where σ i Corresponding to the i-th relationship description r i The semantic embedding representation of .
[0120] Step 3: Design an attention-based explanation generation model, using the semantic embedding vectors σ1, σ2, ..., σ M As input, generate natural language interpretation text.
[0121] Specifically, the explanation generation model based on the attention mechanism can adopt a sequence-to-sequence (Seq2Seq) model based on the Transformer architecture; the Seq2Seq may include an encoder and a decoder.
[0122] The encoder may use a multi-head self-attention mechanism to encode the semantic embedding vector of the relationship description, capture the semantic dependency between the relationship descriptions, and obtain the encoded context representations h1, h2, ..., h M .
[0123] The decoder can use a multi-head attention mechanism to decode the output of the encoder and introduce the explanation path information as an additional attention input to enhance the coherence and causality of the explanation. At each decoding step t, the decoder embeds y according to the current generated word t-1 , encoder output h1, h2, ..., h M And explain the path E and calculate the attention weight distribution:
[0124] α t =softmax(W a [y t-1 ;h1;h2;...;h M ; E])
[0125] Among them, W a represents the attention weight matrix, and [;] represents the vector concatenation operation.
[0126] According to the attention weight distribution, the context vector c of the decoder at step t is calculated t :
[0127]
[0128] Finally, the decoder is based on the context vector c t and the current decoding state, generating the probability distribution of the next word until a complete interpretation text is generated.
[0129] Step ④: Post-process the generated explanation text, such as replacing proper nouns, smoothing grammatical structures, etc., to improve the readability and fluency of the explanation.
[0130] Step 5: Output the final natural language interpretation text.
[0131] As mentioned above, the attention-based explanation generation model can be used to convert the structured explanation path into an explanation text in natural language. In this example, not only the semantic information of the relationship description is considered, but also the structural information of the explanation path is introduced, so that the generated explanation can reflect the causal relationship and logical reasoning process between entities. At the same time, the introduction of the attention mechanism enables the model to dynamically focus on different relationship descriptions and generate more coherent and context-related explanation text.
[0132] Based on the analysis of the above embodiments, the stance detection method for providing a judgment basis described in the present disclosure has at least the following technical advantages:
[0133] First, by introducing an external knowledge base, using ChatGPT to expand knowledge, and using topic-aware graph neural networks for knowledge representation learning, the model's ability to understand text semantics and background knowledge is enhanced. Experiments show that the fusion of knowledge can effectively improve indicators such as the accuracy, precision, and recall rate of stance detection, especially in texts involving complex semantics and implicit attitudes, and has obvious advantages.
[0134] Second, by locating the key entity path, the reasoning chain of the judgment is revealed; and the attention generation model is used to convert it into a coherent and easy-to-understand natural language explanation. Compared with traditional methods such as attention visualization, the explanation generated by the stance detection method of this embodiment is more comprehensive and more in line with human logic, making the judgment process clear and transparent, and greatly enhancing the user's understanding and trust in the judgment results.
[0135] Third, the k-hop algorithm is used to mine text-related knowledge subgraphs in a targeted manner, overcoming the problems of generalization and inaccuracy of knowledge utilization in traditional methods. At the same time, a scoring mechanism based on comprehensive semantic similarity and syntactic dependency is used to optimize and prune subgraphs, further improving the accuracy of knowledge utilization and providing higher-quality background knowledge support for stance detection.
[0136] Fourth, by introducing topic information to dynamically adjust the importance of entities in the graph, the model's adaptability to different topics is enhanced. For new topics, only the representation of the topic needs to be learned to automatically optimize the entity weights without retraining the model. This adaptive ability makes the model more generalizable and can flexibly cope with changing stance detection tasks.
[0137] Fifth, the knowledge graph in the external knowledge base can be dynamically expanded or updated through large language models such as ChatGPT. Specifically, when new hot events or topics emerge, relevant knowledge can be quickly absorbed and the knowledge graph can be expanded, so that stance detection can keep up with current hot topics and provide more real-time and accurate analysis results.
[0138] In summary, the stance detection method for providing a basis for judgment provided by the embodiment of the present disclosure, by integrating innovative designs such as external knowledge base, topic-aware graph neural network and knowledge subgraph interpretation, improves the performance of stance detection while greatly enhancing the interpretability of the model judgment process. In addition, the stance detection method can also extract background knowledge that is highly relevant to the text from the knowledge graph, and dynamically adjust the importance of knowledge according to the topic, thereby obtaining an accurate and fine-grained stance representation. At the same time, based on the generation of explanation paths and natural language descriptions of knowledge subgraphs, the reasoning chain and basis of judgments are intuitively presented, making the judgment results more transparent and credible.
[0139] The position detection device for providing a judgment basis provided by the present disclosure is described below. The position detection device for providing a judgment basis described below and the position detection method for providing a judgment basis described above can be referred to each other.
[0140] Figure 5 FIG. 1 is a schematic diagram of a structure of a position detection device providing a judgment basis provided by an exemplary embodiment of the present disclosure. Figure 5 As shown, the position detection device providing the judgment basis includes:
[0141] The knowledge subgraph construction module 510 is configured to: in response to receiving the target text data, based on the target text data and the pre-established knowledge graph, use the preset knowledge subgraph establishment rules to establish a knowledge subgraph associated with the target text data; wherein the target text data is text data that needs to be subjected to stance detection; the topic perception module 520 is configured to: use the preset graph neural network to determine the stance representation vector and stance label associated with the knowledge subgraph; wherein the preset graph neural network has a topic-aware attention mechanism; the explanatory analysis module 530 is configured to: use the stance representation vector to determine the natural language interpretation text that represents the basis for stance judgment; the output module 540 is configured to: push the stance label and the natural language interpretation text to the client terminal.
[0142] exist Figure 5 Based on the embodiment, as an optional implementation method, refer to Figure 6 , the position detection device can also be divided into:
[0143] The data acquisition and preprocessing module is used to clean the target text data to obtain the research data set, and then extract the subject of the research data set to obtain the main topic;
[0144] The knowledge graph completion module is used to construct knowledge graph completion information based on the ConceptNet5 model;
[0145] The knowledge subgraph acquisition module is used to construct the knowledge subgraph based on the research data set and the knowledge graph completion information to obtain the knowledge subgraph;
[0146] The external knowledge integration module is used to utilize the knowledge subgraph and the attention-based explanation generation model (including encoder, decoder, and Softmax classifier) to output the stance probability.
[0147] The model interpretability evaluation module is used to give reasonable explanation text (for example, Figure 6The SHAP explanation and KSE explanation shown in FIG. 1 are used to evaluate the explained text according to the explanation index. The explanation index may include, for example, output quality index, perceived usability, perceived ease of use, etc.
[0148] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute a stance detection method for providing a judgment basis, the method comprising: in response to receiving target text data, based on the target text data and a pre-established knowledge graph, using a preset knowledge subgraph establishment rule to establish a knowledge subgraph associated with the target text data; wherein the target text data is text data that needs to be stance detected; using a preset graph neural network to determine a stance representation vector and a stance label associated with the knowledge subgraph; wherein the preset graph neural network has a topic-aware attention mechanism; using the stance representation vector to determine a natural language interpretation text representing a stance judgment basis; pushing the stance label and the natural language interpretation text to the client terminal.
[0149] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0150] On the other hand, the present disclosure also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the stance detection method for providing a judgment basis provided by the above-mentioned methods, and the method includes: in response to receiving target text data, based on the target text data and a pre-established knowledge graph, using a preset knowledge subgraph to establish rules, and establishing a knowledge subgraph associated with the target text data; wherein the target text data is text data that needs to be stance detected; using a preset graph neural network, determining a stance representation vector and a stance label associated with the knowledge subgraph; wherein the preset graph neural network has a topic-aware attention mechanism; using the stance representation vector, determining a natural language interpretation text that represents the stance judgment basis; and pushing the stance label and the natural language interpretation text to a client terminal.
[0151] On the other hand, the present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the stance detection method for providing a basis for judgment provided by the above-mentioned methods, the method comprising: in response to receiving target text data, based on the target text data and a pre-established knowledge graph, using a preset knowledge subgraph to establish rules, and establishing a knowledge subgraph associated with the target text data; wherein the target text data is text data that requires stance detection; using a preset graph neural network, determining a stance representation vector and a stance label associated with the knowledge subgraph; wherein the preset graph neural network has a topic-aware attention mechanism; using the stance representation vector, determining a natural language interpretation text representing a basis for stance judgment; and pushing the stance label and the natural language interpretation text to a client terminal.
[0152] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0153] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0154] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A stance detection method for providing a judgment basis, comprising: In response to receiving the target text data, based on the target text data and a pre-established knowledge graph, a knowledge subgraph associated with the target text data is established using a preset knowledge subgraph establishment rule; wherein the target text data is text data that needs to be subjected to stance detection; Determine the stance representation vector and stance label associated with the knowledge subgraph by using a preset graph neural network; wherein the preset graph neural network has a topic-aware attention mechanism; Determining a natural language interpretation text representing a basis for position judgment using the position representation vector; The stance label and the natural language interpretation text are pushed to the client terminal.
2. The position detection method according to claim 1, characterized in that: In response to receiving the target text data, based on the target text data and a pre-established knowledge graph, using a preset knowledge subgraph establishment rule to establish a knowledge subgraph associated with the target text data, includes: Determining, from the target text data, associated entities related to the position expression using a preset relevance evaluation rule; Using a preset neighborhood expansion rule, the neighborhood of the node corresponding to the associated entity is expanded in the pre-established knowledge graph to obtain an initial knowledge subgraph; The initial knowledge subgraph is pruned and optimized using a preset subgraph optimization rule to obtain the knowledge subgraph.
3. The position detection method according to claim 2, characterized in that: The determining of the associated entities related to the stance expression from the target text data by using the preset relevance evaluation rules includes: Using a preset named entity recognition model, extracting initial entities and corresponding contexts from the target text data; Using a semantic similarity evaluation rule, estimating the semantic similarity between the initial entity and the corresponding context; Using dependency evaluation rules, estimating a dependency score between the initial entity and the corresponding context; Determine the associated entity from the initial entity based on a screening rule by using the semantic similarity and the dependency score; The method of using a preset neighborhood expansion rule to expand the neighborhood of the node corresponding to the associated entity in the pre-established knowledge graph to obtain an initial knowledge subgraph includes: In the pre-established knowledge graph, the node corresponding to the associated entity is taken as the central node, and based on the k-hop algorithm, the neighborhood of the node corresponding to the associated entity is expanded layer by layer through k recursive traversals to obtain the corresponding k-order neighborhood node; wherein k represents the preset hop count threshold of the recursive traversal; Merging the k-order neighboring nodes to obtain an initial knowledge subgraph of the nodes corresponding to the associated entity; The step of performing pruning optimization on the initial knowledge subgraph by using a preset subgraph optimization rule to obtain the knowledge subgraph includes: Determine a first correlation score between each entity corresponding node in the initial knowledge subgraph and the target text data by using a preset correlation scoring rule; The first relevance scores of the nodes corresponding to the entities in the initial knowledge subgraph are sorted in a descending order according to the absolute values to obtain a first relevance score sequence; Based on the first relevance score sequence, determine an entity corresponding node sequence; based on the entity corresponding node sequence, retain a preset number of entity corresponding nodes with top rankings in the initial knowledge subgraph, and delete the remaining entity corresponding nodes.
4. The position detection method according to claim 1, characterized in that: The using of a preset graph neural network to determine a stance representation vector and a stance label associated with the knowledge subgraph; Using a preset language model, the target text data is encoded to extract a semantic representation vector representing a topic level; Based on a preset attention weight calculation rule, determining a semantic relevance score between each entity corresponding node in the knowledge subgraph and the semantic representation vector as an attention weight of the entity corresponding node; Using the attention weight of each entity corresponding node, the hidden state of the corresponding entity corresponding node in the knowledge subgraph is updated to obtain the stance representation vector corresponding to each entity corresponding node; The stance representation vector is classified using a preset classifier to obtain a corresponding stance label.
5. The position detection method according to claim 1, characterized in that: The stance representation vector includes information representing the fusion of the embedding representation of the entity corresponding node in the preset graph neural network and the attention weight of the entity corresponding node; The step of using the stance representation vector to determine a natural language interpretation text representing a stance judgment basis includes: Based on the embedded representation of the entity corresponding node in the preset graph neural network and the attention weight of the entity corresponding node, the key entity corresponding node in the knowledge subgraph that has the greatest impact on the stance classification is located using the gradient integration method; Constructing an explanation path based on the key entity corresponding nodes; Based on the interpretation path and the pre-established knowledge graph, the natural language interpretation text is output using a preset natural language generation model.
6. The position detection method according to any one of claims 1 to 5, characterized in that: The stance detection method further includes: The pre-established knowledge graph is updated regularly using a large language model.
7. A position detection system for providing a judgment basis, comprising: The knowledge subgraph construction module is configured to: in response to receiving target text data, based on the target text data and a pre-established knowledge graph, establish a knowledge subgraph associated with the target text data using a preset knowledge subgraph establishment rule; wherein the target text data is text data that needs to be subjected to stance detection; The topic perception module is configured to: determine the stance representation vector and stance label associated with the knowledge subgraph using a preset graph neural network; wherein the preset graph neural network has a topic perception attention mechanism; An interpretative analysis module is configured to: determine a natural language interpretation text representing a basis for stance judgment using the stance representation vector; The output module is configured to push the stance label and the natural language interpretation text to the client terminal.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the position detection method providing a judgment basis as claimed in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the position detection method providing a judgment basis as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the position detection method providing a judgment basis as claimed in any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Comment climate change site detection method based on mixed attention and label diffusion
CN119646230A
Process industry safety knowledge graph error detection method and system based on large language model
CN119740644A
Long-sequence dialogue site detection method combining inference chain and multi-prototype comparison
CN120929606A
A long-sequence dialogue stance detection method combining inference chain and multi-prototype contrast
CN120929606B
Variable-granularity area vertical field aggregation measurement method and system
CN120930886A
