Sentiment analysis method and system based on conversation attention mechanism and double-feature fusion

Through the emotion analysis method based on the conversation attention mechanism and the fusion of dual features, the commentary emotional pair tag is generated, which solves the problem that the existing technology is difficult to capture different aspects of emotional expression, and realizes the accurate analysis of obscure or complex emotions in the comment text.

CN120067335AActive Publication Date: 2025-05-30CHAOHU UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510280490.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-05-30
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 fine-grained manner, especially when the emotional expression of the comment text is relatively obscure or the semantics are complex, it is difficult to extract effective emotional characteristics.

Method used

A sentiment analysis method based on conversation attention mechanism and dual-feature fusion is adopted. By obtaining comment text, emotional vectors are generated, and a pre-trained emotion analysis model is used for forward propagation, and the global label of comment emotion is output. This method calculates the relationship between emotional direction and emotional intensity, generates commentary emotional tags, and achieves accurate capture of emotions in different aspects.

Benefits of technology

It realizes accurate identification and analysis of different aspects of emotions in the comment text, which can effectively capture obscure or complex emotional expressions and provide more fine-grained emotional analysis results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067335A_ABST
    Figure CN120067335A_ABST
Patent Text Reader

Abstract

The invention discloses an emotion analysis method and system based on a conversation attention mechanism and double-feature fusion. The method comprises the steps of obtaining a current comment text; preprocessing the current comment text to generate an emotional aspect vector of the current comment text; inputting the sentiment aspect vector of the current comment text into a pre-trained sentiment analysis model; executing forward propagation on the emotion aspect vector of the current comment text, and outputting a comment emotion global label of the current comment text; by generating the comment emotion pair label, emotion expressions in different aspects in the comment text can be captured; in the comment that the course content is very excellent, but the teaching mode is boring, the emotion pair labels can label the course content as positive emotion and the teaching mode as negative emotion respectively, so that more accurate emotion analysis is realized.
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 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 completely different or even contradictory. The patent document with the patent publication number CN119005203A discloses an aspect-level sentiment analysis method based on a composition tree and a multi-attention mechanism. This method combines an aspect-aware attention mechanism and a self-attention mechanism to extract the semantic vector of the target text, uses a 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 an interaction on the above semantic vector and syntactic vector based on a 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: 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 tendencies of specific aspects.

[0003] 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 by simple overall feature extraction. Summary of the Invention

[0004] 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.

[0005] In a first aspect, the present invention provides a sentiment analysis method based on conversation attention mechanism and dual-feature fusion, including: Obtain the current review text; Preprocess the current review text to generate a sentiment aspect vector of the current review text; Input the sentiment aspect vector of the current review text into a pre-trained sentiment analysis model; 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; 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 secondary classification on the sentiment direction relationship and sentiment intensity relationship of any two sentiment aspect vectors.

[0006] In some embodiments thereof, the modeling steps of the sentiment analysis model include: S1. Obtain historical review texts; S2. Preprocess the historical review texts to generate N 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 sentiment aspect vector of the word segmentation set; S4. Calculate the sentiment score of each sentiment 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.

[0007] S5. According to the sentiment scores of each sentiment aspect vector, calculate the sentiment direction relationship and sentiment intensity relationship of any two sentiment aspect vectors respectively; S6. Perform secondary 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; S7. Obtain all review sentiment pair labels and their corresponding frequencies in the historical review texts; S8. According to all review sentiment pair labels and their corresponding frequencies in the historical review texts, assign global review sentiment labels to the historical review texts; S9. Use the sentiment aspect vector as the input vector and the global review sentiment label as the target vector to construct a sentiment analysis review sample; S10. Obtain several sentiment analysis review samples, perform supervised learning, and obtain the sentiment analysis model after iteration.

[0008] In some embodiments thereof, preprocessing the historical review texts to generate N 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 break down the normalized text into several sentences, and then break down each sentence into an independent set of segmented words to obtain the N sets of segmented words.

