Emotional Analysis Method and System Based on Conversation Attention Mechanism and Dual-Feature Fusion

Through the emotion analysis method based on the conversation attention mechanism and the fusion of dual features, emotional vectors are generated and emotional direction relationships and intensity relationships are calculated, the problem of difficult to identify emotional tendencies in different aspects in comments in the existing technology is solved, accurate emotion analysis and global emotion judgment are achieved, and improvement and optimization in the field of education are supported.

CN120067335BActive Publication Date: 2025-08-01CHAOHU UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510280490.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-08-01
Estimated Expiration
2045-03-11

AI Technical Summary

Technical Problem

The prior art is difficult to capture emotional expressions in different aspects of the text in a fine-grained manner, especially when positive and negative emotions are mixed or semantic complex in comments, it is impossible to accurately identify specific aspects of emotional tendencies.

Method used

The emotion analysis method based on the conversation attention mechanism and the fusion of dual features is adopted. By generating emotional aspect vectors, calculating the emotional direction relationship and intensity relationship, performing quadratic classification, generating commentary emotion pair labels, and using multi-category cross-entropy loss function for supervised learning, optimizing the emotion analysis model.

Benefits of technology

It realizes accurate capture and analysis of emotional expressions in different aspects in the comment text, can identify obscure emotional tendencies in complex comments, provide a combination of local fine-grained and global emotional judgment, and supports curriculum optimization and improvement in the field of education.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067335B_ABST
    Figure CN120067335B_ABST
Patent Text Reader

Abstract

The present invention discloses an emotion analysis method and system based on conversation attention mechanism and dual-feature fusion, including: obtaining the current review text; preprocessing the current review text to generate an emotion aspect vector of the current review text; inputting the emotion aspect vector of the current review text into a pre-trained emotion analysis model; performing forward propagation on the emotion aspect vector of the current review text to output a global label of the review emotion of the current review text; by generating emotion pair labels for the review emotion, the present invention can capture the emotion expressions of different aspects in the review text; in the review of "the course content is very excellent, but the teaching method is dull and boring", the emotion pair label can respectively label the course content with positive emotion and the teaching method with negative emotion, so as to achieve more accurate emotion analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of sentiment analysis, and specifically to a sentiment analysis method and system based on conversation attention mechanism and dual-feature fusion. Background Art

[0002] As an important task in natural language processing, sentiment analysis has been widely applied in fields such as education, business, and social media. Traditional sentiment analysis methods usually directly make a global sentiment judgment on the overall text, ignoring the complexity and obscurity of the sentiment expressions in different aspects of the text. For example, in the course feedback in the education field, students may comment on multiple aspects such as course content and teaching methods at the same time, and the sentiment tendencies of these aspects may be very different or even contradictory. The patent document with the publication number CN119005203A discloses an aspect-level sentiment analysis method based on composition tree and multiple attention mechanisms. This method combines the aspect-aware attention mechanism and the self-attention mechanism to extract the semantic vector of the target text, uses the graph attention network to aggregate the information of the composition tree and the dependency tree to generate the syntactic vector of the target text, and performs interaction on the above semantic vector and syntactic vector based on the BiAffine module to generate a richer representation for sentiment analysis. However, in the above patent document and the prior art, there are still the following deficiencies:

[0003] The overall analysis method often fails to capture the sentiment expressions in different aspects of the text in a fine-grained manner. For example, in a comment like "The course content is very excellent, but the teaching method is boring", positive and negative sentiments are mixed, and traditional methods may not be able to accurately identify the sentiment tendency of specific aspects.

[0004] When the sentiment expression of the review text is relatively obscure or the semantics is complex, traditional methods often have difficulty extracting effective sentiment features. For example, in a comment like "The course content needs to be further improved, but the teaching method is generally okay", there is a subtle contrast of different sentiment directions hidden in this kind of comment, and it cannot be accurately judged through simple overall feature extraction. Summary of the Invention

[0005] This embodiment provides a sentiment analysis method and system based on conversation attention mechanism and dual-feature fusion, and explores how to solve the problem of difficult to capture the sentiment expressions in different aspects of the same review text.

[0006] In a first aspect, the present invention provides a sentiment analysis method based on conversation attention mechanism and dual-feature fusion, including:

[0007] Obtain the current review text;

[0008] Preprocess the current review text to generate a sentiment aspect vector of the current review text;

[0009] Input the sentiment aspect vector of the current review text into a pre-trained sentiment analysis model;

[0010] Perform forward propagation on the sentiment aspect vector of the current review text and output the global review sentiment label of the current review text;

[0011] Among them, the global review sentiment label is defined by the review sentiment pair label ranked first in terms of the frequency of the current review text, and the review sentiment pair label is generated by performing binary classification on the sentiment direction relationship and sentiment intensity relationship of any two sentiment aspect vectors.

[0012] In some embodiments, the modeling steps of the sentiment analysis model include:

[0013] S1. Obtain historical review texts;

[0014] S2. Preprocess the historical review texts to generate N word segmentation sets for each historical review text;

[0015] S3. Perform primary classification based on review aspect keywords for each word segmentation set to obtain the sentiment aspect vector of the word segmentation set;

[0016] S4. Calculate the sentiment score of each sentiment aspect vector;

[0017] Among them, the expression for calculating the sentiment score of each sentiment aspect vector is:

[0018] Among them, represents the sentiment score of each sentiment aspect vector, represents the attention weight assigned by the conversation attention mechanism, indicating the importance of the word segmentation for sentiment expression, represents the sentiment embedding vector of the word segmentation, indicating the sentiment feature of the word segmentation, and n represents the number of word segmentations.

[0019] S5. Calculate the sentiment direction relationship and sentiment intensity relationship of any two sentiment aspect vectors respectively according to the sentiment scores of each sentiment aspect vector;

[0020] S6. Perform binary classification on the sentiment direction relationship and sentiment intensity relationship of any two sentiment aspect vectors to obtain the review sentiment pair label of any two sentiment aspect vectors;

