Implicit emotion recognition method based on multilevel recognition and user information enhancement
By using multi -layered recognition and user information enhancement technology in hidden emotional recognition methods, the problem of low accuracy of existing methods has been solved, and the recognition ability and accuracy of emotional polarity judgment of hidden -level emotional analysis have been significantly improved. Essence
Patent Information
- Application Number
- CN202411423294.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-01-28
AI Technical Summary
Existing implicit emotion recognition methods have low accuracy, making it difficult to effectively identify implicit aspects and ignore user subjectivity differences to produce different results on the emotional polarity of the text.
Adopt a hidden emotional identification method based on multi -level recognition and user information enhancement, through obtaining the original emotional analysis of the original data set, screening and marking data, pre -processing, and using multi -level knowledge identification and attention mechanism to fusion heterogeneous user knowledge Moved to adjust the model parameters to improve the accuracy of recognition.
It has significantly improved the recognition ability of hidden -level emotional analysis, improves the attention of hidden aspects and the treatment of user subjectivity, and enhances the accuracy of emotional polar judgment.
Smart Images

Figure CN119377735A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of sentiment analysis, and in particular relates to an implicit sentiment recognition method based on multi-level recognition and user information enhancement. Background Art
[0002] With the development of the Internet, posting comments on various social networking sites has become an important way for users to express their own opinions, such as making suggestions for product and service improvements or expressing opinions on current hot topics. The number of online comments has begun to explode. How to accurately and quickly extract key information from massive Internet information has become an important research topic. Sentiment analysis is an important downstream task in natural language processing. It is a study on judging the emotional polarity of people's expressions of entities. According to the granularity of the text, it is divided into coarse-grained sentiment analysis and fine-grained sentiment analysis. Coarse-grained sentiment analysis is a sentiment analysis of the overall aspects of the text. Fine-grained sentiment analysis, also known as aspect-level sentiment analysis, is a judgment of the sentiment polarity of various aspects of the text. Because the aspect features of the text may be explicit or implicit, implicit sentiment analysis is a judgment of the sentiment polarity of language judgments that do not have obvious sentiment words but can clearly express subjective emotions.
[0003] Among the text processing research methods in sentiment analysis, the corpus-based method is to compare the similarity of texts based on data obtained from a large corpus, such as the commonly used topic model, which obtains global knowledge from the corpus and can be applied to scenarios that need to pay attention to hidden information. Or use the normalized Google distance of the search engine, given a keyword, let the search engine return the similarity score of the click-through rate of the given keyword on the same web page to judge the association between texts and extract keywords. Because explicit words are easier to extract in the subtask of aspect extraction, most of the implicit aspect recognition methods are based on co-occurrence with explicit aspects, a single method to find synonyms of explicit aspects, or use a defined dictionary to identify the implicit goal of user opinions; however, the above methods will lead to a decrease in the accuracy of implicit sentiment recognition methods. Summary of the invention
[0004] In order to solve the problems existing in the above-mentioned prior art, the present invention proposes an implicit emotion recognition method based on multi-level recognition and user information enhancement, the method comprising: obtaining text data to be recognized, inputting the text data into a trained implicit emotion recognition model to obtain a recognition result; training the implicit emotion recognition model comprises: obtaining an original data set of aspect-level emotion analysis, screening and annotating the original data set to obtain training samples and test samples; preprocessing the training samples and the test samples; inputting the preprocessed data into the implicit emotion recognition model, and extracting the implicit emotion features of the preprocessed data by using a multi-level knowledge recognition method; constructing a heterogeneous user knowledge layer for the preprocessed data; using an attention mechanism to fuse the implicit emotion features and the heterogeneous user knowledge layer; inputting the fused features into a classifier to obtain a recognition result; calculating the loss function of the model according to the recognition result, adjusting the model parameters, and training the model with test samples, and completing the model training when the loss function converges.
[0005] Beneficial effects of the present invention:
[0006] The present invention effectively improves the problems of not paying attention to implicit aspects, identifying implicit aspects with a single method, ignoring the different subjective differences of different users and producing different results on the sentiment polarity of the text, and significantly improves the recognition ability of implicit aspect-level sentiment analysis in aspect extraction and opinion extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] Figure 1 It is a flow chart of the implicit emotion recognition method based on multi-level recognition and user information enhancement of the present invention;
[0008] Figure 2 It is a schematic diagram of a heterogeneous user knowledge enhancement module of the implicit emotion recognition method based on multi-level recognition and user information enhancement of the present invention;
[0009] Figure 3 This is a schematic diagram of the stacked attention mechanism model structure of the implicit emotion recognition method based on multi-level recognition and user information enhancement of the present invention. DETAILED DESCRIPTION
[0010] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0011] An implicit emotion recognition method based on multi-level recognition and user information enhancement, such as Figure 1As shown, the method includes: obtaining text data to be recognized, inputting the text data into a trained implicit emotion recognition model to obtain a recognition result; training the implicit emotion recognition model includes: obtaining an original data set for aspect-level emotion analysis, screening and annotating the original data set to obtain training samples and test samples; preprocessing the training samples and test samples; inputting the preprocessed data into the implicit emotion recognition model, and using a multi-level knowledge recognition method to extract implicit emotion features of the preprocessed data; constructing a heterogeneous user knowledge layer for the preprocessed data; using an attention mechanism to fuse the implicit emotion features and the heterogeneous user knowledge layer; inputting the fused features into a classifier to obtain a recognition result; calculating the loss function of the model according to the recognition result, adjusting the model parameters, and using the test samples to train the model, and completing the model training when the loss function converges.
[0012] A specific implementation of an implicit emotion recognition method based on multi-level recognition and user information enhancement, the specific steps of the method include:
[0013] Step 1: First, obtain the original dataset of aspect-level sentiment analysis, use trigger words and sentiment dictionary to filter the dataset content, delete the annotated sentences containing explicit sentiment, obtain the text containing labels, and divide it into training sample set and test sample set;
[0014] Step 2: preprocess the implicit sentiment analysis training sample set to construct a training data set;
[0015] Step 3: A multi-level knowledge recognition method is used to extract aspects of implicit sentiment text. The specific implementation process is as follows:
[0016] Step 3.1.1, define class rules to extract implicit aspect clues: when aspect words are not clearly identified in the text but opinion words actually exist, define the known pattern matching principle, and use comparative analysis of similar expressions in other texts to infer implicit aspects; when certain opinion words often appear in specific contexts or sentence structures, define sequential pattern rules, and find common language patterns related to aspects or opinions by analyzing the structure and word arrangement of sentences to infer implicit aspects; when opinion words in the text appear with prepositions but are not directly associated with explicit aspect words, define preposition association rules to regard entities or objects as implicit aspects of opinions; when only opinion words exist in the text but aspects cannot be identified through other words, define unassociated opinion rules to infer the implicit aspects of the opinion words; when the extracted explicit aspects are not the actual situation of the user's opinions, define opinion rules with clues, use them as clues to identify the true aspects, analyze the connection between explicit aspects and opinion words, and find implicit associations.
[0017] Step 3.1.2, assign implicit aspects according to the implicit aspect clues obtained in step 3.1.1: find the implicit aspect words with the highest number of co-occurrences of explicit aspects under the entity concept by using the co-occurrences of explicit aspects in the aspects that are not related to the opinion words but are related to the concept words in the sentiment opinion dictionary, and find the synonyms of the explicit aspects. The similarity score of the normalized Google distance between the opinion entity x and the implicit sentiment clue y is used to evaluate the similarity between the two terms, and finally the implicit aspect result with the smallest score with the explicit aspect is obtained as the final implicit aspect representation vector q. The expression of the normalized Google distance is:
[0018]
[0019] Where f(x) and f(y) are the number of searches for implicit aspect clues of search term x and explicit aspect clues of search term y, f(x,y) is the number of web pages where both x and y appear, and M is the total number of web pages searched on Google.
[0020] Step 3.1.3: Based on the implicit aspect representation vector q obtained in 3.1.2, as the embedded representation of the implicit sentiment text, an attention model with different sentiment polarities is constructed through orthogonal restriction on the basis of the BERT model to capture the differential characteristics of sentiment attention under different polarities, and the feature representation h of the implicit sentiment text is obtained. bert , which means the formula is:
[0021]
[0022]
[0023] Among them, ω i is the i-th word in the implicit sentiment text, M is the random initialization of the weight matrix parameters of the bilinear attention model; q∈{q pos ,q neg ,q neu} is the attention query vector of a certain sentiment tendency, q pos For positive sentiment, q neg For negative sentiment direction, q neu Neutral emotional direction, is the attention weight of the i-th word for a specific sentiment direction q, v q is the context vector of a specific sentiment direction q, T is the length of the text, and h bert is the final representation formed by concatenating context vectors of different sentiment directions, is the context vector in the positive sentiment direction, is the context vector in the negative sentiment direction, is the context vector of neutral sentiment direction, This is a vector concatenation operation.
[0024] like Figure 2 FIG. 4 is a schematic diagram of a heterogeneous user knowledge enhancement module of the present invention.
[0025] Step 3.2.1, modeling and representation of social attributes of user internal knowledge: For a certain user u, because it is necessary to use the pre-trained model to learn the knowledge representation of the user's social attributes and represent it as a vector with semantic information embedded, the user attribute set I is formally represented as: I = ["gender", "region"]. After concatenating each attribute in I into a long sequence, the BERT encoder is used to obtain the feature representation of each element in the information set I gende x∈R gd ,I location ∈R gd , where g is the maximum sequence length of gender and region, and d is the dimension of each token vector. The two are concatenated to obtain the feature representation of the user's social attribute set The stacked multi-head attention mechanism is used to establish the connection between the implicit emotional text to be identified and the user's social attribute representation, so that the social attribute representation can specifically perceive the semantic information of the implicit emotional text to be identified, and finally obtain the text sequence representation vector u f .
[0026]
[0027] z f =σ(W f c f +W t h t )
[0028]
[0029] Where t is the maximum length of the text and k is the number of layers of the stacked attention mechanism model. f It is a social attribute vector that specifically perceives the semantic information of implicit emotional text. f , W f , W t is the weight matrix.
[0030] Step 3.2.2: Content knowledge modeling representation of user internal knowledge: The content text posted by users contains a lot of implicit personalized information of users. Through this information, the industry and personality characteristics of users can be analyzed. The content posted by users is regarded as long text, and BERT and the training model are used to obtain the representation matrix H. c ∈R h×d, applied to the query matrix, key and value matrix of the multi-head attention mechanism, h is the maximum token length of the long text, and the Transformer encoder and multi-head self-attention mechanism are used to obtain the representation u of user content knowledge of different levels of model alignment vectors c .
[0031]
[0032] Step 3.2.3, user external knowledge modeling representation: Based on the user's attention relationship list, construct the user attention relationship matrix A∈R n×n , n is the number of users in the data set, and the association weight parameter vector v between users is set according to the different attention relationships t , represents the attention type between user u and user i, and uses GCN to calculate the user node representation vector. The embeddings obtained at each layer are combined and the learned user u embedding (i.e., e u ) and user i embedding (i.e. e i ), forming the final representation e of user u and user i u , and represent it as the social relationship knowledge of user u as ur.
[0033]
[0034] where e i is the node representation vector of user i, the first-order neighbor of user u, N U is the number of the user's first-order neighbors. Using it as a normalization coefficient can avoid the node representation being too large. Then, the node representation vector e u and e i , and combined with the real attention relationship status y between users ui The loss function is obtained by taking the logarithm:
[0035]
[0036]
[0037] Step 4: Stack the text sequence representation module and the heterogeneous user knowledge fusion layer for attention fusion. Figure 3 To introduce the stacked attention mechanism model structure, the implicit sentiment text representation h obtained in step 3.1.3 is bert As the key vector and value vector of the attention mechanism, put the u obtained in step 3.2.1 f , u obtained in step 3.2.2 c and u obtained in step 3.2.3 r They are used as query vectors of the stacked attention model to obtain the fusion representation of three types of heterogeneous user knowledge and implicit sentiment text:
[0038]
[0039] Among them, k is the number of layers of the stacked attention model. In each layer of the stacked attention mechanism, W is used f , W c and W r The fusion weight parameters use the gating mechanism to obtain the weight vector z fm ,z cm and z rm :
[0040] z fm =σ(W f c fm +W fm h bert +b f )
[0041] z cm =σ(W c c cm +W cm h bert +b c )
[0042] z rm =σ(W r c rm +W rm h bert +b r )
[0043] like Figure 3 As shown in Figure 2, the final implicit sentiment representation vector h that integrates heterogeneous user knowledge is obtained by using the learned gating weights, heterogeneous user knowledge, and text information. o :
[0044]
[0045] Among them, h bert is the implicit sentiment text representation, c fm is the fusion representation of the text sequence representation vector and the implicit sentiment text, c cm is the fusion representation of user feature representation and implicit sentiment text, c rm is the fusion representation of social relationship knowledge and implicit sentiment text, fm is the fusion weight vector of the text sequence representation vector and the implicit sentiment text, z cm is the fusion weight vector of user feature representation and implicit sentiment text, z rm is the fusion weight vector of social relationship knowledge and implicit sentiment text, h o To fuse the implicit sentiment representation of heterogeneous user knowledge, Multiply vector elements.
[0046] Step 4.1, input the prepared training set data into the implicit sentiment analysis model based on aspect recognition and user information enhancement, and obtain the corresponding implicit aspect extraction word prediction results and the sentiment polarity label model prediction results fused with user information enhancement through automatic feature extraction and model prediction;
[0047] Step 4.2, compare the sentiment polarity prediction result with the true value of the label, and use the loss function to calculate. The present invention uses a cross entropy loss function, which is as follows:
[0048]
[0049] where y ji represents the true distribution, It represents the result of the network output, n represents the total number of categories, and batch_size is the number of samples used in each training iteration.
[0050] In step 4.3, the Adam optimization algorithm is used to minimize the loss function described in step 4.2, and the model parameters are iteratively updated through back propagation.
[0051] Furthermore, the specific implementation process of step 4.3 is as follows:
[0052] Step 4.3.1, calculate the gradient at iteration number t: Where θ represents the model parameters, represents the gradient operator symbol;
[0053] Step 4.3.2, calculate the first-order moment estimate m of the gradient t With the second moment estimate v t :m t =β1m t-1 +(1-β1)g t , Where β1 and β2 are the exponential decay rates of the first-order moment and the second-order moment respectively;
[0054] Step 4.3.3, first-order estimate m of the gradient t With the second moment estimate v t After bias correction, we get and
[0055] Step 4.3.4, model parameter update: Where η is the learning rate and ε is a constant to maintain numerical stability.
[0056] Step 4.4, repeat the above steps 4.1-4.3 until the model converges to obtain the final sentiment polarity classification model.
[0057] Step 5: Use the fully connected layer to map the text representation to the classification space, and use the softmax function to normalize it to obtain the probability distribution W o and b o is the parameter matrix and bias of the fully connected layer.
[0058] Furthermore, the specific process of step 5 is as follows:
[0059] Step 5.1, perform softmax normalization processing on the text to be classified into sentiment label polarity in the test sample set.
[0060] Step 5.2, using the user information fused enhanced model obtained in step 4 to predict the sentiment polarity label text processed in step 5.1, to obtain the final sentiment polarity result.
[0061] The above embodiments further illustrate the purpose, technical solutions and advantages of the present invention in detail. It should be understood that the above embodiments are only preferred implementation modes of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made to the present invention within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An implicit emotion recognition method based on multi-level recognition and user information enhancement, characterized in that: include: Obtain text data to be recognized, input the text data into the trained implicit emotion recognition model, and obtain the recognition result; Training the implicit emotion recognition model includes: obtaining the original data set of aspect-level emotion analysis, screening and labeling the original data set to obtain training samples and test samples; preprocessing the training samples and test samples; inputting the preprocessed data into the implicit emotion recognition model, and using a multi-level knowledge recognition method to extract the implicit emotion features of the preprocessed data; constructing a heterogeneous user knowledge layer for the preprocessed data; using an attention mechanism to fuse the implicit emotion features and the heterogeneous user knowledge layer; inputting the fused features into a classifier to obtain recognition results; calculating the loss function of the model based on the recognition results, adjusting the model parameters, and using test samples to train the model, and completing the model training when the loss function converges.
2. According to claim 1, the implicit emotion recognition method based on multi-level recognition and user information enhancement is characterized in that: Screening and labeling the original data set includes: obtaining the trigger words of each text in the original data set, and filtering the text content using the sentiment dictionary according to the trigger words; that is, deleting the labeled sentences containing explicit sentiments to obtain the text containing the label.
3. The implicit emotion recognition method based on multi-level recognition and user information enhancement according to claim 1 is characterized in that: The implicit sentiment features of preprocessed data are extracted using a multi-level knowledge recognition method, including: defining class rules to extract implicit aspect clues; assigning implicit aspects according to the implicit aspect clues extracted from the class rules; and extracting implicit features using the BERT model based on the implicit aspect assignment results.
4. The implicit emotion recognition method based on multi-level recognition and user information enhancement according to claim 3 is characterized in that: Defining class rules to extract implicit aspect clues includes: identifying parts of speech in the text. When aspect words are not identified in the text but opinion words are present, defining known pattern matching principles and inferring implicit aspects by comparing and analyzing expressions in other texts; when opinion words often appear in specific contexts or sentence structures, defining sequential pattern rules, analyzing the structure of sentences and word arrangement, finding common language patterns related to aspects or opinions, and using them to infer implicit aspects; when opinion words in the text appear with prepositions but are not directly associated with explicit aspect words, defining preposition association rules, treating entities or objects as implicit aspects of opinions; when only opinion words exist in the text but aspects cannot be identified through other vocabulary, defining unassociated opinion rules, and inferring implicit aspects of the opinion words; when the extracted explicit aspects are not the actual situation of the user's opinions, defining opinion rules with clues, using them as clues to identify the true aspects, analyzing the connection between explicit aspects and opinion words, and finding implicit associations.
5. The implicit emotion recognition method based on multi-level recognition and user information enhancement according to claim 3 is characterized in that: Extracting implicit aspect clues according to class rules and assigning implicit aspects include: extracting implicit aspect clues according to class rules, finding implicit aspect words with the highest number of co-occurrences of explicit aspects under entity concepts by co-occurring with explicit aspects and finding synonyms of explicit aspects; calculating the normalized Google distance between opinion entity x and implicit sentiment clue y, and using the normalized Google distance as the similarity score; selecting the implicit aspect result with the smallest score with the explicit aspect and using it as the final implicit aspect representation vector q.
6. The implicit emotion recognition method based on multi-level recognition and user information enhancement according to claim 3 is characterized in that: The implicit features extracted using the BERT model include: Among them, ω i is the i-th word in the implicit sentiment text, M is the random initialization of the weight matrix parameters of the bilinear attention model; q∈{q pos ,q neg ,q neu } is the attention query vector of a certain sentiment tendency, is the attention weight of the i-th word for a specific sentiment direction q, v q is the context vector of a specific sentiment direction q, T is the length of the text, and h bert is the final representation formed by concatenating context vectors of different sentiment directions, is the context vector in the positive sentiment direction, is the context vector in the negative sentiment direction, is the context vector of neutral sentiment direction, This is a vector concatenation operation.
7. The implicit emotion recognition method based on multi-level recognition and user information enhancement according to claim 1 is characterized in that: Constructing a heterogeneous user knowledge layer includes: the data in the training sample includes user social attributes, user information and user external knowledge; inputting the user social attributes into the BERT encoder to obtain the feature representation of the user social attributes; fusing the feature representations of all user social attributes to obtain the feature representation of the user social attribute set; using a stacked multi-head attention mechanism to calculate the connection between the implicit emotional text to be identified and the user social attribute representation to obtain a text sequence representation vector; inputting the user information into the BERT encoder to obtain a representation matrix; performing a mask operation on the representation matrix, and using a multi-head attention mechanism to process the masked matrix to obtain a user feature representation; constructing a user attention relationship matrix based on user external knowledge; setting the association weight parameter vector between users according to different attention relationships; obtaining the user's social relationship knowledge representation based on the association weight parameter vector; fusing the text sequence representation vector, the user feature representation and the social relationship knowledge representation to obtain a heterogeneous user knowledge layer.
8. The implicit emotion recognition method based on multi-level recognition and user information enhancement according to claim 1 is characterized in that: The use of attention mechanism to fuse implicit sentiment features and heterogeneous user knowledge layers includes: adopting stacked attention mechanism to learn the fusion weights of each embedded knowledge, taking text sequence representation vector, user feature representation and social relationship knowledge representation as query vectors respectively, and taking implicit features as key vectors and value vectors to obtain fused representation; using gating mechanism to fuse weight parameters to obtain weight vector; weighting implicit sentiment features and heterogeneous user knowledge layers according to weight vector to obtain implicit sentiment representation that fuses heterogeneous user knowledge.
9. The implicit emotion recognition method based on multi-level recognition and user information enhancement according to claim 1, characterized in that: The loss function of the model is: Among them, y ji represents the true distribution, It represents the result of the network output, n represents the total number of categories, and batch_size is the number of samples used in each training iteration.
Citation Information
Patent Citations
Fine-grained sentiment analysis method based on syntactic relationship and opinion word distribution
CN113535897A
Personalized implicit sentiment analysis method and system based on user knowledge
CN114281999A
Personalized implicit sentiment analysis method fusing multi-modal heterogeneous user knowledge
CN118626588A
Cited By
User analysis method, device and equipment based on large model and storage medium
CN120524251A