[0009] In some of these embodiments, perform an initial classification based on the keywords of the review aspect for each set of segmented words to obtain the sentiment aspect vector of the set of segmented words, including: S3-1. According to the preset dictionary of keywords of the review aspect, match and label the words in each set of segmented words to generate N arrays of classifications of the review aspect for each historical review text; Among them, the dictionary of keywords of the review aspect contains the keywords of the review aspect and their significance scores; The array of classifications of the review aspect is represented as a binary array, the first element of which is the category of the review aspect, and the second element is the significance score of the category of the review aspect; S3-2. According to the array of classifications of the review aspect, assign a label of the review aspect to each set of segmented words and calculate its label significance score; The expression for calculating its label significance score is: ; Among them, represents the label significance score of each set of segmented words, W represents the set of segmented words, including all the segmented words of the historical review text, represents the i-th segmented word in the set of segmented words; represents the set of keywords of the review aspect and their significance scores corresponding to the label L of the review aspect in the dictionary of keywords of the review aspect, represents the j-th keyword; is an indicator function, indicating that if the segmented word matches the keyword in the dictionary of keywords of the review aspect, the value is 1, otherwise it is 0; represents the significance score of the j-th keyword in the dictionary of keywords of the review aspect; S3-3. Define the label of the review aspect, the label significance score, and the combination of segmented words as the sentiment aspect vector of the historical review text.

[0010] In some of these embodiments, according to the sentiment scores of each sentiment aspect vector, calculate the sentiment direction relationship and the 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 emotional direction relationship and emotional intensity relationship between any two emotional aspect vectors.

[0011] In some embodiments, according to the signs of any two emotional scores, determine the emotional direction relationship between any two emotional aspect vectors, including: S5-1-1. Compare the positive and negative signs of the emotional scores of two emotional aspect vectors, and perform the judgment of the emotional direction relationship; S5-1-2. If the signs of the two emotional scores are the same, output that the emotional direction relationship is consistent; S5-1-3. If one or both of the emotional scores are zero, output that the emotional direction relationship is neutral.

[0012] S5-1-4. If the signs of the emotional scores are opposite, calculate the difference between the two emotional scores, and judge the emotional direction relationship with opposite signs; If the absolute value of the difference is greater than the score difference threshold, output that the emotional direction relationship is significantly opposite; If the absolute value of the difference is less than or equal to the score difference threshold, output that the emotional direction relationship is vaguely opposite.

[0013] In some embodiments, according to the absolute value difference between any two emotional scores, determine the emotional intensity relationship between any two emotional aspect vectors, including: S5-2-1. Calculate the absolute value difference between the emotional scores of two emotional aspect vectors, and perform the judgment of the emotional intensity relationship; S5-2-2. If the absolute value difference is less than the first intensity threshold, output that the emotional intensity relationship is close in intensity; S5-2-3. If the absolute value difference is between the first intensity threshold and the second intensity threshold, output that the emotional intensity relationship is partially different in intensity; S5-2-4. If the absolute value difference is greater than the second intensity threshold, output that the emotional intensity relationship is significantly different in intensity.

[0014] In some embodiments, perform secondary classification on the emotional direction relationship and emotional intensity relationship between any two emotional aspect vectors to obtain the comment emotion pair label for any two emotional aspect vectors, including: S6-1. Obtain the emotional direction relationship and emotional intensity relationship between any two emotional aspect vectors; S6-2. Combine the emotional direction relationship and emotional intensity relationship between any two emotional aspect vectors to obtain the comprehensive emotional relationship; S6-3. Substitute the comprehensive emotional relationship into the preset emotional classification summary rule to obtain the comment emotion pair label.

[0015] In some of these embodiments, according to all the comment sentiments in the historical review text for the tags and their corresponding frequencies, a global comment sentiment tag is assigned to the historical review text, including: S8-1. Obtain the corresponding frequency of each comment sentiment pair tag; S8-2. Based on the corresponding frequency of each comment sentiment pair tag, sort each comment sentiment pair tag; S8-3. Define the comment sentiment pair tag ranked first as the global comment sentiment tag of the historical review text.

[0016] In some of these embodiments, a number of sentiment analysis comment samples are obtained and supervised learning is performed. After iteration, the sentiment analysis model is obtained, including: S10-1. Extract an initial batch of sentiment analysis comment samples, input them into the supervised model, and perform forward propagation on them to generate the global predicted comment sentiment tags for the current batch; S10-2. Use the loss function to calculate the multi-class cross-entropy loss between the global predicted comment sentiment tags and the global comment sentiment tags; The expression of the multi-class cross-entropy loss is: ; 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 comment sentiment tags, represents the true label of the i-th sentiment analysis comment sample in the category of the global comment sentiment tag, represents the predicted probability of the i-th sentiment analysis comment sample in the category of the global comment sentiment tag; S10-3. Perform backpropagation of the supervised model to generate updated model parameters; 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.