[0021] S7. Obtain all the review sentiment pair labels and their corresponding frequencies in the historical review texts;

[0022] S8. Assign global review sentiment labels to the historical review texts according to all the review sentiment pair labels and their corresponding frequencies in the historical review texts;

[0023] S9. Use the emotional aspect vector as the input vector and the global comment sentiment label as the target vector to construct sentiment analysis comment samples;

[0024] S10. Obtain a number of sentiment analysis comment samples, perform supervised learning, and after iteration, obtain the sentiment analysis model.

[0025] In some embodiments, preprocess the historical comment text to generate N word segmentation sets for each historical comment text, including:

[0026] S2-1. Clean the historical comment text to obtain a normalized comment text;

[0027] S2-2. Use a word segmentation tool to disassemble the normalized text into several sentences, and then disassemble each sentence into an independent word segmentation set to obtain the N word segmentation sets.

[0028] In some embodiments, perform an initial classification based on comment aspect keywords for each word segmentation set to obtain the emotional aspect vector of the word segmentation set, including:

[0029] S3-1. According to the preset comment aspect keyword dictionary, match and label the words in each word segmentation set to generate N comment aspect classification arrays for each historical comment text;

[0030] Among them, the comment aspect keyword dictionary contains comment aspect keywords and their significance scores;

[0031] The comment aspect classification array is represented as a binary array, whose first element is the comment aspect category and the second element is the significance score of the comment aspect category;

[0032] S3-2. According to the comment aspect classification array, assign comment aspect labels to each word segmentation set and calculate their label significance scores;

[0033] The expression for calculating its label significance score is:

[0034] ;

[0035] Among them, represents the label significance score of each word segmentation set, W represents the word segmentation set, which contains all the words in the historical comment text, represents the i-th word in the word segmentation set; represents the set of comment aspect keywords and their significance scores corresponding to the comment aspect label L in the comment aspect keyword dictionary, represents the j-th keyword; is an indicator function, indicating that if the word is the same as the keyword in the comment aspect keyword dictionary If they match, the value is 1; otherwise, it is 0. Indicates the j-th keyword The significance score in the keyword dictionary for the comment aspect;

[0036] S3-3. Define the comment aspect label, label significance score, and word segmentation combination as the sentiment aspect vector of this historical comment text.

[0037] In some of these embodiments, according to the sentiment scores of each sentiment aspect vector, calculate the sentiment direction relationship and sentiment intensity relationship between any two sentiment aspect vectors respectively, including:

[0038] S5-1. Determine the sentiment direction relationship between any two sentiment aspect vectors according to the signs of any two sentiment scores;

[0039] S5-2. Determine the sentiment intensity relationship between any two sentiment aspect vectors according to the absolute value difference of any two sentiment scores;

[0040] S5-3. Output the sentiment direction relationship and sentiment intensity relationship between any two sentiment aspect vectors.

[0041] In some of these embodiments, determine the sentiment direction relationship between any two sentiment aspect vectors according to the signs of any two sentiment scores, including:

[0042] S5-1-1. Compare the positive and negative signs of the sentiment scores of two sentiment aspect vectors and perform sentiment direction relationship judgment;

[0043] S5-1-2. If the signs of the two sentiment scores are the same, output that the sentiment direction relationship is in the same direction

[0044] S5-1-3. If one or both of the sentiment scores are zero, output that the sentiment direction relationship is neutral.

[0045] S5-1-4. If the signs of the sentiment scores are opposite, calculate the difference between the two sentiment scores and judge the sentiment direction relationship with opposite signs;

[0046] If the absolute value of the difference is greater than the score difference threshold, output that the sentiment direction relationship is significantly opposite;

[0047] If the absolute value of the difference is less than or equal to the score difference threshold, output that the sentiment direction relationship is vaguely opposite.

[0048] In some of these embodiments, determine the sentiment intensity relationship between any two sentiment aspect vectors according to the absolute value difference of any two sentiment scores, including:

[0049] S5-2-1. Calculate the absolute value difference of the sentiment scores of two sentiment aspect vectors, and perform sentiment intensity relationship judgment;

[0050] S5-2-2. If the absolute value difference is less than the first intensity threshold, output that the sentiment intensity relationship is close in intensity;

[0051] S5-2-3. If the absolute value difference is between the first intensity threshold and the second intensity threshold, output that the sentiment intensity relationship is partially different in intensity;

[0052] S5-2-4. If the absolute value difference is greater than the second intensity threshold, output that the sentiment intensity relationship is significantly different in intensity.

[0053] In some of the embodiments, perform secondary classification on the sentiment direction relationship and the sentiment intensity relationship of any two sentiment aspect vectors to obtain the comment sentiment pair label of any two sentiment aspect vectors, including:

[0054] S6-1. Obtain the sentiment direction relationship and the sentiment intensity relationship of any two sentiment aspect vectors;

[0055] S6-2. Combine the sentiment direction relationship and the sentiment intensity relationship of any two sentiment aspect vectors to obtain a comprehensive sentiment relationship;

[0056] S6-3. Substitute the comprehensive sentiment relationship into the preset sentiment classification summary rule to obtain the comment sentiment pair label.

[0057] In some of the embodiments, assign a comment sentiment global label to the historical comment text according to all the comment sentiment pair labels and their corresponding frequencies in the historical comment text, including:

[0058] S8-1. Obtain the corresponding frequency of each comment sentiment pair label;

[0059] S8-2. Sort each comment sentiment pair label based on the corresponding frequency of each comment sentiment pair label;

[0060] S8-3. Define the comment sentiment pair label ranked first as the comment sentiment global label of the historical comment text.

[0061] In some of the embodiments, obtain a number of sentiment analysis comment samples, perform supervised learning, and after iteration, obtain the sentiment analysis model, including:

[0062] S10-1. Extract the initial batch of sentiment analysis comment samples, input them into the supervised model, and perform forward propagation on them to generate the comment sentiment global prediction label of the current batch;

[0063] S10-2. Calculate the multi-class cross-entropy loss of the global predicted label of the review sentiment and the global label of the review sentiment using a loss function;

