Detection method and device for interactive recognition of intention based on dual-channel attention network
Through the dual-channel attention network method, combined with the parallel processing of emotion graphs and syntax graphs and dynamic interaction fusion, the problem of limited accuracy of satire detection in the existing technology is solved, and a more efficient satire detection effect is achieved.
Patent Information
- Application Number
- CN202411119215.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-08-15
AI Technical Summary
Existing automatic satire detection methods ignore text structure and contextual information when understanding satire, have limited identification accuracy, and fail to effectively utilize deep learning technology, making it difficult to deal with the subtlety and obscureness of satire.
Using a dual-channel attention network method, the parallel processing and dynamic interaction fusion of emotion graphs and syntactic graphs are used to carry out ironic classification judgments, and the dynamic interaction mechanism of emotion channels and syntactic channels are used to capture complex relationships in text. and semantic structure.
It significantly improves the accuracy and efficiency of satire detection, can analyze language complexity more deeply, effectively recognize and analyze complex language expressions, and improves the accuracy and reliability of automatic satire detection.
Smart Images

Figure CN118644869B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to but are not limited to the field of machine learning technology, and in particular to a detection method and device for interactively identifying intentions based on a dual-channel attention network. Background Art
[0002] Most existing automatic sarcasm detection methods rely on traditional text analysis methods to detect sarcasm by identifying sentiment oppositions in text, such as the co-occurrence of highly positive and highly negative sentiment words in a sentence. Existing detection methods have the following disadvantages:
[0003] (1) Limited applicable scenarios. Understanding sarcasm may require analyzing the structure of the entire sentence or paragraph, understanding the logic and relationship between the various components, and the relationship between the text and its speaking context. However, existing methods are effective in certain situations, but often ignore the structural and contextual information in the text, which is crucial for a comprehensive understanding of sarcasm;
[0004] (2) Limited recognition accuracy. Existing methods have difficulty handling the subtlety and obscurity of sarcasm, especially when it is not obvious that sarcasm is integrated into daily language use;
[0005] (3) Failure to apply new recognition techniques. Existing methods effectively leverage recent advances in machine learning, such as deep learning techniques, which have been shown to perform well in other complex language processing tasks. These deep learning models, especially those that can process sequential data and capture long-range dependencies, such as recurrent neural networks (RNNs) and attention mechanisms.
[0006] How to overcome the above defects and perform accurate and efficient sarcasm detection has become an urgent problem to be solved. Summary of the invention
[0007] In view of the above problems existing in the prior art, the present invention proposes a detection method and device based on a dual-channel attention network interactive recognition intention, which significantly improves the accuracy and efficiency of sarcasm detection by combining the semantic and structural information of the text. The technical solution adopted in this application is as follows:
[0008] In the first aspect, a detection method for interactively identifying intentions based on a dual-channel attention network comprises the following steps:
[0009] S1. Segment the acquired text data to be detected, construct a corresponding vocabulary according to the segmentation result, generate a feature vector for each word in the vocabulary through a word vector model, and form a feature matrix; generate a sentiment graph and a syntactic graph based on the feature matrix, and input them into a dual-channel graph attention network model;
[0010] S2, the dual-channel graph attention network model processes the sentiment graph and the syntactic graph in parallel to generate a sentiment feature vector and a syntactic structure feature vector, and realizes the dynamic interactive fusion of the sentiment feature vector and the syntactic structure feature vector through a gating mechanism; based on the fused feature vector, the classification judgment of the satirical intention is performed through deep learning, and the final classification judgment result is output;
[0011] In the above step S1, the sentiment graph is constructed using a dynamic edge weight method. The sentiment graph is constructed based on sentiment scores and intensity differences between words, reflecting the overall sentiment tendency of the text and its dynamic intensity that changes with the text content;
[0012] The syntactic graph is constructed based on the dependency relationship between words, reflects the semantic dependency and syntactic structure of the text, and defines the connection between vocabulary nodes.
[0013] Furthermore, the sentiment graph and the syntactic graph are processed in parallel to generate a sentiment feature vector and a syntactic structure feature vector, specifically including:
[0014] The sentiment channel in the dual-channel graph attention network model uses the sentiment adjacency matrix to analyze the sentiment information in the text data to extract sentiment features, and uses the graph attention network to perform in-depth sentiment analysis on the text data through the input sentiment graph, and extracts key sentiment features and generates sentiment feature vectors by learning the dynamic relationship between different vocabulary nodes;
[0015] The syntactic channel in the dual-channel graph attention network model uses a grammatical adjacency matrix to analyze the grammatical information of the text data to extract syntactic structure features. Through the incoming syntactic graph, the graph attention network is used to perform dependency syntactic analysis on the text data to construct a syntactic dependency tree, extract key syntactic features and convert them into syntactic structure feature vectors that can express the deep syntactic functions of the entire sentence.
[0016] Furthermore, the dynamic interactive fusion of the emotional feature vector and the syntactic structure feature vector is realized through a gating mechanism, which specifically includes:
[0017] The dynamic interaction layer in the dual-channel graph attention network model calculates the cross-channel attention coefficient for the sentiment feature vector and the syntactic structure feature vector of each vocabulary node; the proportion of dynamic interaction fusion is dynamically adjusted through the gated attention mechanism to ensure that each channel maintains feature independence when considering information from the other channel, thereby realizing the dynamic interaction fusion of the sentiment feature vector and the syntactic structure feature vector.
[0018] In the second aspect, a detection device for interactively identifying intention based on a dual-channel attention network comprises a data receiving module and a dual-channel graph attention network model; the dual-channel graph attention network model comprises a sentiment analysis module, a syntactic analysis module and a dynamic interaction module;
[0019] The data receiving module is used to segment the acquired text data to be detected, construct a corresponding vocabulary according to the segmentation result, generate a feature vector for each word in the vocabulary through a word vector model to form a feature matrix; generate a sentiment graph and a syntactic graph based on the feature matrix, and input them into a dual-channel graph attention network model;
[0020] The dual-channel graph attention network model is used to process the sentiment graph and the syntactic graph in parallel to generate a sentiment feature vector and a syntactic structure feature vector, and to achieve dynamic interactive fusion of the sentiment feature vector and the syntactic structure feature vector through a gating mechanism; based on the fused feature vector, classification and judgment of the sarcastic intention are performed through deep learning, and the final classification judgment result is output.
[0021] Furthermore, the sentiment graph is constructed using a dynamic edge weight method, and the sentiment graph is constructed based on sentiment scores and intensity differences between words, reflecting the overall sentiment tendency of the text and its dynamic intensity that changes with the text content;
[0022] The syntactic graph is constructed based on the dependency relationship between words, reflects the semantic dependency and syntactic structure of the text, and defines the connection between vocabulary nodes.
[0023] Furthermore, the sentiment graph and the syntactic graph are processed in parallel to generate a sentiment feature vector and a syntactic structure feature vector, specifically including:
[0024] The sentiment analysis module uses the sentiment adjacency matrix to analyze the sentiment information in the text data to extract sentiment features, uses the graph attention network to perform in-depth sentiment analysis on the text data through the incoming sentiment graph, and extracts key sentiment features and generates sentiment feature vectors by learning the dynamic relationship between different vocabulary nodes;
[0025] The syntactic analysis module uses a grammatical adjacency matrix to analyze the grammatical information of text data to extract syntactic structure features. Through the incoming syntactic graph, the graph attention network is used to perform dependency syntactic analysis on the text data to construct a syntactic dependency tree, extract key syntactic features and convert them into syntactic structure feature vectors that can express the deep syntactic functions of the entire sentence.
[0026] Furthermore, the dynamic interactive fusion of the emotional feature vector and the syntactic structure feature vector is realized through a gating mechanism, which specifically includes:
[0027] The dynamic interaction module calculates the cross-channel attention coefficient for the sentiment feature vector and the syntactic structure feature vector of each vocabulary node; dynamically adjusts the proportion of dynamic interaction fusion through the gated attention mechanism to ensure that each channel maintains feature independence when considering information from the other channel, thereby realizing the dynamic interaction fusion of the sentiment feature vector and the syntactic structure feature vector.
[0028] In a third aspect, an electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the computer program.
[0029] According to a fourth aspect, a computer-readable medium is provided, wherein the computer-readable storage medium stores a computer-executable program, and the computer-executable program is used to cause a computer to execute the method according to the first aspect.
[0030] Through the embodiments of the present application, the following technical effects can be obtained: the present application is widely used in the fields of content monitoring, social media analysis, and online interactive systems, and can comprehensively utilize the sentiment, semantics, syntactic structure, and contextual information of the text, and can more deeply parse and understand the complexity of the language through a dynamically interactive dual-channel graph attention network model, effectively identify and analyze complex language expressions, and improve the accuracy and reliability of automatic sarcasm detection technology, demonstrating good application potential and commercial value.
[0031] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction is given below to the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0033] Figure 1 A schematic diagram of the framework of the dynamic interactive dual-channel graph attention network model;
[0034] Figure 2 Schematic diagram of the detection method. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0036] It should be understood that in the description of the embodiments of the present application, the meaning of multiple (or multiple) is more than two, greater than, less than, and exceeding are understood to exclude the number itself, and above, below, and within are understood to include the number itself. If there is a description of "first", "second", etc., it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0037] The present application relates to the fields of natural language processing (NLP) and machine learning, and in particular to automatic semantic analysis technology for Chinese texts.
[0038] Sarcasm is a common and complex form of language expression. It implies criticism through superficial praise or conveys true affirmation through literal negation, so its true meaning is often the opposite of the literal meaning. This language phenomenon is widely present in daily communication, literary creation, and even in media reports, adding rich but complex emotional colors to human communication. However, this reversal of meaning and deep context dependence make automatic detection of sarcasm a major challenge in the field of natural language processing (NLP).
[0039] In the field of natural language processing, especially in the task of sarcasm detection, existing English sarcasm detection usually relies on deep learning methods such as convolutional neural networks (CNNs) and long short-term memory networks (LSTMs). These models have shown good results in processing the literal meaning and direct contextual relationships of English texts, but they are often limited in capturing more complex semantic dependencies and subtle contextual changes. For Chinese, due to its unique language structure and complex semantic relationships, it is often difficult to achieve ideal results using traditional deep learning models alone. Therefore, we chose the Graph Attention Network (GAT) model because the core advantage of GAT is that it can dynamically allocate attention weights between nodes, thereby effectively capturing and processing complex relationships and deep dependencies in text data. This property makes GAT particularly suitable for processing implicit sarcastic intentions in Chinese texts, as this often involves parsing more obscure and indirect emotional expressions and syntactic structures. In addition, to further adapt to the special needs of Chinese, we performed in-depth semantic analysis and sentiment analysis on Chinese data before inputting the model. This includes using natural language processing tools for advanced word segmentation and syntactic dependency analysis, as well as sentiment scoring and sentiment polarity analysis of vocabulary. These preprocessing steps are not built-in to the GAT model, but are specially designed to enhance the model's adaptability to Chinese language characteristics. In the implementation of the model, we innovatively introduced a dynamic interactive dual-channel structure, where one channel processes sentiment analysis and the other processes syntactic analysis. These two channels not only learn independently, but also interact with each other through a specially designed gated attention mechanism, adjusting each other's contribution in real time to optimize the overall feature extraction.
[0040] This application proposes a method for automatically detecting sarcastic intent in Chinese text using Graph Attention Networks (GAT). Sarcasm detection is a complex task in natural language processing because it involves understanding the implicit non-literal meaning in the text, which usually relies on the deep semantics and contextual information of the text. In order to effectively deal with these problems, this application adopts the advanced deep learning technology of graph attention network. Graph attention network is a network model that can dynamically allocate attention weights between nodes to capture node relationships, which enables the model to better understand and process complex relationships in text data, such as semantic dependencies and syntactic structures. Through this method, this application can significantly improve the accuracy and efficiency of Chinese sarcasm detection, thereby providing support for natural language processing applications such as content review, sentiment analysis, and robot dialogue systems. The technical solution of this application is introduced in detail below.
[0041] In a first aspect, the present invention proposes a detection method for interactive recognition intention based on a dual-channel attention network, the method comprising the following steps:
[0042] S1. Segment the acquired text data to be detected, construct a corresponding vocabulary according to the segmentation result, generate a feature vector for each word in the vocabulary through a word vector model, and form a feature matrix; generate a sentiment graph and a syntactic graph based on the feature matrix, and input them into a dual-channel graph attention network model;
[0043] In the above steps, the user or system operator inputs the text data to be detected (Chinese text, English text) into the detection device; the input method may include manual input through the user interface, or importing from the data source (such as social media platforms, news websites, etc.) through an automated system; the feature matrix formed provides node features for the construction of the sentiment graph and the syntactic graph.
[0044] In the above steps, generating a sentiment graph and a syntactic graph based on the feature matrix respectively includes:
[0045] (1) Generation of sentiment graph
[0046] By adopting the dynamic edge weight method to generate the sentiment graph, the dual-channel graph attention network model can better help identify the complex sentiment model in sarcastic expressions in the subsequent deep feature extraction. The so-called dynamic edge weight means that the edge weight is not static, but is dynamically calculated based on the sentiment score of the connected nodes. The specific process is as follows:
[0047] Assume two nodes The sentiment scores are and ,in and The difference or absolute value difference of their sentiment scores is calculated by using the Hanlp sentiment analysis tool. As a factor in the edge weight, this difference reflects the contrast in sentiment strength between the two words. If A and B have the same sentiment polarity (i.e. both positive or both negative), the weights don't need much adjustment. But if they have opposite polarities (one positive, one negative), this contrast may mean a stronger emotional conflict or irony, so a larger weight should be given.
[0048] For the dynamic allocation of weights, first calculate the basic weight between two nodes , based on the absolute difference of their sentiment scores:
[0049] ;
[0050] in, Represents the adjustment coefficient, which is used to control the impact of sentiment intensity differences on the weight.
[0051] Next, polarity contrast adjustment will be performed If two nodes The sentiment polarity of the two is opposite (one positive and one negative), an additional weight is added :if ,but , otherwise 0. is a constant, and the additional weight added when the emotional polarity is opposite is used to emphasize the emotional contrast. In summary, the comprehensive emotional weight value is finally obtained , the calculation formula is as follows:
[0052] ;
[0053] The comprehensive sentiment weight value obtained through the above dynamic edge weight calculation not only reflects the difference in sentiment intensity, but also takes into account the contrast in sentiment polarity and the contextual relationship of words.
[0054] The sentiment graph is constructed by adopting the dynamic edge weight method, which includes:
[0055] 1) Constructing a basic sentiment graph structure including a plurality of sentiment nodes according to the feature matrix of the text data, wherein each sentiment node represents a word in the text data, and the sentiment node includes the sentiment score of the word.
[0056] 2) For two emotion nodes in the basic emotion graph structure, the difference in emotion scores between them is calculated, and according to the difference in emotion scores, a dynamic weight is assigned to the edge formed by the two emotion nodes; the dynamic weight is linear or nonlinear, and is used to reflect the interaction of the emotion intensity between the two emotion nodes;
[0057] 3) Based on the relationship of the sentiment scores between the sentiment nodes, a type (e.g., “sympathy” or “opposition”) is assigned to the edge formed by two sentiment nodes, and a sentiment graph is formed.
[0058] By assigning types to each sentiment node in the sentiment graph, the dual-channel graph attention network model can better understand the sentiment contrast and subtle differences between words in text data during subsequent deep feature extraction.
[0059] (2) Generation of syntactic graph
[0060] Assume that the input text data is , where i={1,2,...N}, each It is a word in a sentence.
[0061] The sentence is parsed by the HanLP syntactic analyzer Perform syntactic analysis for each sentence Building a dependency graph ,in is a set of nodes, corresponding to the words in the sentence, is a set of directed edges, representing the dependency relationship between words. , whose adjacency matrix according to It is calculated that if the node Point to Node ,but ,otherwise .
[0062] By generating and analyzing a sentiment graph, which is constructed based on sentiment scores and intensity differences between words, it reflects the overall sentiment tendency of the text and its dynamic intensity as the text content changes; by generating and analyzing a syntactic graph, which is constructed based on the dependency between words, it reflects the semantic dependency and syntactic structure of the text and defines the connection between nodes. Based on the in-depth analysis of the above sentiment graph and syntactic graph, it can not only handle complex relationships in text data, such as semantic dependency and syntactic structure, but also effectively improve the accuracy and efficiency of Chinese sarcastic intent detection through dynamic edge weights and gated attention mechanisms.
[0063] In the above steps, the text data required by the dual-channel GAT with dynamic interaction model is processed, and then it is passed to the model for deep feature extraction. The framework of the network model is as follows Figure 1 As shown, it includes emotional channel, syntactic channel and dynamic interaction layer.
[0064] S2, the dual-channel graph attention network model processes the sentiment graph and the syntactic graph in parallel to generate a sentiment feature vector and a syntactic structure feature vector, and realizes the dynamic interactive fusion of the sentiment feature vector and the syntactic structure feature vector through a gating mechanism; based on the fused feature vector, the classification judgment of the satirical intention is performed through deep learning, and the final classification judgment result is output;
[0065] In the above steps, the sentiment graph and the syntactic graph are processed in parallel to generate a sentiment feature vector and a syntactic structure feature vector, specifically including:
[0066] The sentiment channel in the dual-channel graph attention network model uses the sentiment adjacency matrix to analyze the sentiment information in the text data to extract sentiment features, and uses the graph attention network to perform in-depth sentiment analysis on the text data through the input sentiment graph, and extracts key sentiment features and generates sentiment feature vectors by learning the dynamic relationship between different vocabulary nodes;
[0067] Among them, the sentiment adjacency matrix is a matrix that represents the relationship between vocabulary nodes, in which each element represents the sentiment relationship or weight between two vocabulary nodes. This matrix is used to capture the sentiment connection between words in the text. The sentiment graph is a graph structure built based on the sentiment adjacency matrix, in which nodes represent words and edges represent the sentiment relationship between words. The sentiment graph reflects the sentiment intensity and relationship between words through the weights of the sentiment adjacency matrix. The Graph Attention Network (GAT) is a neural network model for graph data. It learns the relationship and weight between nodes through the attention mechanism to extract key features. The graph attention network can dynamically adjust the weights between nodes to capture complex relationships.
[0068] The syntactic channel in the dual-channel graph attention network model uses a grammatical adjacency matrix to analyze the grammatical information of the text data to extract syntactic structure features, and uses the graph attention network to perform dependency syntactic analysis on the text data through the incoming syntactic graph to construct a syntactic dependency tree, extract key syntactic features and convert them into syntactic structure feature vectors that can express the deep syntactic function of the entire sentence;
[0069] The syntactic dependency tree is used to display the dependency relationship between each word in the text data and identify the syntactic structure features of the text data; the syntactic structure features include subject-predicate-object structure features, attributive structure features and adverbial structure features.
[0070] In the above steps, the dynamic interactive fusion of the emotional feature vector and the syntactic structure feature vector is realized through a gating mechanism, which specifically includes:
[0071] The dynamic interaction layer in the dual-channel graph attention network model calculates the cross-channel attention coefficient for the sentiment feature vector and the syntactic structure feature vector of each vocabulary node; the proportion of dynamic interaction fusion is dynamically adjusted through the gated attention mechanism to ensure that each channel maintains feature independence when considering information from the other channel, thereby realizing the dynamic interaction fusion of the sentiment feature vector and the syntactic structure feature vector;
[0072] In the above steps, the cross-channel attention coefficient is calculated for the features of each node in the sentiment analysis channel and the syntactic analysis channel, where the attention coefficient of the sentiment channel takes into account the node information from the syntactic channel, and vice versa; the information flow is dynamically adjusted through the gated attention mechanism to ensure that each channel maintains feature independence when considering information from the other channel. Specifically, each channel is equipped with a gated unit to dynamically adjust the information flow according to the importance of the other channel information in the current context; when updating the node representation, the weighted cross-channel features are considered, and finally the feature vectors of the sentiment and syntactic channels are fused for binary classification training of ironic intent. In addition, the dynamic interaction layer uses a gated attention mechanism composed of a bidirectional gated recurrent unit combined with an attention mechanism to learn and adapt to the characteristics of different text data; the gated attention mechanism analyzes the sentiment and grammatical feature vectors, evaluates the needs of the current text data, and adjusts the fusion ratio of the sentiment feature vector and the syntactic structure feature vector in real time according to the relevance and contribution of these features, thereby optimizing the sentiment and grammatical analysis of the text data.
[0073] The above sentiment channel uses a graph attention network to consider the context of each word and its importance in the text when processing text. In particular, this mechanism helps the model capture subtle sentiment oppositions and semantic contradictions when identifying sarcastic intent. The above syntactic channel uses a graph attention network to process these structural data, extract key syntactic features, and convert these features into vectors that can express the deep syntactic function of the entire sentence; the syntactic channel can identify the main dependency relationships in the sentence, such as the subject-verb-object structure, thereby revealing the deep grammatical function of the sentence and helping the sentiment analysis module understand complex syntactic structures and implicit semantic relationships.
[0074] Next, we will introduce in detail the training process, parameter settings and application results of the dynamic interactive dual-channel graph attention network model on actual datasets.
[0075] 1. Data preparation and preprocessing
[0076] Construct a Chinese satire dataset for model training and testing. The dataset includes:
[0077] (1) Data source
[0078] There are two data sets used, namely
[0079] Posts collected from entertainment shows and social media such as Weibo, and related data generated by ChatGPT; for example, the Harbin Institute of Technology Chinese Sarcasm Dataset;
[0080] (2) Self-built dataset annotation process
[0081] The data instances in the data source are annotated, and language experts manually annotate each piece of data to ensure that each instance is accurately marked as sarcastic or non-satire.
[0082] (3) Data preprocessing
[0083] The data preprocessing process includes text cleaning, word segmentation and part-of-speech tagging, and data partitioning;
[0084] Text cleaning: remove all HTML tags, special symbols and non-text elements through automated scripts to ensure data purity;
[0085] Word segmentation and part-of-speech tagging: HanLP tool is used to perform highly accurate word segmentation and part-of-speech tagging, laying the foundation for syntactic analysis;
[0086] Data partitioning, using conventional machine learning methods, the data is divided into 70% training set, 15% validation set and 15% test set to support model training and evaluation.
[0087] 2. Model training
[0088] The training of the model includes the following steps:
[0089] S101. Dynamically assign edge weights and edge types between two nodes by means of sentiment scoring to construct a sentiment graph structure; perform syntactic analysis on the text through Chinese dependency syntax tools to construct a syntactic graph structure.
[0090] S102, creating a dual-channel graph attention network model, the model includes an emotional channel, a syntactic channel and a dynamic interaction layer, the emotional channel is used to learn the incoming emotional graph and extract emotional features to generate an emotional feature vector, and the syntactic channel is used to learn the incoming syntactic graph and generate a syntactic structure feature vector, and the dynamic information interaction layer is used to dynamically fuse the emotional feature vector and the syntactic structure feature vector;
[0091] S103: Setting model training parameters, and performing training according to the model training parameters to obtain a trained dual-channel graph attention network model.
[0092] During the training process, a batch size of 32 is used to improve training efficiency and model stability; the number of training iterations is set to 100 rounds, or until the performance on the validation set no longer improves.
[0093] 3. Performance Evaluation
[0094] After completing the training of the dual-channel graph attention network model, the test set is used to evaluate the performance of the dual-channel graph attention network model.
[0095] The evaluation metrics used for performance evaluation include precision, recall, and F1 score to comprehensively evaluate the model’s sarcasm detection capability.
[0096] The above details the training process of the dual-channel graph attention network model, and fully demonstrates the application potential of the dual-channel graph attention network model used in this application in the field of Chinese sarcasm detection. These implementation details are based on experimental research conducted on multiple Chinese sarcasm datasets to demonstrate the effectiveness and practicality of the technical solution of this application.
[0097] In the above steps, the dynamic interaction layer in the dynamic interaction dual-channel graph attention network model receives the emotional feature vector and syntactic structure feature vector output from the emotional channel and the syntactic channel respectively, adopts the graph-based attention mechanism, dynamically interacts and fuses the emotional feature vector and the syntactic structure feature vector, and dynamically adjusts the proportion of dynamic interaction fusion according to the text content; the dynamic interaction layer plays a vital role, it not only adjusts the weight ratio of emotional and syntactic feature vectors, but more importantly, it allows the two processing channels - emotional channel and syntactic channel - to exchange information and learn from each other in real time. The design of this layer allows each channel to obtain information from another channel that helps enhance its analysis depth when processing its dedicated task.
[0098] This flexible information flow mechanism in the above dynamic interaction layer enables the dual-channel graph attention network model to adaptively adjust its strategy when processing sarcastic texts of different types and styles, thereby improving the accuracy and robustness of detection.
[0099] In the above steps, the proportion of dynamic interaction fusion is dynamically adjusted, specifically including:
[0100] The dynamic interaction layer adopts a complementary learning mechanism so that the sentiment channel and the syntactic channel can obtain information from the other channel that helps to enhance the depth of their analysis while processing their own dedicated tasks respectively.
[0101] The information obtained from another channel that helps to enhance the depth of its analysis specifically includes: if the emotional channel has identified that the node or its neighboring nodes express strong emotional colors, this information will be used by the syntactic channel to more accurately understand and parse the grammatical function and contextual relationship of the node; when the emotional channel evaluates the emotional tendency of a node in the text, it will also refer to the structural information provided by the syntactic channel to determine the context and intensity of the emotional expression.
[0102] For example, when the syntactic channel is parsing the syntactic structure of a node in the text, it can access the relevant output of the sentiment channel through the dynamic interaction layer. If the sentiment channel has identified that the node or its neighboring nodes express strong emotions, this information will be used by the syntactic channel to more accurately understand and parse the grammatical function and contextual relationship of the node. Similarly, when the sentiment channel evaluates the emotional tendency of a node in the text, it will also refer to the structural information provided by the syntactic channel to determine the context and intensity of the emotional expression.
[0103] This bidirectional information flow not only improves the accuracy of the model in extracting and processing complex text features, but also makes the model more sensitive and precise when processing text with obscure or complex sarcastic expressions. This complementary learning mechanism of the dynamic interaction layer significantly enhances the model's ability to detect sarcastic intent, especially when faced with subtle semantic and emotional changes in the text. By implementing this dynamic and interactive learning process, the present invention effectively bridges the gap between sentiment analysis and syntactic structure analysis, providing strong technical support for in-depth understanding and analysis of structured text data, especially in capturing sarcasm and implicit expressions.
[0104] In the above steps, classification judgment of the ironic intention is performed, and a final classification judgment result is output, wherein the classification judgment result is a binary result (eg, 1 represents irony, and 0 represents non-irony), or a probability score of the possibility of irony.
[0105] The above dynamic interaction layer handles diverse text inputs through preset adjustment mechanisms, responds to texts of different types and complexities, and ensures that potential sarcastic intent can be effectively identified regardless of the type (e.g., formal, informal) or complexity (e.g., simple, complex sentences). This feature makes the device highly adaptable and flexible, and can provide accurate sarcasm detection services in various practical application scenarios.
[0106] The above method of the present application was tested on multiple Chinese sarcastic text datasets. The experimental results show that compared with the existing sarcasm detection methods based on a single information source, the dual-channel graph attention network has significantly improved the accuracy and recall of sarcasm detection. For example, by introducing the syntactic channel, the model can better understand the sarcastic intention in long sentences; the emotional channel enhances the ability to recognize typical emotional contradictions in sarcasm.
[0107] The technical solution of this application effectively combines the latest advances in deep learning and natural language processing, especially the innovative application of graph attention mechanism and dynamic information processing, and provides an efficient and reliable new method for Chinese sarcasm detection. This not only promotes the development of natural language processing technology, but also provides a powerful supporting tool for related fields such as content monitoring and online interactive systems.
[0108] In practical applications, the dual-channel graph attention network model of the present application can be used to monitor online content and offline files, help identify and filter potentially harmful content containing sarcasm, and effectively improve the accuracy and efficiency of content review. The method of the present invention also has broad application prospects in content distribution networks (CDNs). CDN service providers need to ensure the security and compliance of content, comply with the requirements of laws and regulations such as the "Network Security Law" and the "Internet Information Service Management Measures", and strengthen the review and inspection of Internet dissemination content.
[0109] Specifically, the content audit of the CDN system can be real-time or offline. Real-time auditing is based on traffic, for example, it is monitored and audited in real time during data transmission. Offline auditing is based on files, and the data is analyzed and processed after storage. Real-time auditing can instantly detect and filter bad content for traffic, including content that cache nodes are ready to distribute, as well as user comments and user-uploaded content, to ensure the timeliness and security of the content; while offline auditing is suitable for in-depth analysis and batch processing of stored files, such as files stored by CDN's intelligent backup source. By combining real-time and offline auditing methods, the system can fully cover various content auditing needs. Content auditing can be performed on edge nodes or on intelligent backup sources. By performing content auditing on different parts of the CDN network architecture, CDN service providers can ensure the security and compliance of transmitted content while improving the overall performance of the system and user satisfaction.
[0110] In a second aspect, the present invention proposes a detection device for interactively identifying intentions based on a dual-channel attention network, the device comprising a data receiving module and a dual-channel graph attention network model, wherein the dual-channel graph attention network model comprises a sentiment analysis module, a syntactic analysis module, and a dynamic interaction module;
[0111] The data receiving module is used to segment the acquired text data to be detected, construct a corresponding vocabulary according to the segmentation result, generate a feature vector for each word in the vocabulary through a word vector model to form a feature matrix; generate a sentiment graph and a syntactic graph based on the feature matrix, and input them into a dual-channel graph attention network model;
[0112] The dual-channel graph attention network model is used to process the sentiment graph and the syntactic graph in parallel to generate a sentiment feature vector and a syntactic structure feature vector, and to achieve dynamic interactive fusion of the sentiment feature vector and the syntactic structure feature vector through a gating mechanism; based on the fused feature vector, classification and judgment of the sarcastic intention are performed through deep learning, and the final classification judgment result is output.
[0113] The following is an introduction to each module of the dual-channel graph attention network model:
[0114] (1) Sentiment Analysis Module
[0115] The sentiment analysis module uses a graph attention network (GAT) to process a sentiment graph, which represents the sentiment polarity and intensity of each word or phrase in the input text, as well as the sentiment relationship between words. The sentiment analysis pipeline uses a graph attention network (GAT) to process the sentiment graph. The key feature of GAT is that it can dynamically assign attention weights to each node (word) based on their importance to the overall text sentiment analysis. For each node in the graph, GAT calculates the attention coefficients of the nodes connected to it. These coefficients are based on the contrast of sentiment polarity and intensity between nodes, allowing the model to focus on key words and phrases in sentiment expression. Using the calculated attention weights, the model updates the feature representation of each node. This process involves combining the node's own features with the weighted features of its neighboring nodes to comprehensively consider the sentiment information in the local context.
[0116] Through this deep and dynamic sentiment analysis, the sentiment analysis module provides a powerful tool for understanding and parsing complex emotional content in text data, especially for application scenarios that require high emotional sensitivity and contextual understanding. The advantage of this approach is that it can dynamically adjust the analysis focus and feature representation, optimizing according to the actual emotional expression of the text content, thereby providing more accurate and detailed sentiment analysis results.
[0117] (2) Syntactic analysis module
[0118] The syntactic analysis pipeline uses a graph attention network (GAT) to process the constructed syntactic dependency tree. Through this mechanism, the model can dynamically assign attention weights to each node in the tree, especially those key words that are crucial to understanding the sentence structure. GAT calculates the attention coefficient between nodes based on the importance of the node (word) in the syntactic structure and its contribution to the meaning of the sentence. For example, for a sentence containing a subject-verb-object structure, the dynamic attention may be more focused on the verb and subject. Using the calculated attention weights, the model updates the feature representation of each node. This includes combining the node's own features with the weighted features of the nodes on which it is syntactically dependent, thereby synthesizing the syntactic information of the entire sentence. With the help of the attention mechanism, the syntactic analysis module is able to identify and emphasize key syntactic structures in the text, such as subject-verb-object relationships, attributive and adverbial structures. These structures are the basis for understanding the overall semantics of the sentence. The module is particularly effective in handling long-range dependencies and complex syntactic phenomena, which are common in long or complex sentences. Understanding these complex syntactic dependencies is particularly important for analyzing the deep meaning and emotional tendency of the text.
[0119] The syntactic analysis results not only provide the structural information of the sentence, but also help the entire model better understand the semantic connection and emotional tendency between words through interaction with the sentiment analysis module. The syntactic analysis results are combined with the sentiment analysis results through the dynamic interaction module to jointly influence the model's final interpretation of the sentiment and semantics of the entire text. Through this highly focused and precise syntactic analysis, the syntactic analysis module provides the model with a deep understanding of the language structure, which significantly improves the accuracy and effectiveness of the analysis when processing complex texts, especially when understanding texts with implicit meanings or sarcastic expressions.
[0120] (3) Dynamic interaction module
[0121] The core function of the dynamic interaction module is to coordinate the information flow between the sentiment analysis channel and the syntactic analysis channel, ensuring that the two types of information can complement and enhance each other during processing, thereby improving the analysis ability and accuracy of the overall model. In the dual-channel graph attention network, the sentiment analysis channel and the syntactic analysis channel independently process the input text to extract relevant sentiment and syntactic features. The dynamic interaction module establishes a bidirectional information flow, allowing the two channels to not only pass their own output as auxiliary input to each other, but also receive each other's information to optimize their own feature processing. The gating mechanism is a key technology in the dynamic interaction module, which allows the module to dynamically adjust the output fusion of the two channels based on the specific content of the text data. This mechanism involves evaluating the characteristics of the text, such as the sentiment intensity and syntactic complexity, and adjusting the weight of information fusion based on these evaluation results. For example, if the sentiment signal in the text is very strong (such as words with obvious sentiment polarity or strong emotional expressions), the gating mechanism may increase the weight of the sentiment feature, so that the final model output reflects more of the sentiment analysis results. On the contrary, if the text structure is complex or contains multiple levels of syntactic dependencies, the gating mechanism may enhance the influence of syntactic features to ensure that the model can fully utilize syntactic information to interpret the meaning of the text.
[0122] The dynamic interaction module continuously evaluates the text content and context in real time, dynamically adjusting the fusion ratio of sentiment and syntactic features based on the latest information. This flexible adjustment mechanism enables the model to adapt to various types of texts, especially those with sarcastic expressions containing hidden emotions or complex syntactic structures. Through this dynamic, gated information fusion strategy, the model can more accurately capture and understand the sarcastic intent in the text, even if these intents are expressed through subtle linguistic clues. Ultimately, this strategy improves the model's sensitivity and accuracy in identifying sarcastic intent, especially when dealing with complex or obscure texts.
[0123] According to the experimental results, the present invention was tested on two Chinese sarcastic text datasets. The experimental results show that compared with the existing sarcasm detection methods based on a single information source, the dual-channel graph attention network has significantly improved the accuracy and recall of sarcasm detection. For example, by introducing the syntactic channel, the model can better understand the sarcastic intention in long sentences; the emotional channel enhances the ability to recognize typical emotional contradictions in sarcasm.
[0124] The technical solution of the present invention effectively combines the latest progress in deep learning and natural language processing, especially the innovative application of graph attention mechanism and dynamic information processing, and provides an efficient and reliable new method for Chinese sarcasm detection. This not only promotes the development of natural language processing technology, but also provides a powerful supporting tool for related fields such as content monitoring and online interactive systems.
[0125] In a third aspect, the present invention provides an electronic device, comprising: a memory and one or more processors.
[0126] One or more application programs are stored in the memory, and the one or more application programs are suitable for being executed by the one or more processors to implement the method described in the first aspect.
[0127] The electronic device includes: a processor and a memory, wherein the processor and the memory are connected, for example, via a bus.
[0128] The structure of the electronic device does not constitute a limitation on the embodiments of the present invention.
[0129] The processor may be a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic device, a transistor logic device, a hardware component or any other combination. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0130] The bus may include a path to transmit information between the above components. The bus may be a PCI bus or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0131] The memory can be a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, or an EEPROM, CD-ROM or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.
[0132] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program can be loaded by a processor and execute the method described in the first aspect.
[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.
Claims
1. A detection method based on a dual-channel attention network interactive recognition intention, characterized in that: The method comprises the following steps: S1, performing word segmentation on the acquired text data to be detected, constructing a corresponding vocabulary according to the word segmentation result, and generating a feature vector for each word in the vocabulary through a word vector model to form a feature matrix; Generate a sentiment graph and a syntactic graph based on the feature matrix, and input them into a dual-channel graph attention network model; S2, the dual-channel graph attention network model processes the sentiment graph and the syntactic graph in parallel to generate a sentiment feature vector and a syntactic structure feature vector, and realizes the dynamic interactive fusion of the sentiment feature vector and the syntactic structure feature vector through a gating mechanism; based on the fused feature vector, the classification judgment of the satirical intention is performed through deep learning, and the final classification judgment result is output; In the above step S1, the sentiment graph is constructed using a dynamic edge weight method. The sentiment graph is constructed based on sentiment scores and intensity differences between words, reflecting the overall sentiment tendency of the text and its dynamic intensity that changes with the text content; The syntactic graph is constructed based on the dependency relationship between words, reflects the semantic dependency and syntactic structure of the text, and defines the connection between lexical nodes; The dynamic interactive fusion of the emotion feature vector and the syntactic structure feature vector is realized by using a gating mechanism, specifically including: The dynamic interaction layer in the dual-channel graph attention network model calculates the cross-channel attention coefficient for the sentiment feature vector and the syntactic structure feature vector of each vocabulary node; and the proportion of dynamic interaction fusion is dynamically adjusted through the gated attention mechanism.
2. The detection method according to claim 1, characterized in that: The sentiment graph and the syntactic graph are processed in parallel to generate sentiment feature vectors and syntactic structure feature vectors, including: The sentiment channel in the dual-channel graph attention network model uses the sentiment adjacency matrix to analyze the sentiment information in the text data to extract sentiment features, and uses the graph attention network to perform in-depth sentiment analysis on the text data through the input sentiment graph, and extracts key sentiment features and generates sentiment feature vectors by learning the dynamic relationship between different vocabulary nodes; The syntactic channel in the dual-channel graph attention network model uses a grammatical adjacency matrix to analyze the grammatical information of the text data to extract syntactic structure features. Through the incoming syntactic graph, the graph attention network is used to perform dependency syntactic analysis on the text data to construct a syntactic dependency tree, extract key syntactic features and convert them into syntactic structure feature vectors that can express the deep syntactic functions of the entire sentence.
3. A detection device based on a dual-channel attention network interactive recognition intention, characterized in that: The device includes a data receiving module and a dual-channel graph attention network model; the dual-channel graph attention network model includes a sentiment analysis module, a syntactic analysis module and a dynamic interaction module; The data receiving module is used to perform word segmentation on the acquired text data to be detected, construct a corresponding vocabulary table according to the word segmentation result, and generate a feature vector for each word in the vocabulary table through a word vector model to form a feature matrix; Generate a sentiment graph and a syntactic graph based on the feature matrix, and input them into a dual-channel graph attention network model; The dual-channel graph attention network model is used to process the sentiment graph and the syntactic graph in parallel to generate a sentiment feature vector and a syntactic structure feature vector, and realize the dynamic interactive fusion of the sentiment feature vector and the syntactic structure feature vector through a gating mechanism; based on the fused feature vector, the classification judgment of the ironic intention is performed through deep learning, and the final classification judgment result is output; The sentiment graph is constructed by using a dynamic edge weight method. The sentiment graph is constructed based on sentiment scores and intensity differences between words, reflecting the overall sentiment tendency of the text and its dynamic intensity that changes with the text content. The syntactic graph is constructed based on the dependency relationship between words, reflects the semantic dependency and syntactic structure of the text, and defines the connection between lexical nodes; The dynamic interactive fusion of the emotion feature vector and the syntactic structure feature vector is realized by using a gating mechanism, specifically including: The dynamic interaction module calculates the cross-channel attention coefficient for the sentiment feature vector and the syntactic structure feature vector of each vocabulary node; The ratio of dynamic interaction fusion is dynamically adjusted through the gated attention mechanism.
4. The detection device according to claim 3, characterized in that: The sentiment graph and the syntactic graph are processed in parallel to generate sentiment feature vectors and syntactic structure feature vectors, including: The sentiment analysis module uses the sentiment adjacency matrix to analyze the sentiment information in the text data to extract sentiment features, uses the graph attention network to perform in-depth sentiment analysis on the text data through the incoming sentiment graph, and extracts key sentiment features and generates sentiment feature vectors by learning the dynamic relationship between different vocabulary nodes; The syntactic analysis module uses a grammatical adjacency matrix to analyze the grammatical information of text data to extract syntactic structure features. Through the incoming syntactic graph, the graph attention network is used to perform dependency syntactic analysis on the text data to construct a syntactic dependency tree, extract key syntactic features and convert them into syntactic structure feature vectors that can express the deep syntactic functions of the entire sentence.
5. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 2 when executing the computer program.
6. A computer-readable storage medium storing a computer-executable program, wherein the computer-executable program is used to enable a computer to execute the method according to any one of claims 1 to 2.