[0017] By generating "comment sentiment pair tags", the present invention can capture the sentiment expressions in different aspects of the review text. For example, in the comment "The course content is very excellent, but the teaching method is boring", the sentiment pair tags can respectively label the course content with positive sentiment and the teaching method with negative sentiment, thus achieving more accurate sentiment analysis.

[0018] Moreover, by using the conversation attention mechanism and the dual-feature fusion technology, the present invention can mine the implicit emotional tendencies in review texts. 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 emotion pair tags, the negative emotion of the course content and the neutral emotion of the teaching method can be respectively judged, providing a solution for the analysis of complex texts.

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

[0020] Furthermore, by modeling the emotion pair tags (local context) and the global label of the overall review emotion (global context), the combination of local fine-grained analysis and overall emotion judgment is achieved. It can not only separately judge the emotions of specific aspects, but also comprehensively evaluate the emotional 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.

[0021] In the second aspect, the present invention provides an emotion analysis system based on the conversation attention mechanism and dual-feature fusion, including: A review text acquisition module for acquiring the current review text; An emotion aspect vector module for preprocessing the current review text to generate an emotion aspect vector of the current review text; An emotion analysis module for inputting the emotion aspect vector of the current review text into a pre-trained emotion analysis model; A global emotion output module for performing forward propagation on the emotion aspect vector of the current review text and outputting a global label of the review emotion of the current review text.

[0022] Compared with the prior art, the beneficial effects of the emotion analysis system based on the conversation attention mechanism and dual-feature fusion of the present invention are the same as those of the emotion 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

[0023] Figure 1 It is a flowchart of the emotion analysis method based on the conversation attention mechanism and dual-feature fusion of the present invention; Figure 2 It is a schematic diagram of the modeling steps of the emotion analysis model of the present invention; Figure 3 It is a structural block diagram of the emotion analysis system based on the conversation attention mechanism and dual-feature fusion of the present invention. Specific Embodiment

[0024] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to 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 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.

[0025] Embodiment 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: Step 1, obtain the current review text; Step 2, preprocess the current review text to generate an emotion aspect vector of the current review text; Step 3, input the emotion aspect vector of the current review text into a pre-trained emotion analysis model; Step 4, perform forward propagation on the emotion aspect vector of the current review text, and output the global comment emotion label of the current review text; 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.

[0026] 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 real-time emotion analysis requirements. Based on the emotion aspect vector generated by preprocessing, the core emotions in multiple aspects of 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.

[0027] 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: S1, obtain historical review texts; S2, preprocess the historical review texts to generate N word segmentation sets for each historical review text; S3, perform primary classification based on comment aspect keywords for each word segmentation set to obtain the emotion aspect vector of the word segmentation set; S4, calculate the emotion score of each emotion 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 conversational 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.

[0028] Among them, the calculation of the sentiment score can be carried out based on the conversational main attention mechanism. Specifically, the conversational attention mechanism (Conversational Attention Mechanism) refers to a variant of the attention mechanism in deep learning, which is used to capture the importance of different parts (such as word segmentations, phrases) in the input data in a specific context or task. Its core idea is: Assign a dynamic weight (attention weight) to each element (such as word or word segmentation feature vector) in the input data, and the size of the weight reflects the importance of the element for the current task (such as sentiment analysis).

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

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

[0031] By calculating the dot product of the sentiment aspect vector and the input word segmentation feature representation, and calculating the dot product sum and the weight of the dot product sum, the attention weight is obtained. The sentiment embedding vector is obtained by using a pre-trained sentiment word vector model (such as Word2Vec, GloVe) or a context-aware model (Bert or Transformer), so as to generate a sentiment embedding vector for each word segmentation.