[0064] The expression of the multi-class cross-entropy loss is:

[0065] ;

[0066] where L represents the multi-class cross-entropy loss, N represents the number of sentiment analysis review samples, C represents the number of categories of the global label of the review sentiment, represents the true label of the i-th sentiment analysis review sample in the category of the global label of the review sentiment, represents the predicted probability of the i-th sentiment analysis review sample in the category of the global label of the review sentiment;

[0067] S10-3. Perform backpropagation of the supervised model to generate updated model parameters;

[0068] S10-3. Perform backpropagation of the supervised model to generate updated model parameters;

[0069] S10-4. Repeat S10-1 to S10-2 using the updated model parameters until the cross-entropy loss is minimized.

[0070] By generating "review sentiment pair labels", the present invention can capture the sentiment expressions of different aspects in the review text. For example, in the review of "The course content is very excellent, but the teaching method is boring", the sentiment pair label can label the course content as positive sentiment and the teaching method as negative sentiment respectively, so as to achieve more accurate sentiment analysis.

[0071] And by using the conversation attention mechanism and the dual-feature fusion technology, the present invention can mine the implicit sentiment tendency in the review text. For example, for a review like "The course content needs to be further improved, but the teaching method is generally okay", with the help of the sentiment pair label, it can respectively judge the negative sentiment of the course content and the neutral sentiment of the teaching method, providing a solution for the analysis of complex texts.

[0072] Furthermore, by calculating the sentiment direction relationship and the sentiment intensity relationship, the sentiment contrast information between different aspects is generated, revealing the association of the sentiment tendency. For example, when the sentiment directions of the course content and the teaching method are opposite and the intensities are similar, the sentiment pair label can indicate that there is a significant contradiction in the overall sentiment of the reviewer towards the course, providing a solid foundation for the subsequent classification of the review sentiment pair label.

[0073] Furthermore, by modeling the sentiment towards tags (local context) and the global sentiment label of the overall review sentiment (global context), the combination of local fine-grained analysis and overall sentiment judgment is achieved. It is not only possible to separately judge the sentiment of specific aspects, but also to comprehensively evaluate the sentiment tendency of the overall text through global analysis, ultimately providing a strong basis for subsequent educational improvement and curriculum optimization in the online education field based on reviews.

[0074] In a second aspect, the present invention provides a sentiment analysis system based on a conversation attention mechanism and dual-feature fusion, including:

[0075] A review text acquisition module for acquiring the current review text;

[0076] A sentiment aspect vector module for preprocessing the current review text to generate a sentiment aspect vector of the current review text;

[0077] A sentiment analysis module for inputting the sentiment aspect vector of the current review text into a pre-trained sentiment analysis model;

[0078] A global sentiment output module for performing forward propagation on the sentiment aspect vector of the current review text and outputting a global sentiment label of the review sentiment of the current review text.

[0079] Compared with the prior art, the beneficial effects of the sentiment analysis system based on the conversation attention mechanism and dual-feature fusion of the present invention are the same as those of the sentiment analysis method based on the conversation attention mechanism and dual-feature fusion described above, so they will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] Figure 1 It is a flowchart of the sentiment analysis method based on the conversation attention mechanism and dual-feature fusion of the present invention;

[0081] Figure 2 It is a schematic diagram of the modeling steps of the sentiment analysis model of the present invention;

[0082] Figure 3 It is a structural block diagram of the sentiment analysis system based on the conversation attention mechanism and dual-feature fusion of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0083] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0084] Example 1: Please refer to Figure 1, the present invention provides an emotion analysis method based on conversation attention mechanism and dual-feature fusion, including the following steps:

[0085] Step 1, obtain the current review text;

[0086] Step 2, preprocess the current review text to generate an emotion aspect vector of the current review text;

[0087] Step 3, input the emotion aspect vector of the current review text into a pre-trained emotion analysis model;

[0088] Step 4, perform forward propagation on the emotion aspect vector of the current review text, and output a global comment emotion label of the current review text;

[0089] Among them, the global comment emotion label is defined by the comment emotion pair label ranked first in terms of the frequency of the current review text, and the comment emotion pair label is generated by performing secondary classification on the emotion direction relationship and emotion intensity relationship of any two emotion aspect vectors.

[0090] In this embodiment, by inputting the emotion aspect vector of the current review text into a pre-trained emotion analysis model and performing forward propagation, the global emotion label of the review text can be generated in a short time, meeting the requirements of real-time emotion analysis. Based on the emotion aspect vector generated by preprocessing, the core emotions of multiple aspects in the review text are effectively captured. The emotion analysis model can accurately judge its global emotion according to the input emotion aspect vector, providing a strong basis for subsequent educational improvement, curriculum optimization, etc.

[0091] Embodiment 2: Refer to Figures 1 to 2 , the technical solution of this Embodiment 2 is different from that of Embodiment 1 in that the modeling steps of the emotion analysis model described in Embodiment 1 are disclosed, and among them, the modeling steps include:

[0092] S1, obtain historical review texts;

[0093] S2, preprocess the historical review texts to generate N word segmentation sets for each historical review text;

[0094] S3, perform primary classification based on review aspect keywords for each word segmentation set to obtain an emotion aspect vector of the word segmentation set;

[0095] S4, calculate the emotion score of each emotion aspect vector;

[0096] Among them, the expression for calculating the emotion score of each emotion aspect vector is:

[0097] Among them, represents the emotion score of each emotion aspect vector, It represents the attention weight assigned by the conversational attention mechanism, indicating the importance of a word segment for emotional expression. It represents the emotional embedding vector of a word segment, indicating the emotional characteristics of the word segment. n represents the number of word segments.

[0098] Among them, the calculation of the emotional score can be carried out based on the conversational main attention mechanism. Specifically, the Conversational Attention Mechanism is a variant of the attention mechanism in deep learning, which is used to capture the importance of different parts (such as word segments, phrases) in the input data in a specific context or task. Its core idea is:

[0099] Assign a dynamic weight (attention weight) to each element (such as a word or the feature vector of a word segment) in the input data. The size of the weight reflects the importance of the element for the current task (such as sentiment analysis).

[0100] Finally, a weighted sum of all input elements will be calculated to generate a context-aware output vector.

[0101] For the attention weight, it represents the importance of a certain input word segment. The weight value is usually a real number between 0 and 1, and the sum of all weights is 1.

[0102] The attention weight is obtained by calculating the dot product of the emotional aspect vector and the feature representation of the input word segment, and calculating the weight of the dot product sum. The emotional embedding vector is generated for each word segment by using a pre-trained emotional word vector model (such as Word2Vec, GloVe) or a context-aware model (Bert or Transformer).

[0103] S5. Calculate the emotional direction relationship and emotional intensity relationship between any two emotional aspect vectors respectively according to the emotional scores of each emotional aspect vector;

[0104] S6. Perform a binary classification on the emotional direction relationship and emotional intensity relationship between any two emotional aspect vectors to obtain the comment emotion pair label of any two emotional aspect vectors;

[0105] S7. Obtain all the comment emotion pair labels and their corresponding frequencies in the historical review text;

[0106] S8. Assign a comment emotion global label to the historical review text according to all the comment emotion pair labels and their corresponding frequencies in the historical review text;

[0107] S9. Use the emotional aspect vector as the input vector and the comment emotion global label as the target vector to construct an emotional analysis comment sample;

[0108] S10. Obtain several sentiment analysis review samples, perform supervised learning, and obtain the sentiment analysis model after iteration.

[0109] This embodiment obtains historical review texts and performs word segmentation, classification, and sentiment feature representation extraction on them. It then combines the conversation attention mechanism with a dual-feature fusion sentiment analysis model to accurately quantify and model different aspects of sentiment in the review texts. The historical review texts are a large amount of original experimental course review data collected from an online experimental course platform. These data should cover different courses, different experiments, and various student feedback to ensure the comprehensiveness and diversity of the data.

[0110] Specifically, the modeling step S2 includes:

[0111] S2-1. Clean the historical comment texts to obtain standardized comment texts;

[0112] Exemplarily, text cleaning includes:

[0113] Delete noise information in historical comment texts, such as advertisements, URL links, emoticons, etc.

[0114] Standardize uppercase and lowercase letters, and full-width and half-width symbols in historical commentary texts;

[0115] Use a stop word list to remove words that are meaningless to the review classification, such as "的", "了", "是", etc.

[0116] S2-2. Use a word segmentation tool to decompose the normalized text into several sentences, and then decompose each sentence into an independent word segmentation set to obtain the K word segmentation sets.

[0117] For example, the input normalized text is: The course content is very clear, but the teaching method is not interesting enough.

[0118] Break it down into a set of participles: [course, content, very, clear, explanation, method, not enough, interesting]

[0119] Word segmentation tools such as BERT and SpaCy can be used.

[0120] This embodiment removes noise information by performing text cleaning, word segmentation, and normalization on the historical review text, thereby ensuring the quality of the input data and providing high-quality word segmentation set input for subsequent aspect classification and sentiment analysis.

[0121] Specifically, the modeling step S3 includes:

[0122] S3-1. Match and label the words in each word segmentation set according to a preset comment aspect keyword dictionary to generate several comment aspect classification arrays for each historical review text;

[0123] Among them, the comment aspect keyword dictionary includes comment aspect keywords and their significance scores, which are used to classify and score the words in the word segmentation set.

[0124] The comment aspect classification array is represented as a binary array, whose first element is the comment aspect category, and the second element is the significance score of the comment aspect category;

[0125] S3-2. Assign comment aspect labels to each word segmentation set according to the comment aspect classification array, and calculate their label significance scores;

[0126] The expression for calculating its label significance score is:

[0127] ;

[0128] Among them, represents the label significance score of each word segmentation set, W represents the word segmentation set, which contains all the word segmentations of the historical review text, represents the i-th word in the word segmentation set; represents the set of comment aspect keywords and their significance scores corresponding to the comment aspect label L in the comment aspect keyword dictionary, represents the j-th keyword; is an indicator function, which means that if the word segmentation matches the keyword in the comment aspect keyword dictionary, it takes the value of 1, otherwise it takes the value of 0; represents the j-th keyword in the significance score in the comment aspect keyword dictionary;

[0129] S3-3. Define the comment aspect label, label significance score and word segmentation combination as the sentiment aspect vector of this historical review text.

[0130] In this embodiment, through the matching and significance calculation of the comment aspect keyword dictionary, comment aspect labels are assigned to the word segmentation set, and a sentiment aspect vector is generated, accurately dividing each sentiment direction in the review text, providing a data basis for the global sentiment calculation of the model.

[0131] Specifically, the modeling step S5 includes:

[0132] S5-1. Determine the sentiment direction relationship between any two sentiment aspect vectors according to the signs of any two sentiment scores;

[0133] S5-2. Determine the emotional intensity relationship between any two emotional aspect vectors according to the absolute value difference of any two emotional scores;

[0134] S5-3. Output the emotional direction relationship and emotional intensity relationship between any two emotional aspect vectors.

[0135] In this embodiment, by calculating the emotional direction relationship and emotional intensity relationship of the emotional aspect vectors, the emotional association between different aspects is clarified.

[0136] Furthermore, the modeling step S5-1 further includes:

[0137] S5-1-1. Compare the positive and negative signs of the emotional scores of two emotional aspect vectors and perform emotional direction relationship judgment;

[0138] S5-1-2. If the signs of the two emotional scores are the same (for example, both are positive or both are negative), then output the emotional direction relationship as consistent direction;

[0139] S5-1-3. If one or both of the emotional scores are zero, then output the emotional direction relationship as neutral direction.

[0140] S5-1-4. If the signs of the emotional scores are opposite (one is positive and the other is negative), then calculate the difference between the two emotional scores and judge the emotional direction relationship with opposite signs;

[0141] If the absolute value difference of the difference is greater than the score difference threshold, then output the emotional direction relationship as significantly opposite direction;

[0142] If the absolute value of the difference is less than or equal to the score difference threshold, then output the emotional direction relationship as vaguely opposite direction.

[0143] In this embodiment, by classifying the emotional direction relationship between two emotional aspect vectors, it is divided into categories such as consistent direction, neutral direction, significantly opposite direction, and vaguely opposite direction. This classification method captures the comparison of the emotional expression directions of users in different aspects through the accurate analysis of the signs and differences of emotional scores. Especially in the emotional relationships of significant opposition and vague opposition, this method can effectively reveal the implicit contradictions or complex emotional tendencies in the comments, providing a solid foundation for further exploring the emotional hierarchy of the comment content and the dynamic changes of user emotions.

[0144] Furthermore, the modeling step S5-2 further includes:

[0145] S5-2-1. Calculate the absolute value difference of the emotional scores of two emotional aspect vectors and perform emotional intensity relationship judgment; by calculating the absolute value difference of the emotional scores of two feature vectors, it is used to quantify the intensity difference of emotional expressions in two aspects.

[0146] S5-2-2: If the absolute value difference is less than the first intensity threshold, output the emotional intensity relationship as intensity close; when the emotional intensity difference between the two aspects is small (e.g., within the preset threshold), it indicates that the user's emotional expression intensities for the two aspects are basically the same.

[0147] S5-2-3: If the absolute value difference is between the first intensity threshold and the second intensity threshold, output the emotional intensity relationship as intensity partially different; when the intensity difference between the two aspects is not small but not significant, it can be classified as intensity partially different.

[0148] S5-2-4: If the absolute value difference is greater than the second intensity threshold, output the emotional intensity relationship as intensity significantly different; when the intensity difference between the two aspects is extremely large, it indicates that the user's attention degrees to these two aspects are significantly different.

[0149] In this embodiment, by calculating the emotional intensity relationship, the emotional scores of the two emotional aspect vectors are compared in terms of the absolute value difference, and are classified into three relationships: intensity close, intensity partially different, and intensity significantly different according to the intensity difference. It captures the fine-grained intensity changes of the user's emotional expressions for different aspects, and reveals the differences in the user's expressed concerns and emotional intensities in the comments.

[0150] Specifically, the modeling step S6 includes:

[0151] S6-1: Obtain the emotional direction relationship and emotional intensity relationship of any two emotional aspect vectors;

[0152] S6-2: Combine the emotional direction relationship and emotional intensity relationship of any two emotional aspect vectors to obtain the comprehensive emotional relationship;

[0153] S6-3: Substitute the comprehensive emotional relationship into the preset emotional classification and summarization rules to obtain the comment emotion pair label.

[0154] Specifically, the emotional classification and summarization rules are:

[0155] Combine the emotional direction relationship and emotional intensity relationship, and assign a preset global emotional label to the combined comprehensive emotional relationship; the emotional classification and summarization rules are as follows:

[0156] The global emotional label for direction consistent + intensity close is: highly consistent emotion;

[0157] The global emotional label for direction consistent + intensity partially different is: relatively consistent emotion;

[0158] The global emotional label for direction consistent + intensity significantly different is: significantly biased emotional tendency;

[0159] The global emotional label with significant direction opposition and similar intensity is: Emotional balanced opposition;

[0160] The global emotional label with significant direction opposition and partial intensity difference is: Emotional slight opposition;

[0161] The global emotional label with significant direction opposition and significant intensity difference is: Emotional strong opposition;

[0162] The global emotional label with vague direction opposition and similar intensity is: Emotional vague opposition;

[0163] The global emotional label with vague direction opposition and partial intensity difference is: Emotional slight conflict;

[0164] The global emotional label with vague direction opposition and significant intensity difference is: Emotional slight deviation;

[0165] The global emotional label with neutral direction and similar intensity is: Emotional balanced neutrality;

[0166] The global emotional label with neutral direction and partial intensity difference is: Emotional slight tendency;

[0167] The global emotional label with neutral direction and significant intensity difference is: Emotional strong tendency.

[0168] Among them,

[0169] High emotional consistency is characterized by: the emotional directions of the two aspects are the same, and the emotional intensity difference is small, indicating that the user's emotional expressions for the two aspects are basically completely consistent. For example, "The course content is very clear" (+4), "The teaching method is very interesting" (+3), which can be described as high emotional consistency with the same direction and similar intensity.

[0170] Emotional preference consistency is characterized by: the emotional directions of the two aspects are the same, but there is a certain difference in intensity, indicating that the user's emotion for one aspect is more prominent; for example, "The course content is very good" (+5), "The teaching method is okay" (+2), which can be described as emotional preference consistency with the same direction and partial intensity difference.

[0171] Significant emotional preference bias is characterized by: the emotional directions of the two aspects are the same, but the emotional intensity of one aspect is significantly higher than the other, showing a significant emotional preference. For example, "The course content is extremely excellent" (+5), "The teaching method is average" (+1); it can be described as significant emotional preference bias with the same direction and significant intensity difference.

[0172] The emotional balanced opposition is characterized as follows: the emotional directions of the two aspects are completely opposite, but the intensities are similar, indicating that the user has a balanced contradiction in the evaluations of the two aspects. For example, "The course content is very good" (+3), "The teaching method is very bad" (-3); it can be expressed as an emotional balanced opposition with a significant direction opposition and similar intensities.

[0173] The emotional slight opposition is characterized as follows: the emotional directions of the two aspects are completely opposite, but the intensity difference is small, indicating that the user's negative evaluation of one aspect is weak. For example, "The course content is excellent" (+4), "The teaching method is a bit boring" (-2); it can be expressed as an emotional slight opposition with a significant direction opposition and a partial intensity difference.

[0174] The emotional strong opposition is characterized as follows: the emotional directions of the two aspects are completely opposite, and the intensity difference is large, indicating that the user has a serious contradiction in the emotional evaluations of the two aspects. For example, "The course content is very excellent" (+5), "The teaching method is very bad" (-5); it can be expressed as an emotional strong opposition with a significant direction opposition and a significant intensity difference.