[0032] S5. 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; S6. Perform a binary classification on the sentiment direction relationship and sentiment intensity relationship between any two sentiment aspect vectors to obtain the comment sentiment pair label of any two sentiment aspect vectors; S7. Obtain all the comment sentiment pair labels and their corresponding frequencies in the historical review text; S8. According to all the comment sentiment pair labels and their corresponding frequencies in the historical review text, assign a comment sentiment global label to the historical review text; 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; S10. Obtain a number of sentiment analysis comment samples, perform supervised learning, and obtain the sentiment analysis model after iteration.

[0033] In this embodiment, by obtaining historical comment texts, performing word segmentation, classification, and extraction of sentiment feature representations on them, and combining a sentiment analysis model with a conversation attention mechanism and dual-feature fusion, the sentiment of different aspects in the comment text is accurately quantified and modeled; among them, the historical comment texts are a large number of original experimental course comment data collected from an online experimental course platform, and these data should cover different courses, different experiments, and various feedbacks from students to ensure the comprehensiveness and diversity of the data.

[0034] Specifically, the modeling step S2 includes: S2-1. Clean the historical comment text to obtain a normalized comment text; Exemplarily, the text cleaning includes: Delete the noise information in the historical comment text; such as advertisements, URL links, emojis, etc.; Standardize the case and full-width and half-width symbols in the historical comment text; Use a stop word list to remove words that are meaningless for comment aspect classification, for example, "de", "le", "shi", etc.; 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 K word segmentation sets.

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

[0036] Disassemble it into a word segmentation set: [course, content, very, clear, teaching, method, not, interesting enough] Word segmentation tools such as BERT and SpaCy can be used.

[0037] In this embodiment, through text cleaning, word segmentation, and normalization processing of historical comment texts, noise information is removed, the quality of the input data is ensured, and high-quality word segmentation set inputs are provided for subsequent aspect classification and sentiment analysis.

[0038] Specifically, the modeling step S3 includes: S3-1. According to a preset comment aspect keyword dictionary, match and label the words in each word segmentation set to generate several comment aspect classification arrays for each historical comment text; Among them, the comment aspect keyword dictionary contains comment aspect keywords and their significance scores, which are used to classify and score the words in the word segmentation set.

[0039] The comment aspect classification array is represented as a binary array, where the first element is the comment aspect category and the second element is the significance score of the comment aspect category; S3-2. According to the comment aspect classification array, assign comment aspect labels to each word segmentation set 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, W represents the word segmentation set, including all word segments of the historical review text, represents the i-th word segment 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 segment matches the keyword in the comment aspect keyword dictionary, the value is 1, otherwise it is 0; represents the j-th keyword in the significance score in the comment aspect keyword dictionary; S3-3. Define the comment aspect label, label significance score and word segment combination as the sentiment aspect vector of the historical review text.

[0040] 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 and providing a data basis for the global sentiment calculation of the model.

[0041] Specifically, the modeling step S5 includes: 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 between any two sentiment scores; S5-3. Output the sentiment direction relationship and sentiment intensity relationship between any two sentiment aspect vectors.

[0042] In this embodiment, by calculating the sentiment direction relationship and sentiment intensity relationship of the sentiment aspect vector, the sentiment association between different aspects is clarified.

[0043] Further, the modeling step S5-1 further includes: S5-1-1. Compare the signs of the sentiment scores of the two sentiment aspect vectors and perform sentiment direction relationship judgment; S5-1-2. If the signs of the two sentiment scores are the same (for example, both are positive or both are negative), then output that the sentiment direction relationship is consistent; S5-1-3. If one or both of the sentiment scores are zero, then output that the sentiment direction relationship is neutral.

[0044] S5-1-4. If the signs of the sentiment scores are opposite (one is positive and the other is negative), then calculate the difference between the two sentiment scores and judge the sentiment direction relationship with opposite signs; If the absolute value of the difference is greater than the score difference threshold, then output that the sentiment direction relationship is significantly opposite; If the absolute value of the difference is less than or equal to the score difference threshold, then output that the sentiment direction relationship is vaguely opposite.

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

[0046] Further, the modeling step S5-2 further includes: S5-2-1. Calculate the absolute value difference of the sentiment scores of the two sentiment aspect vectors and perform sentiment intensity relationship judgment; by calculating the absolute value difference of the sentiment scores of the two feature vectors, it is used to quantify the intensity difference of the sentiment expressions in the two aspects.