[0175] The emotional ambiguous opposition is characterized as follows: the emotional directions of the two aspects have a slight opposition, but the intensities are similar, indicating that the user's contradictory emotions are not obvious. For example, "The course content is okay" (+2), "The teaching method is slightly insufficient" (-2); it can be expressed as an emotional ambiguous opposition with a direction opposition and similar intensities.

[0176] The emotional slight conflict is characterized as follows: the emotional directions of the two aspects have a slight opposition, but the intensity difference is not large, indicating that the user's emotional conflict is weak. For example, "The course content is good" (+3), "The teaching method is slightly lacking" (-1); it can be expressed as an emotional slight conflict with a vague direction opposition and a partial intensity difference.

[0177] The emotional slight deviation is characterized as follows: the emotional directions of the two aspects have a slight opposition, and the intensity difference is large, indicating that the user has a certain deviation in the emotions towards the two aspects. For example, "The course content is very good" (+5), "The teaching method is slightly poor" (-2); it can be expressed as an emotional slight deviation with a direction opposition and a significant intensity difference.

[0178] The emotional balanced neutrality is characterized as follows: the emotional directions of the two aspects are neutral (at least one score is zero), and the intensity difference is small. For example, "The course content is average" (0), "The teaching method is okay" (+1); it can be expressed as an emotional balanced neutrality towards neutrality and similar intensities.

[0179] The mild emotional tendency is characterized by: the emotional directions in two aspects are neutral, but the intensity in one aspect is slightly higher, indicating that the user's emotional expression in one aspect is slightly stronger. For example, "I have no particular feeling about the course content" (0), "The teaching method is somewhat interesting" (+3); it can be expressed as a mild emotional tendency with neutral direction and partial intensity difference.

[0180] The strong emotional tendency is characterized by: the emotional directions in two aspects are neutral, but the intensity in one aspect is much higher than that in the other, indicating that the user's attention to one aspect is significantly higher than that to the other. For example, "I have no feeling about the course content" (0), "The teaching method is very excellent" (+5); it can be expressed as a strong emotional tendency with neutral direction and significant intensity difference.

[0181] The summary table of the above-mentioned emotional classification and summarization rules is as follows:

[0182] Direction relationship Strength relationship Name Description Same direction Strengths are close Emotions are highly consistent The two aspects have the same direction and a small difference in strength Same direction Partial difference in strength Same emotional emphasis The two aspects have the same direction, but the difference in strength is large Same direction Significant difference in strength Significant emotional preference The two aspects have the same direction, but one aspect has a stronger emotion Significant opposite directions Strengths are close Balanced emotional opposition The two aspects have opposite directions, but the strengths are close Significant opposite directions Partial difference in strength Slight emotional opposition The two aspects have opposite directions, but the difference in strength is small Significant opposite directions Significant difference in strength Strong emotional opposition The two aspects have opposite directions and a significant difference in strength Vague opposite directions Strengths are close Vague emotional opposition The two aspects have slightly opposite directions and the strengths are close Vague opposite directions Partial difference in strength Slight emotional conflict The two aspects have slightly opposite directions and the difference in strength is not large Vague opposite directions Significant difference in strength Slight emotional deviation The two aspects have slightly opposite directions, but the difference in strength is large Neutral direction Strengths are close Balanced neutral emotion At least one aspect is neutral and the strengths are close Neutral direction Partial difference in strength Slight emotional tendency At least one aspect is neutral and one aspect is slightly stronger Neutral direction Significant difference in strength Strong emotional tendency At least one aspect is neutral and one aspect is significantly stronger

[0183] Among them, the comment emotion pair label is generated based on local context information by capturing the emotional direction relationship and emotional intensity relationship between any two emotional aspect vectors. The emotional direction and intensity relationship in the local context reflects the user's specific emotional expression of the local aspects in the text, providing a more refined emotional granularity analysis.

[0184] In this embodiment, by combining the emotional direction relationship and emotional intensity relationship, the emotional interaction between any two emotional aspect vectors is described in the form of a comprehensive relationship, and the comment emotion pair label is generated based on the preset emotional classification and summarization rules. Through the classification of complex emotional interaction situations such as consistent direction, opposite direction (significantly opposite and vaguely opposite), and neutral direction, the above-mentioned implementation method can efficiently summarize the emotional connections between different aspects in the comment text, and at the same time generate specific emotion pair labels to support more refined emotional global calculation and the generalization analysis of the overall emotional characteristics of the text.

[0185] Specifically, the modeling step S8 includes:

[0186] S8-1. Obtain the corresponding frequency of each comment emotion pair label;

[0187] S8-2. Sort each comment emotion pair label based on the corresponding frequency of each comment emotion pair label;

[0188] S8-3. Define the comment emotion global label of the historical comment text as the comment emotion pair label ranked first.

[0189] The global label of the comment sentiment for the overall text is generated through global context information. Based on the statistical frequency and relative weight of all comment sentiments for the label in the historical comment text, it reflects the global sentiment expression of users towards the overall text. The global label of the comment sentiment in the global context integrates the information of local sentiment for the label and provides a global-oriented sentiment classification result.

[0190] By counting the frequency of each comment sentiment for the label in the historical comment text, sorting all sentiment pairs for the label, and selecting the sentiment pair with the highest frequency according to the sorting result as the global label of the comment sentiment for the historical comment text. This implementation method can quickly summarize the overall sentiment characteristics of the comment text, and achieve an intuitive assignment of the global label of the sentiment through the frequency sorting mechanism, so as to comprehensively reflect the main sentiment trend of the user's comment.

[0191] Specifically, the modeling step S10 includes:

[0192] S10-1. Extract the initial batch of sentiment analysis comment samples, input them into the supervised model, and perform forward propagation on them to generate the global prediction label of the comment sentiment for the current batch;

[0193] S10-2. Use the loss function to calculate the multi-class cross-entropy loss between the global prediction label of the comment sentiment and the global label of the comment sentiment;

[0194] The expression of the multi-class cross-entropy loss is:

[0195] ;

[0196] where L represents the multi-class cross-entropy loss, N represents the number of sentiment analysis comment samples, C represents the number of categories of the global label of the comment sentiment, represents the true label of the i-th sentiment analysis comment sample in the category of the global label of the comment sentiment, represents the predicted probability of the i-th sentiment analysis comment sample in the category of the global label of the comment sentiment.

[0197] S10-3. Perform backpropagation of the supervised model to generate updated model parameters;

[0198] S10-4. Repeat S10-1 to S10-2 using the updated model parameters until the cross-entropy loss is minimized.

[0199] In this embodiment, a supervised learning method based on a multi-class cross-entropy loss function is used to gradually optimize the initial sentiment analysis model. During the training process, predicted labels are generated through forward propagation, the loss is calculated using the true labels, and then the model parameters are updated through backpropagation. Iterations are performed round by round until the loss function is minimized, and finally, an optimized sentiment analysis model is obtained. This method fully utilizes the multi-class features of sentiment global labels during model training, combines the sentiment direction relationship and intensity relationship, and achieves higher-precision sentiment global classification, providing a highly robust and generalizable model framework for sentiment analysis tasks.

[0200] This embodiment demonstrates the modeling of a sentiment classification model by fusing local features and global context features, where the local context emphasizes the fine-grained association with the target token or aspect, while the global context captures the long-distance review text. The two features are fused with each other to improve the accuracy of sentiment classification.

[0201] Embodiment 3: Refer to Figures 1 to 3 , the technical solution of this Embodiment 3 is different from that of Embodiment 1 and Embodiment 2 in that a sentiment analysis system based on a conversation attention mechanism and dual-feature fusion is further provided. This system is used to implement the above method embodiments, and those that have been described will not be repeated here. The following terms such as "module", "unit", "sub-unit", etc. can be a combination of software and / or hardware that can achieve a predetermined function. Although the system described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0202] As Figure 3 shown, Figure 3 is the structural block diagram of the sentiment analysis system of the present invention based on a conversation attention mechanism and dual-feature fusion. This system includes:

[0203] A review text acquisition module, used to acquire the current review text;

[0204] A sentiment aspect vector module, which preprocesses the current review text to generate a sentiment aspect vector of the current review text;

[0205] A sentiment analysis module, which inputs the sentiment aspect vector of the current review text into a pre-trained sentiment analysis model;

[0206] A global sentiment output module, which performs forward propagation on the sentiment aspect vector of the current review text and outputs the review sentiment global label of the current review text.

[0207] In the above system, the current text is obtained through the comment text acquisition module; the sentiment aspect vector is generated through the sentiment aspect vector module; the global comment sentiment label is obtained through the sentiment analysis module to perform sentiment analysis; the global comment sentiment label is obtained through the global sentiment output module, thus solving the problem of difficult to capture the sentiment expressions of different aspects in the same comment text.

[0208] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable systems. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (such as infrared, wireless, microwave, etc.) means.

[0209] The computer-readable storage medium can be any available medium accessible by a computer or a data storage device such as a server or data center containing one or more collections of available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVD ), or semiconductor media. The semiconductor media can be a solid-state drive.

[0210] In several embodiments provided in the present application, it should be understood that the disclosed systems, systems, and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of systems or units can be electrical, mechanical, or other forms.

[0211] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed in the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the present application.

Claims

1. An emotion analysis method based on conversation attention mechanism and dual-feature fusion, characterized in that Including: Obtain the current review text; Preprocess the current review text to generate an emotional aspect vector of the current review text; Input the emotional aspect vector of the current review text into a pre-trained sentiment analysis model; Perform forward propagation on the emotional aspect vector of the current review text and output the global review sentiment label of the current review text; Wherein, the global review sentiment label is defined by the review sentiment pair label ranked first in terms of the frequency of the current review text, and the review sentiment pair label is generated by performing secondary classification on the emotional direction relationship and emotional intensity relationship of any two emotional aspect vectors; The modeling steps of the sentiment analysis model include: S1. Obtain historical review texts; S2. Preprocess the historical review texts to generate K word segmentation sets for each historical review text; S3. Perform primary classification based on review aspect keywords for each word segmentation set to obtain the emotional aspect vector of the word segmentation set; S4. Calculate the emotional score of each emotional aspect vector; Among them, the expression for calculating the sentiment score of each sentiment aspect vector is: ; Among them, represents the sentiment score of each sentiment aspect vector, represents the attention weight assigned by the conversation attention mechanism, indicating the importance of the word segmentation for sentiment expression, represents the sentiment embedding vector of the word segmentation, indicating the sentiment feature of the word segmentation, and n represents the number of word segmentations; S5. Calculate the emotional direction relationship and emotional intensity relationship of any two emotional aspect vectors respectively according to the emotional scores of each emotional aspect vector; S6. Perform secondary classification on the emotional direction relationship and emotional intensity relationship of any two emotional aspect vectors to obtain the review sentiment pair label of any two emotional aspect vectors; S7. Obtain all the review sentiment pair labels and their corresponding frequencies in the historical review texts; S8. Assign global review sentiment labels to the historical review texts according to all the review sentiment pair labels and their corresponding frequencies in the historical review texts; S9. Construct sentiment analysis review samples with the emotional aspect vector as the input vector and the global review sentiment label as the target vector; S10. Obtain a number of sentiment analysis review samples, perform supervised learning, and obtain the sentiment analysis model after iteration.

2. The sentiment analysis method based on conversation attention mechanism and dual feature fusion according to claim 1, characterized in that, Preprocessing the historical review texts to generate K word segmentation sets for each historical review text includes: S2-1. Clean the historical review texts to obtain normalized review texts; S2-2. Use a word segmentation tool to disassemble the normalized text into several sentences, and then disassemble each sentence into independent word segmentation sets to obtain the K word segmentation sets.