[0047] S5-2-2. If the absolute value difference is less than the first intensity threshold, then output that the sentiment intensity relationship is close in intensity; when the sentiment intensity difference between the two aspects is small (such as within the preset threshold), it indicates that the sentiment expression intensities of the user for the two aspects are basically the same.

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

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

[0050] 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 divided into three relationships: close in intensity, partially different in intensity, and significantly different in intensity according to the intensity difference. It captures the fine-grained intensity changes of the user's emotional expressions in different aspects, and reveals the differences in the user's expressed concerns and emotional intensities in the comments.

[0051] Specifically, the modeling step S6 includes: S6-1. Obtain the emotional direction relationship and emotional intensity relationship of any two emotional aspect vectors; S6-2. Combine the emotional direction relationship and emotional intensity relationship of any two emotional aspect vectors to obtain an emotional comprehensive relationship; S6-3. Substitute the emotional comprehensive relationship into the preset emotional classification and summarization rules to obtain the comment emotion pair label.

[0052] Specifically, the emotional classification and summarization rules are: Combine the emotional direction relationship and emotional intensity relationship, and assign a preset global emotion label to the combined emotional comprehensive relationship; the emotional classification and summarization rules are as follows: The global emotion label for consistent direction + close in intensity is: highly consistent in emotion; The global emotion label for consistent direction + partially different in intensity is: somewhat consistent in emotion preference; The global emotion label for consistent direction + significantly different in intensity is: significantly biased in emotion tendency; The global emotion label for significantly opposite directions + close in intensity is: balanced opposition in emotion; The global emotion label for significantly opposite directions + partially different in intensity is: mild opposition in emotion; The global emotion label for significantly opposite directions + significantly different in intensity is: strong opposition in emotion; The global emotion label for vaguely opposite directions + close in intensity is: vague opposition in emotion; The global emotion label for vaguely opposite directions + partially different in intensity is: slight conflict in emotion; The global emotion label for vaguely opposite directions + significantly different in intensity is: mild deviation in emotion; The global emotion label for neutral direction + close in intensity is: balanced neutrality in emotion; The global emotion label for neutral direction + partially different in intensity is: mild tendency in emotion; The emotional global label with direction neutrality + significant intensity difference is: strong emotional tendency.

[0053] Among them, High emotional consistency is characterized by: the emotional directions of two aspects are the same, and the 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 expressed as high emotional consistency with the same direction and close intensity.

[0054] Partial emotional consistency is characterized by: the emotional directions of two aspects are the same, but there is a certain intensity difference, 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 expressed as partial emotional consistency with the same direction and partial intensity difference.

[0055] Significantly partial emotional tendency is characterized by: the emotional directions of 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 expressed as significantly partial emotional tendency with the same direction and significant intensity difference.

[0056] Balanced emotional opposition is characterized by: the emotional directions of two aspects are completely opposite, but the intensities are similar, indicating that the user's evaluations of the two aspects have a balanced contradiction. For example, "The course content is very good" (+3), "The teaching method is very bad" (-3); it can be expressed as balanced emotional opposition with significantly opposite directions and close intensities.

[0057] Slightly emotional opposition is characterized by: the emotional directions of 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 very good" (+4), "The teaching method is a bit boring" (-2); it can be expressed as slightly emotional opposition with significantly opposite directions and partial intensity difference.

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

[0059] Vague emotional opposition is characterized by: there is a slight opposition in the emotional directions of two aspects, but the intensities are close, 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 vague emotional opposition with opposite directions and close intensities.

[0060] Slight emotional conflict is characterized by: there is a slight opposition in the emotional directions of two aspects, but the intensity difference is not significant, 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 described as a slight emotional conflict with a vague directional opposition and a partial intensity difference.

[0061] Mild emotional deviation is characterized by: there is a slight opposition in the emotional directions of two aspects, and the intensity difference is large, indicating that the user has a certain deviation in emotions towards the two aspects. For example, "The course content is very good" (+5), "The teaching method is a bit poor" (-2); it can be described as a mild emotional deviation with a directional opposition and a significant intensity difference.

[0062] Balanced emotional neutrality is characterized by: the emotional directions of 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 described as balanced emotional neutrality towards neutrality with a close intensity.

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

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

[0065] The summary table of the above-mentioned emotional classification and summarization rules is as follows: 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 strength difference Same direction Partial strength difference Emotional emphasis is the same The two aspects have the same direction, but the strength difference is large Same direction Significant strength difference Emotional tendency is significantly biased The two aspects have the same direction, but one aspect has a stronger emotion Significant direction opposition Strengths are close Emotions are evenly opposed The two aspects have opposite directions, but the strengths are close Significant direction opposition Partial strength difference Slight emotional opposition The two aspects have opposite directions, but the strength difference is small Significant direction opposition Significant strength difference Strong emotional opposition The two aspects have opposite directions and a significant strength difference Vague direction opposition Strengths are close Vague emotional opposition The two aspects have slightly opposite directions and the strengths are close Vague direction opposition Partial strength difference Slight emotional conflict The two aspects have slightly opposite directions and the strength difference is not large Vague direction opposition Significant strength difference Slight emotional deviation The two aspects have slightly opposite directions, but the strength difference is large Neutral direction Strengths are close Emotions are evenly neutral At least one aspect is neutral and the strengths are close Neutral direction Partial strength difference Slight emotional tendency At least one aspect is neutral and one aspect is slightly stronger Neutral direction Significant strength difference Strong emotional tendency At least one aspect is neutral and one aspect is significantly stronger Among them, the comment emotion pair label is based on local context information, and by capturing the emotional direction relationship and emotional intensity relationship of any two emotional aspect vectors, the comment emotion pair label is generated. The emotional direction and intensity relationship in the local context reflect the user's specific emotional expression towards the local aspects in the text, providing a more refined emotional granularity analysis.

[0066] In this embodiment, by combining the emotional direction relationship and the emotional intensity relationship, the emotional interaction between any two emotional aspect vectors is described in the form of a comprehensive relationship, and comment emotion pair labels are generated based on preset emotion 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 global emotion calculation and general analysis of the overall emotional characteristics of the text.

[0067] Specifically, the modeling step S8 includes: S8-1. Obtain the corresponding frequency of each comment emotion pair label; S8-2. Sort each comment emotion pair label based on the corresponding frequency of each comment emotion pair label; S8-3. Define the comment emotion global label of the historical comment text as the comment emotion pair label ranked first.

[0068] The comment emotion global label of the overall text is generated through global context information. Based on the statistical frequency and relative weight of all comment emotion pair labels in the historical comment text, it reflects the user's global emotional expression of the overall text. The comment emotion global label in the global context integrates the information of local emotion pair labels and provides a global-oriented emotion classification result.

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

[0070] Specifically, the modeling step S10 includes: S10-1. Extract the initial batch of emotion analysis comment samples, input them into the supervised model, and perform forward propagation on them to generate the current batch of comment emotion global prediction labels; S10-2. Use the loss function to calculate the multi-class cross-entropy loss between the comment emotion global prediction label and the comment emotion global label; The expression of the multi-class cross-entropy loss is: ; where L represents the multi-class cross-entropy loss, N represents the number of emotion analysis comment samples, C represents the number of categories of the comment emotion global label, represents the true label of the i-th emotion analysis comment sample in the category of the comment emotion global label, Represents the predicted probability of the i-th sentiment analysis comment sample on the comment sentiment global label category.

[0071] S10-3, performing back propagation 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.

[0072] This embodiment gradually optimizes the initial sentiment analysis model through a supervised learning method based on a multi-category cross entropy loss function. During the training process, the predicted labels are generated through forward propagation, and the loss is calculated using the real labels. The model parameters are then updated through back propagation, and the loss function is minimized in rounds. Finally, the optimized sentiment analysis model is obtained. This method makes full use of the multi-category features of the global sentiment labels during the model training process, combines the sentiment direction relationship and the intensity relationship, and achieves a more accurate global sentiment classification, providing a highly robust and generalized model framework for sentiment analysis tasks.