3. The sentiment analysis method based on conversation attention mechanism and dual-feature fusion according to claim 1, wherein, Performing primary classification based on review aspect keywords for each word segmentation set to obtain the emotional aspect vector of the word segmentation set includes: S3-1. Match and label the words in each word segmentation set according to a preset review aspect keyword dictionary to generate several review aspect classification arrays for each historical review text; Wherein, the review aspect keyword dictionary includes review aspect keywords and their significance scores; The review aspect classification array is represented as a binary array, the first element of which is the review aspect category, and the second element is the significance score of the review aspect category; S3-2. Assign review aspect labels to each word segmentation set according to the review aspect classification array and calculate their label significance scores; The expression for calculating its label significance score is: ; Among them, represents the label significance score of each word segmentation set, and W represents the word segmentation set, which contains all word segmentations of the historical review text. represents the i-th word segmentation in the word segmentation set; represents the set of review aspect keywords corresponding to the review aspect label L in the review aspect keyword dictionary and their significance scores. represents the j-th keyword; is an indicator function, indicating that if the word segmentation matches the keyword in the review aspect keyword dictionary, the value is 1, otherwise it is 0; represents the j-th keyword in the significance score in the review aspect keyword dictionary; S3-3. Define the review aspect label, label significance score and word segmentation combination as the emotional aspect vector of the historical review text.

4. The emotional analysis method based on conversation attention mechanism and dual-feature fusion according to claim 1, characterized in that Based on the sentiment scores of each sentiment aspect vector, calculate the sentiment direction relationship and sentiment intensity relationship between any two sentiment aspect vectors respectively, including: S5-1. Determine the sentiment direction relationship between any two sentiment aspect vectors according to the signs of any two sentiment scores; S5-2. Determine the sentiment intensity relationship between any two sentiment aspect vectors according to the absolute value difference of any two sentiment scores; S5-3. Output the sentiment direction relationship and sentiment intensity relationship between any two sentiment aspect vectors.

5. The emotional analysis method based on conversation attention mechanism and dual feature fusion according to claim 4, characterized in that Determine the sentiment direction relationship between any two sentiment aspect vectors according to the signs of any two sentiment scores, including: S5-1-1. Compare the positive and negative signs of the sentiment scores of two sentiment aspect vectors and perform sentiment direction relationship judgment; S5-1-2. If the signs of the two sentiment scores are the same, output the sentiment direction relationship as consistent; S5-1-3. If one or both of the sentiment scores are zero, output the sentiment direction relationship as neutral; S5-1-4. If the signs of the sentiment scores are opposite, calculate the difference between the two sentiment scores and judge the sentiment direction relationship with opposite signs; If the absolute value difference of the difference is greater than the score difference threshold, output the sentiment direction relationship as significantly opposite; If the absolute value is less than or equal to the score difference threshold, output the sentiment direction relationship as vaguely opposite.

6. The sentiment analysis method based on conversation attention mechanism and dual-feature fusion according to claim 4, characterized in that Determine the sentiment intensity relationship between any two sentiment aspect vectors according to the absolute value difference of any two sentiment scores, including: S5-2-1. Calculate the absolute value difference of the sentiment scores of two sentiment aspect vectors and perform sentiment intensity relationship judgment; S5-2-2. If the absolute value difference is less than the first intensity threshold, output the sentiment intensity relationship as intensity close; S5-2-3. If the absolute value difference is between the first intensity threshold and the second intensity threshold, output the sentiment intensity relationship as intensity partially different; S5-2-4. If the absolute value difference is greater than the second intensity threshold, output the sentiment intensity relationship as intensity significantly different.

7. The method for sentiment analysis based on conversation attention mechanism and dual feature fusion according to claim 6, wherein Perform secondary classification on the sentiment direction relationship and sentiment intensity relationship of any two sentiment aspect vectors to obtain the comment sentiment pair label of any two sentiment aspect vectors, including: S6-1. Obtain the sentiment direction relationship and sentiment intensity relationship of any two sentiment aspect vectors; S6-2. Combine the sentiment direction relationship and sentiment intensity relationship of any two sentiment aspect vectors to obtain the comprehensive sentiment relationship; S6-3. Substitute the comprehensive sentiment relationship into the preset sentiment classification summary rule to obtain the comment sentiment pair label.

8. The sentiment analysis method based on conversation attention mechanism and dual feature fusion according to claim 1, characterized in that Assign a comment sentiment global label to the historical comment text according to all the comment sentiment pair labels and their corresponding frequencies in the historical comment text, including: S8-1. Obtain the corresponding frequency of each comment sentiment pair label; S8-2. Sort each comment sentiment pair label based on the corresponding frequency of each comment sentiment pair label; S8-3. Define the comment sentiment pair label ranked first as the comment sentiment global label of the historical comment text.

9. The emotional analysis method based on conversation attention mechanism and dual-feature fusion according to claim 1, characterized in that, Obtain several sentiment analysis comment samples, perform supervised learning, and obtain the sentiment analysis model after iteration, including: S10-1. Extract the initial batch of sentiment analysis comment samples, input them into the supervised model, and perform forward propagation on them to generate the global prediction labels of the comment sentiment for the current batch; S10-2. Use the loss function to calculate the multi-class cross-entropy loss between the global prediction labels of the comment sentiment and the global labels of the comment sentiment; The expression of the multi-class cross-entropy loss is as follows: ; Among them, L represents the multi-class cross-entropy loss, N represents the number of sentiment analysis comment samples, C represents the number of categories of the global sentiment labels of the comments, represents the true label of the i-th sentiment analysis comment sample in the category of the global sentiment label of the comment, represents the predicted probability of the i-th sentiment analysis comment sample in the category of the global sentiment label of the comment; S10-3. Perform backpropagation of the supervised model to generate updated model parameters; S10-4. Repeat S10-1 to S10-2 using the updated model parameters until the cross-entropy loss is minimized.

Citation Information

Patent Citations

  • Aspect-level sentiment analysis method based on composition tree and multiple attention mechanisms

    CN119005203A

  • Sentiment classification method and device based on document-level sentiment tendency, equipment and medium

    CN113849651A

  • Dialogue analysis-oriented graph confrontation emotion recognition method and system in Internet of Things environment

    CN119474329A