[0073] This embodiment demonstrates the modeling of a sentiment classification model by fusing local features with global context features, where the local context emphasizes the fine-grained association with the target word or aspect, while the global context captures long-distance comment text. The two features are fused to improve the accuracy of sentiment classification. Example 3: See Figures 1 to 3 , the technical solution of this embodiment 3 is different from that of embodiments 1 and 2 in that a sentiment analysis system based on a conversation attention mechanism and dual-feature fusion is also provided, and the system is used to implement the above method embodiments, which have been described and will not be repeated here. The terms "module", "unit", "sub-unit", etc. used below can be a combination of software and / or hardware that implements predetermined functions. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0074] like Figure 3 As shown, 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, and the system includes: Comment text acquisition module, used to obtain the current comment text; The sentiment aspect vector module pre-processes the current comment text to generate a sentiment aspect vector of the current comment text; Sentiment analysis module, which inputs the sentiment vector of the current comment text into the pre-trained sentiment analysis model; The global sentiment output module performs forward propagation on the sentiment aspect vector of the current review text and outputs the global review sentiment label of the current review text.

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

[0076] 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 computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as infrared, wireless, microwave, etc.).

[0077] The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more collections of available media. The available media can be magnetic media (e.g., floppy disk, hard disk, magnetic tape), optical media (e.g., DVD ), or semiconductor media. The semiconductor media can be a solid-state drive.

[0078] 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, and the indirect couplings or communication connections of systems or units can be in electrical, mechanical, or other forms.

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

Claims

1. A sentiment analysis method based on conversation attention mechanism and dual feature fusion, characterized in that: include: Get the current comment text; Preprocessing the current comment text to generate a sentiment aspect vector of the current comment text; Input the sentiment vector of the current review text into the pre-trained sentiment analysis model; Perform forward propagation on the sentiment aspect vector of the current comment text, and output a global comment sentiment label of the current comment text; The comment sentiment global label is defined by the comment sentiment pair label that ranks first in the current comment text frequency, and the comment sentiment pair label is generated by performing secondary classification of the sentiment direction relationship and sentiment intensity relationship between any two sentiment aspect vectors.

2. The sentiment analysis method based on conversation attention mechanism and dual feature fusion according to claim 1 is characterized in that: The modeling steps of the sentiment analysis model include: S1. Obtain historical comment text; S2, preprocess the historical comment text to generate K word segmentation sets for each historical comment text; S3, performing a primary classification based on the review keywords for each word segmentation set to obtain the sentiment vector of the word segmentation set; S4, calculating the sentiment score of each sentiment aspect vector; Among them, the expression for calculating the sentiment score of each sentiment aspect vector is: ; in, represents the sentiment score of each sentiment aspect vector, Indicates the attention weight assigned by the conversation attention mechanism, indicating the importance of word segmentation to emotional expression, The sentiment embedding vector represents the sentiment feature of the word, and n represents the number of words; S5. Calculate the emotion direction relationship and emotion intensity relationship between any two emotion aspect vectors according to the emotion score of each emotion aspect vector; S6, performing secondary classification for the sentiment direction relationship and sentiment intensity relationship between any two sentiment aspect vectors, and obtaining comment sentiment pair labels for any two sentiment aspect vectors; S7, obtaining all comment sentiment pair labels and their corresponding frequencies in the historical comment text; S8, assigning a comment sentiment global label to the historical comment text according to all comment sentiment pair labels and their corresponding frequencies in the historical comment text; S9, taking the sentiment aspect vector as the input vector and the comment sentiment global label as the target vector, constructing a sentiment analysis comment sample; S10. Obtain a number of sentiment analysis review samples, perform supervised learning, and obtain the sentiment analysis model after iteration.

3. The sentiment analysis method based on conversation attention mechanism and dual feature fusion according to claim 2 is characterized in that: Preprocess the historical comment text to generate K word segmentation sets for each historical comment text, including: S2-1, perform text cleaning on historical comment texts to obtain standardized comment texts; 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.

4. The sentiment analysis method based on conversation attention mechanism and dual feature fusion according to claim 1 is characterized in that: Perform the initial classification based on the review keywords for each word segmentation set to obtain the sentiment vector of the word segmentation set, including: S3-1, according to the preset comment aspect keyword dictionary, match and mark the words in each word segmentation set to generate several comment aspect classification arrays for each historical comment text; The review keyword dictionary includes review keywords and their significance scores; The comment aspect classification array is represented as a binary array, the first element of which is the comment aspect category, and the second element is the significance score of the comment aspect category; S3-2, assigning a comment aspect label to each word segmentation set according to the comment aspect classification array, and calculating its label significance score; The expression for calculating the label significance score is: ; in, represents the label significance score of each word segmentation set, W represents the word segmentation set, including all the word segments of the historical review text, Represents the i-th participle in the participle 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 jth keyword; is an indicator function, indicating that if the word Keywords in the keyword dictionary for comments If it matches, the value is 1, otherwise it is 0; Indicates the jth keyword The significance score of the keyword dictionary in the review; S3-3. Define the comment aspect label, label significance score and word segmentation combination as the sentiment aspect vector of the historical comment text.

5. The sentiment analysis method based on conversation attention mechanism and dual feature fusion according to claim 2 is characterized in that: According to the sentiment score of each sentiment aspect vector, the sentiment direction relationship and sentiment intensity relationship between any two sentiment aspect vectors are calculated respectively, including: S5-1, determining the sentiment direction relationship between any two sentiment aspect vectors according to the signs of any two sentiment scores; S5-2, determining the sentiment intensity relationship between any two sentiment aspect vectors according to the absolute value difference between any two sentiment scores; S5-3. Output the emotion direction relationship and emotion intensity relationship between any two emotion aspect vectors.

6. The sentiment analysis method based on conversation attention mechanism and dual feature fusion according to claim 4 is characterized in that: According to the signs of any two sentiment scores, the sentiment direction relationship between any two sentiment aspect vectors is determined, including: S5-1-1, compare the signs of the sentiment scores of the two sentiment aspect vectors and perform sentiment direction relationship judgment; S5-1-2. If the two sentiment scores have the same sign, the output sentiment direction relationship is consistent. S5-1-3, if one or both of the sentiment scores are zero, the output sentiment direction relationship is directionally neutral; S5-1-4, if the sentiment scores have opposite signs, then calculate the difference between the two sentiment scores and determine the sentiment direction relationship with opposite signs; If the absolute value of the difference is greater than the score difference threshold, the output sentiment direction relationship is significantly opposite; If the absolute value of the difference is less than or equal to the score difference threshold, the output sentiment direction relationship is fuzzy direction opposition.

7. The sentiment analysis method based on conversation attention mechanism and dual feature fusion according to claim 4 is characterized in that: According to the absolute value difference of any two sentiment scores, the sentiment intensity relationship between any two sentiment aspect vectors is determined, including: S5-2-1, calculating the absolute value difference of the sentiment scores of the two sentiment aspect vectors, and performing sentiment intensity relationship judgment; S5-2-2, if the absolute value difference is less than the first intensity threshold, the emotion intensity relationship is output as close intensity; S5-2-3, if the absolute value difference is between the first intensity threshold and the second intensity threshold, the output emotion intensity relationship is the intensity partial difference; S5-2-4. If the absolute value difference is greater than the second intensity threshold, the output emotion intensity relationship is a significant intensity difference.

8. The sentiment analysis method based on conversation attention mechanism and dual feature fusion according to claim 6 is characterized in that: Perform secondary classification for the sentiment direction relationship and sentiment intensity relationship of any two sentiment aspect vectors to obtain the comment sentiment pair labels of any two sentiment aspect vectors, including: S6-1, obtaining the emotional direction relationship and emotional intensity relationship between any two emotional aspect vectors; S6-2, combining the emotion direction relationship and the emotion intensity relationship of any two emotion aspect vectors to obtain an emotion comprehensive relationship; S6-3, substituting the comprehensive emotional relationship into the preset emotional classification summary rule to obtain the comment emotional pair label.

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

10. The sentiment analysis method based on conversation attention mechanism and dual feature fusion according to claim 9 is characterized in that: Obtain several sentiment analysis review samples, perform supervised learning, and obtain the sentiment analysis model after iteration, including: S10-1, extract the initial batch of sentiment analysis review samples, input them into the supervised model, and forward propagate them to generate the global prediction label of the current batch of comments sentiment; S10-2. Use the loss function to calculate the multi-category cross entropy loss of the global prediction label of the comment sentiment and the global label of the comment sentiment; The expression of the multi-category cross entropy loss is: ; Among them, L represents the multi-category cross entropy loss, N represents the number of sentiment analysis review 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 comment sentiment global label category, represents the predicted probability of the i-th sentiment analysis comment sample on the comment sentiment global label category; S10-3, performing back propagation 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 text classification method, system and equipment based on attention and storage medium

    CN114218387A

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

    CN119474329A

  • Method and system of identifying and allocating sentiment attribution

    US20240362238A1