User sentiment analysis method, system and device for reconstructing public opinion network based on trust relationship and medium

Through the user sentiment analysis method of reconstructing the public opinion network based on trust relationships, combined with the implicit trust relationship between the comment text and the user, the user's emotional characteristics are extracted, and the problem of difficult to analyze and predict user emotional trends in public opinion events in the prior art is solved, and a higher precision and comprehensive sentiment analysis is achieved.

CN119598013APending Publication Date: 2025-03-11SHANGHAI INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411633691.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The prior art is difficult to effectively analyze and predict the emotional trends of users in public opinion events, especially on social network platforms, which makes it difficult to timely control the spread and spread of negative emotions.

Method used

Through the user sentiment analysis method of reconstructing the public opinion network based on the trust relationship, we collect comment texts related to specific public opinion events, calculate the emotional polarity, and combine the comment reply relationship and implicit trust relationship between users to calculate the user's emotional tendency score and trust degree, reconstruct the public opinion network graph structure, and use the graph attention network model to extract user emotional characteristics and make emotional predictions.

Benefits of technology

This method not only considers the semantic characteristics of the comment text, but also combines the implicit relationship characteristics and emotional tendencies between users, improving the accuracy and comprehensiveness of sentiment analysis. It is suitable for analyzing complex public opinion events and dynamically grasping the development trend of public opinion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119598013A_ABST
    Figure CN119598013A_ABST
Patent Text Reader

Abstract

The invention provides a user sentiment analysis method and system for reconstructing a public opinion network based on trust relationships, electronic equipment and a storage medium. The user sentiment analysis method comprises the steps that user comment texts under a specific public opinion event related topic are collected, and the sentiment polarity of each comment text is calculated; calculating an emotional tendency score of the user in combination with the emotional polarity of the comment text of the user and the comment reply relationship; constructing an implicit trust relationship among the users by using the improved HK bounded trust model, and updating a user trust relationship adjacency matrix; the trust degree between the user and the adjacent user is calculated, and a public opinion network graph network structure with the trust degree as a directed edge weight is reconstructed; and extracting user emotion features in a public opinion network graph network structure by using a graph attention network model GAT, and constructing a linear regression model to predict a user emotion score. The influence factors considered by the method are more comprehensive, and the precision of user emotion analysis and prediction is higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of emotion recognition and analysis of netizens in social networks, and in particular to a user emotion analysis method and system based on trust relationship-based reconstruction of public opinion networks. Background Art

[0002] With the development of Internet technology, social networking platforms have risen rapidly. Social media such as QQ, WeChat, and Weibo have gradually become the main channels for the public to express their personal opinions, emotions, and attitudes. Among them, the Douyin short video platform has become one of the main forces of domestic social network communication with its advantages of strong audience compatibility, high content popularity, and low threshold access. It contains a large amount of user information, and information such as discussion and dissemination of a certain event reveals the user's emotional tendency. Emotional information spreads and spreads rapidly in a short period of time, constantly affecting more users. In addition, the "information cocoon" effect caused by the personalized push of short video platforms also strengthens the impact of emotional information. This poses new challenges to the government's work on the governance of online public opinion. If the emotional trend of public opinion events on short video platforms cannot be controlled in a timely and effective manner, it is very easy to "spread rumors", thereby triggering a social public opinion crisis.

[0003] Public opinion events can easily trigger a large number of netizens to make comments. The negative emotions of netizens spread rapidly on the Internet, fermenting and gradually forming attitudes and positions similar to others but slightly more extreme, thus causing negative public opinion or group polarization. Not only does it seriously disrupt the order of social public opinion, it may also trigger offline violent gatherings and endanger public safety. Therefore, it is extremely important to analyze the emotions and attitudes of netizens towards a specific public opinion event in order to dynamically grasp the development trend of public opinion. On social networks, the comments posted by users contain the user's unique emotional tendencies. The user's emotional tendencies will affect the changes in the emotional tendencies of other users, and then affect the emotions of the comment texts they post.

[0004] At present, there are related technologies that perceive user emotional tendencies through online comment texts. For example, in the paper "Research on Short Video Network Public Opinion Sentiment Analysis Integrating BERT Multi-level Features" published in the core journal "Computer Science and Exploration", a comment text sentiment analysis method integrating BERT multi-level features is proposed, including: selecting sample cases, collecting video comment area text data with more than 2 million likes; performing text preprocessing operations such as word segmentation, cleaning, and sentiment annotation on massive comment data; dividing the preprocessed comment text data into training sets and test sets; using the BERT pre-training model to extract text emotional semantic features; using the attention mechanism and combining the TextCNN model to train the training set samples to update the model parameters; using the trained model to perform sentiment prediction analysis on the test set samples; classifying the comment text according to the emotional polarity, analyzing the keywords of negative emotions, studying and judging the causes of emotions, and timely discovering potential public opinion focuses and hidden dangers. However, this method is committed to analyzing the complexity of text emotional semantic features, analyzing the user's emotional state based on the content of the comment text, and ignoring the fact that the user's emotional tendency will affect the changes in the emotional tendency of other users.

[0005] For example, the "User Opinion Prediction Model" was disclosed in the master's thesis of Hebei University, "Research on Prediction of Social User Opinion Evolution Based on Improved HK Bounded Trust Model", which provides a method for calculating the initial opinion value of social users based on historical data of social users; then, the intimacy between users is quantified based on the interaction behavior between users, so as to revise the trust threshold of users; finally, the influence weight of opinions between users is calculated based on the global influence of users, the degree of interaction between users, and the proximity of opinions between users. The purpose of this method is to study the influence of three factors, namely global influence, interaction density, and opinion consistency, on the evolution of user opinions. This method does not take into account the dynamic changes of opinion influence weights between users, and ignores the influence of user social relationships on the evolution of user opinions. This method is mainly used to predict the evolution of opinions of social network users. The network public opinion governance department cannot use this model to track the dynamic emotions of users.

[0006] Another example is the master's thesis of Anhui University, "Research on Social Network Sentiment Analysis Algorithm Integrating User Emotional Tendencies", which discloses a user sentiment analysis method, including: calculating the user's sentiment tendency score by counting the sentiment polarity distribution of comments posted by social network users, labeling the user's emotions, and dividing the users into training samples and test samples; assigning the user initial attributes as node attributes based on the number of friends and comment polarity distribution information of the user; sending the user's social network as input to the graph neural network model to learn the user's sentiment tendency characteristics; finally predicting the user's sentiment tendency score and analyzing and summarizing the results. The purpose of this method is to study the problem of the spread and influence of user sentiment tendencies in social networks in order to improve the accuracy of predictions. However, it ignores the impact of implicit trust relationships between users on user emotions, and it is difficult for online public opinion management departments to use this method to conduct a comprehensive analysis of the public's emotional evolution. Summary of the invention

[0007] In order to overcome the technical defect of the prior art that there is a lack of a method for comprehensively judging the emotions of public opinion users, the first aspect of the present invention provides a user emotion analysis method for reconstructing a public opinion network based on trust relationships, which includes:

[0008] Step S1: Collect the comment texts of Internet users that meet specific requirements under topics related to a specific public opinion event, and calculate the sentiment polarity of each comment text;

[0009] Step S2: Calculate the user's sentiment tendency score by combining the sentiment polarity of the user's comment text and the comment reply relationship;

[0010] Step S3: Use the sentiment tendency scores between users to calculate the sentiment consistency between users, use the Jaccard similarity coefficient to calculate the reply relationship consistency between users, linearly fuse the sentiment consistency and reply relationship consistency, and calculate the similarity trust score between users. If the similarity trust score is greater than the trust threshold, use the improved HK bounded trust model to build an implicit trust relationship between users, and update the user trust relationship adjacency matrix;

[0011] Step S4: Calculate the trust between the user and its adjacent users based on the updated user trust relationship adjacency matrix, and reconstruct a public opinion network graph network structure with trust as the directed edge weight;

[0012] Step S5: Use the graph attention network model GAT to extract user sentiment features in the network structure of the public opinion network graph, and build a linear regression model to predict user sentiment scores.

[0013] Furthermore, in step S1, all data under a topic related to a specific public opinion event are crawled, and the data that meets the specific requirements is selected as the data source. The user information participating in the discussion and the corresponding comment information under the data source are collected to construct a user public opinion data set {U, T}, where U = {u1, u2, …, u N} is the set of all users in the public opinion network, T is the comment set corresponding to the user, and the user sample is divided into training samples and test samples; then the comment texts posted by the public opinion users are counted to construct an associated comment set, user u i The set of related comments is Is user u i The kth comment text, assuming that the embedding representation of a comment text is t = {w1,w2,...,w n}, use the Roberta model to encode the comment text to obtain the emotional semantic features of each comment The Roberta model uses a multi-head attention mechanism to extract semantic features. The calculation formula is:

[0014]

[0015] in, Is user u i The sentiment semantic feature vector of the kth comment text. Assuming there are m comments, user u i The set of related comments T i The vector matrix of the sentiment semantic features is X, and the dimension is R m×n , n is the maximum embedding dimension of the comment text; Perform Softmax activation to calculate the sentiment polarity of each comment text. The calculation formula is:

[0016]

[0017] in, Is user u i The sentiment polarity of k comments in the comment set, Indicates that the comment is a negative comment. Indicates that the comment is a positive comment, user u i The associated comment text data is

[0018] Furthermore, in step S2, the users who posted comments are taken as nodes, and the initial public opinion network G(U,E) is constructed according to the comment-reply interaction relationship between users, and the sentiment tendency score of each user is calculated; the sentiment polarity distribution of the comment text in the associated comment set T of each user is counted. Assuming that user u iThere are p positive comments and n negative comments. Then count the number of users who have established reply relationships with this user, recorded as f, and the public opinion user u i The calculation formula of the sentiment tendency score is:

[0019]

[0020] in, Is user u i The number of reply relations, Is user u i Number of positive reviews, Is user u i The number of negative comments by user u i The sentiment label is s i ∈[-1,+1], the sentiment labels of all users are S={s1,s2,…,s N}.

[0021] Furthermore, in step S3, the trust relationship is divided into direct trust and implicit trust according to the initial public opinion network structure, and a trust relationship matrix A∈R is constructed. N×3 , A i,j =1 indicates user u j Trust user u i , using the improved HK bounded trust model to build implicit trust relationships, specifically: first count the number of users u i The direct trust relationship is recorded as N(i), and its direct trust neighbor u is counted k The direct trust relationship between users is recorded as N(k), and the Jaccard similarity coefficient is used to calculate the user u i and user u in N(k) j The reply relationship between them is RN:

[0022]

[0023] Where k∈N(i) represents user u i Directly trust user u k , j∈N(k),j no∈N(i) represents user u k Directly trust user u j And user u i Do not directly trust user u j , G i With G j For user u i and user u j The reply relation set of ;

[0024] Statistics user u i and user u j The sentiment tendency score of user u is calculatedi With user u j Emotional consistency:

[0025]

[0026] Among them, s i ,s j They are user u i With user u j The sentiment tendency score of , max(s) is the maximum sentiment score;

[0027] The reply relationship consistency and sentiment consistency are linearly integrated to calculate the user u i With user u j The similarity trust score between is calculated as:

[0028] FS(i,j)=θ*RN _Jaccard (i,j)+(1-θ)*EC(i,j)

[0029] Set user u i With user u j The similarity trust score FS(i,j) between them is compared with the trust threshold ε. If the trust value is less than the trust threshold, it means that user u i With user u j There is no trust relationship between them. If the trust value is greater than the trust threshold, then i With user u j Build an implicit trust relationship between them and update user u i adjacency matrix; then count the trust relationship set N(j) of user j and continue to build the trust relationship set of user u i With user u j The implicit trust relationship between users in the trust relationship set N(j); finally, the public opinion network G(U,A) is reconstructed by combining the direct implicit trust relationship between users, where U is the set of all users and A is i,j =1 indicates user u j Trust user u i .

[0030] Furthermore, in step S4, the updated user trust relationship adjacency matrix A is counted to calculate the trust scores of all the user's trust neighbors and the user. The specific steps are as follows:

[0031] Calculate user u using Jaccard similarity coefficient i Its adjacent user u j The reply relationship between them is consistent with TN:

[0032]

[0033] Among them, Gi With G j For user u i and user u j The reply relation set of ;

[0034] Count the sentiment scores of all users S = {s1, s2, ..., s N}, calculate the emotional difference between users and perform normalization to obtain the emotional consistency EC between users:

[0035]

[0036] Among them, EC(i,j) is the i and user u j Emotional consistency between i ,s j For user u i With user u j The sentiment tendency score of , max(s) is the maximum sentiment score;

[0037] Then count the number of comments each user has made in reply to his or her neighbor's comments, and calculate the number of comments that user u has made in reply to his or her neighbor's comments. i With user u j The degree of interaction between:

[0038]

[0039] Among them, I i (i,j) is user u j Reply to user u i Total number of comments, A is the total number of comments replied by user j to all neighbor users, j Is user u j The set of adjacent users, IN(i,j) is used to measure the user u i With user u j The closer the trust strength between them, the stronger the interaction. j For user u i The more trust;

[0040] The similar trust scores between the user and the adjacent users are calculated by comprehensively considering the graph network structure and the consistency of sentiment tendency, and then the interaction intensity of the adjacent users on the user is integrated. Specifically, the linear fusion method is used to calculate the trust of the adjacent users on the user. The calculation formula is:

[0041] T(i,j)=α×TN(i,j)+β×EC(i,j)+γ×IN(i,j)

[0042] Among them, α, β, and γ are the i With user uj The influence weights of the reply relationship consistency TN, emotional consistency EC and interaction closeness are α+β+γ=1; T(i,j) is the influence weight of user u j For user u i The trust score of j ∈A i ;

[0043] Subsequently, a public opinion network graph with trust as the directed edge weight is reconstructed.

[0044] Furthermore, in step S5, the initial node vector h of each user is defined according to the initial public opinion network, with a dimension of R 3 , h=[f,p,n], all users form a set H=h1,h2,…,h n ,h i ∈R 3 , according to the relationship of the adjacency matrix A, the matrix [h i ,h j ],u j ∈A i ; Fusion user u j For user u i The trust impact calculation of user u j To u i The importance of is as follows:

[0045]

[0046] Among them, α ij Is user u i and user u j The attention value between them, a∈R 2F is the weight parameter of the neural network, F is the output dimension of the user, W1∈R F×3 is the weight parameter of the initial embedding h, || means concatenating the feature vectors, and the activation function uses LeakyRelu; T(i,j) is the user u j For user u i The trust degree of , δ is the attenuation factor parameter of user trust transfer;

[0047] A multi-head attention mechanism is used to update the user's feature vector. Assume that there are K attention heads, and each attention head is responsible for the user node u i Update the feature vector of the user node u i All vectors are concatenated and averaged, and finally the user's emotional tendency feature h′ is obtained. i , and its calculation formula is:

[0048]

[0049] Using the tanh activation function, the obtained h′ i is the hidden vector of the i-th user, with dimension R F , count the hidden vectors of all users and define the hidden embedding matrix H′∈R N×F , and then input it into the single-head attention layer to calculate the user's emotional tendency feature embedding:

[0050] Z = tanh(attention(H′,A))

[0051] The calculation uses the tanh activation function to obtain a high-dimensional user sentiment feature matrix Z∈R N×F , T is the output dimension of the user embedding vector; user u i The final emotional tendency feature z i Perform linear dimensionality reduction to obtain the predicted sentiment tendency score, which is calculated as follows:

[0052] s′ i =tanh(z i w2+b)

[0053] Among them, the calculation of user sentiment tendency score adopts tanh activation function, s′ i Is user u i The predicted sentiment score, w2∈R F is the weight parameter of the linear regression model, b∈R is the bias, and the sentiment tendency scores of all users in all public opinion networks are S′={s′1,s′2,…,s′ N};

[0054] The sentiment prediction score s′ i With real emotion labels i The loss value is calculated by the MSE loss function, and its calculation formula is:

[0055]

[0056] The Adam optimization algorithm is used to train samples to update model parameters, and then the optimized model is used to perform user sentiment prediction analysis on the test set samples.

[0057] The second aspect of the present application provides a user sentiment analysis system for reconstructing a public opinion network based on trust relationships, which includes:

[0058] A comment text sentiment polarity calculation module, which collects comment texts of network users that meet specific requirements under topics related to specific public opinion events, and calculates the sentiment polarity of each comment text;

[0059] A user sentiment tendency calculation module, which is used to calculate the user's sentiment tendency score by combining the sentiment polarity of the user's comment text and the comment reply relationship;

[0060] A user trust relationship updating module, wherein the user trust relationship updating module calculates the emotional consistency between users by using the emotional tendency scores between users, calculates the reply relationship consistency between users by using the Jaccard similarity coefficient, linearly fuses the emotional consistency and the reply relationship consistency, and calculates the similar trust scores between users. If the similar trust score is greater than the trust threshold, an improved HK bounded trust model is used to build an implicit trust relationship between users, and the user trust relationship adjacency matrix is ​​updated;

[0061] A public opinion network reconstruction module, which calculates the trust between the user and its adjacent users according to the updated user trust relationship adjacency matrix, and reconstructs a public opinion network graph network structure with the trust as the directed edge weight;

[0062] The user sentiment analysis module uses the graph attention network model GAT to extract user sentiment features in the network structure of the public opinion network graph, and constructs a linear regression model to predict user sentiment scores.

[0063] Furthermore, the comment text sentiment polarity calculation module is used to crawl all data under a topic related to a specific public opinion event, select the data that meets specific requirements as the data source, collect the user information participating in the discussion under the data source and the corresponding comment information, and construct a user public opinion data set {U, T}, where U = {u1, u2, ..., u N} is the set of all users in the public opinion network, T is the comment set corresponding to the user, and the user sample is divided into training samples and test samples; then the comment texts posted by the public opinion users are counted to construct an associated comment set, user u i The set of related comments is Is user u i The kth comment text, assuming that the embedding representation of a comment text is t = {w1,w2,...,w n}, use the Roberta model to encode the comment text to obtain the emotional semantic features of each comment The Roberta model uses a multi-head attention mechanism to extract semantic features. The calculation formula is:

[0064]

[0065] in, Is user u i The sentiment semantic feature vector of the kth comment text. Assuming there are m comments, user u iThe set of related comments T i The vector matrix of the sentiment semantic features is X, and the dimension is R m×n , n is the maximum embedding dimension of the comment text; Perform Softmax activation to calculate the sentiment polarity of each comment text. The calculation formula is:

[0066]

[0067] in, Is user u i The sentiment polarity of k comments in the comment set, Indicates that the comment is a negative comment. Indicates that the comment is a positive comment, user u i The associated comment text data is

[0068] The user sentiment tendency calculation module is used to: take the user who posted the comment as a node, build the initial public opinion network G(U,E) according to the comment reply interaction relationship between users, and calculate the sentiment tendency score of each user; count the sentiment polarity distribution of the comment text in the associated comment set T of each user, assuming that user u i There are p positive comments and n negative comments. Then count the number of users who have established reply relationships with this user, recorded as f, and the public opinion user u i The calculation formula of the sentiment tendency score is:

[0069]

[0070] in, Is user u i The number of reply relations, Is user u i Number of positive reviews, Is user u i The number of negative comments by user u i The sentiment label is s i ∈[-1,+1], the sentiment labels of all users are S={s1,s2,…,s N};

[0071] The user trust relationship update module is used to: divide the trust relationship into direct trust and implicit trust according to the initial public opinion network structure, and construct a trust relationship matrix A∈R N×3 , A i,j =1 indicates user u j Trust user u i , using the improved HK bounded trust model to build implicit trust relationships, specifically: first count the number of users u iThe direct trust relationship is recorded as N(i), and its direct trust neighbor u is counted k The direct trust relationship between users is recorded as N(k), and the Jaccard similarity coefficient is used to calculate the user u i and user u in N(k) j The reply relationship between them is RN:

[0072]

[0073] Where k∈N(i) represents user u i Directly trust user u k , j∈N(k),j no∈N(i) represents user u k Directly trust user u j And user u i Do not directly trust user u j , G i With G j For user u i and user u j The reply relation set of ;

[0074] Statistics user u i and user u j The sentiment tendency score of user u is calculated i With user u j Emotional consistency:

[0075]

[0076] Among them, s i ,s j They are user u i With user u j The sentiment tendency score of , max(s) is the maximum sentiment score;

[0077] The reply relationship consistency and sentiment consistency are linearly integrated to calculate the user u i With user u j The similarity trust score between is calculated as:

[0078] FS(i,j)=θ*RN _Jaccard (i,j)+(1-θ)*EC(i,j)

[0079] Set user u i With user u j The similarity trust score FS(i,j) between them is compared with the trust threshold ε. If the trust value is less than the trust threshold, it means that user u i With user u j There is no trust relationship between them. If the trust value is greater than the trust threshold, theni With user u j Build an implicit trust relationship between them and update user u i adjacency matrix; then count the trust relationship set N(j) of user j and continue to build the trust relationship set of user u i With user u j The implicit trust relationship between users in the trust relationship set N(j); finally, the public opinion network G(U,A) is reconstructed by combining the direct implicit trust relationship between users, where U is the set of all users and A is i,j =1 indicates user u j Trust user u i ;

[0080] The public opinion network reconstruction module is used to: count the updated user trust relationship adjacency matrix A, and calculate the trust scores of all the user's trusted neighbors and the user. The specific steps are as follows:

[0081] Calculate user u using Jaccard similarity coefficient i Its adjacent user u j The reply relationship between them is consistent with TN:

[0082]

[0083] Among them, G i With G j For user u i and user u j The reply relation set of ;

[0084] Count the sentiment scores of all users S = {s1, s2, ..., s N}, calculate the emotional difference between users and perform normalization to obtain the emotional consistency EC between users:

[0085]

[0086] Among them, EC(i,j) is the i and user u j Emotional consistency between i ,s j For user u i With user u j The sentiment tendency score of , max(s) is the maximum sentiment score;

[0087] Then count the number of comments each user has made in reply to his or her neighbor's comments, and calculate the number of comments that user u has made in reply to his or her neighbor's comments. i With user u j The degree of interaction between:

[0088]

[0089] Among them, I i (i,j) is user u j Reply to user u i Total number of comments, A is the total number of comments replied by user j to all neighbor users, j Is user u j The set of adjacent users, IN(i,j) is used to measure the user u i With user u j The trust strength between them is that the closer the interaction is, the stronger the trust between them is. j For user u i The more trust;

[0090] The similar trust scores between the user and the adjacent users are calculated by comprehensively considering the graph network structure and the consistency of sentiment tendency, and then the interaction intensity of the adjacent users on the user is integrated. Specifically, the linear fusion method is used to calculate the trust of the adjacent users on the user. The calculation formula is:

[0091] T(i,j)=α×TN(i,j)+β×EC(i,j)+γ×IN(i,j)

[0092] Among them, α, β, γ are the i With user u j The influence weights of the reply relationship consistency TN, emotional consistency EC and interaction closeness are α+β+γ=1; T(i,j) is the influence weight of user u j For user u i The trust score of j ∈A i ;

[0093] Then, a public opinion network graph with trust as directed edge weight is reconstructed;

[0094] The user sentiment analysis module is used to define the initial node vector h of each user according to the initial public opinion network, with a dimension of R 3 , h=[f,p,n], all users form a set H=h1,h2,…,h n ,h i ∈R 3 , according to the relationship of the adjacency matrix A, the matrix [h i ,h j ],u j ∈A i ; Fusion user u j For user u i The trust impact calculation of user u j To u i The importance of is as follows:

[0095]

[0096] Among them, α ij Is user u i and user u j The attention value between them, a∈R 2F is the weight parameter of the neural network, F is the output dimension of the user, W1∈R F×3 is the weight parameter of the initial embedding h, || means concatenating the feature vectors, and the activation function uses LeakyRelu; T(i,j) is the user u j For user u i The trust degree of , δ is the attenuation factor parameter of user trust transfer;

[0097] A multi-head attention mechanism is used to update the user's feature vector. Assume that there are K attention heads, and each attention head is responsible for the user node u i Update the feature vector of the user node u i All vectors are concatenated and averaged, and finally the user's emotional tendency feature h′ is obtained. i , and its calculation formula is:

[0098]

[0099] Using the tanh activation function, the obtained h′ i is the hidden vector of the i-th user, with dimension R F , count the hidden vectors of all users and define the hidden embedding matrix H′∈R N×F , and then input it into the single-head attention layer to calculate the user's emotional tendency feature embedding:

[0100] Z = tanh(attention(H′,A))

[0101] The calculation uses the tanh activation function to obtain a high-dimensional user sentiment feature matrix Z∈R N×F , T is the output dimension of the user embedding vector; user u i The final emotional tendency feature z i Perform linear dimensionality reduction to obtain the predicted sentiment tendency score, which is calculated as follows:

[0102] s′ i =tanh(z i w2+b)

[0103] Among them, the calculation of user sentiment tendency score adopts tanh activation function, s′ i Is user u i The predicted sentiment score, w2∈R Fis the weight parameter of the linear regression model, b∈R is the bias, and the sentiment tendency scores of all users in all public opinion networks are S′={s′1,s′2,…,s′ N};

[0104] The sentiment prediction score s′ i With real emotion labels i The loss value is calculated by the MSE loss function, and its calculation formula is:

[0105]

[0106] The Adam optimization algorithm is used to train samples to update model parameters, and then the optimized model is used to perform user sentiment prediction analysis on the test set samples.

[0107] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps in the user sentiment analysis method for reconstructing a public opinion network based on trust relationships are implemented as described above.

[0108] The fourth aspect of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the user sentiment analysis method for reconstructing a public opinion network based on trust relationships are implemented as described above.

[0109] Compared with the prior art, the above technical solution has the following beneficial effects:

[0110] The present invention not only considers the semantic features of the comment text, but also combines the implicit relationship features between users and the user's unique emotional tendencies, integrates the social relationship features into the user's initial emotional features, learns the user's emotional features in combination with the implicit relationship between users, and performs emotional prediction analysis. Compared with traditional user emotional analysis, this method has higher accuracy and considers more comprehensive influencing factors. It is suitable for analyzing current complex public opinion events and dynamically grasping the development trend of public opinion. BRIEF DESCRIPTION OF THE DRAWINGS

[0111] Figure 1 A flow chart of the user sentiment analysis method for reconstructing the public opinion network based on trust relationships;

[0112] Figure 2 To construct an implicit trust relationship flow chart using the improved HK model;

[0113] Figure 3 It is a flowchart for sentiment analysis of public opinion users;

[0114] Figure 4Module structure diagram of the user sentiment analysis system for reconstructing the public opinion network based on trust relationships. DETAILED DESCRIPTION

[0115] The advantages of the present invention are further described below in conjunction with the accompanying drawings and specific embodiments. Those skilled in the art should understand that the following specific description is illustrative rather than restrictive, and should not be used to limit the scope of protection of the present invention.

[0116] Example 1

[0117] Reference Figure 1 The user sentiment analysis method for reconstructing the public opinion network based on trust relationship proposed in this embodiment specifically includes the following steps:

[0118] Step S1: Collect the comment texts of all Internet users under topics related to a specific public opinion event and calculate the sentiment polarity of each comment text.

[0119] The specific process is as follows: crawl the Tik Tok short video data under a topic related to a specific public opinion event, select the short videos with more than 1 million likes as the data source, collect the user information participating in the discussion under the data source and the corresponding comment information, and construct the user public opinion data set {U, T}, where U = {u1,u2,…,u N} is the set of all users in the public opinion network, T is the comment set corresponding to the user, and the user sample is divided into training samples and test samples. Then the comment texts posted by the public opinion users are counted to construct an associated comment set. i The set of related comments is Is user u i The kth comment text, assuming that the embedding representation of a comment text is t = {w1,w2,...,w n}, use the Roberta model to encode the comment text to obtain the emotional semantic features of each comment The Roberta model uses a multi-head attention mechanism to extract semantic features. The calculation formula is:

[0120]

[0121] in, Is user u i The sentiment semantic feature vector of the kth comment text. Assuming there are m comments, user u i The set of related comments T i The vector matrix of the sentiment semantic features is X, and the dimension is R m×n , n is the maximum embedding dimension of the comment text; Perform Softmax activation to calculate the sentiment polarity of each comment text. The calculation formula is:

[0122]

[0123] in, Is user u i The sentiment polarity of k comments in the comment set, Indicates that the comment is a negative comment. Indicates that the comment is a positive comment, user u i The associated comment text data is

[0124] Step S2: Calculate the user's sentiment tendency score by combining the sentiment polarity of the user's comment text and the comment reply relationship.

[0125] The specific process is as follows: taking the users who posted comments as nodes, constructing the initial public opinion network G(U,E) based on the comment-reply relationship between users, and calculating the sentiment tendency score of each user. Counting the sentiment polarity distribution of the comment text in each user's associated comment set T, assuming that user u i There are p positive comments and n negative comments. Then count the number of users who have established reply relationships with this user, recorded as f. i The calculation formula of the sentiment tendency score is:

[0126]

[0127] in, Is user u i The number of reply relations, Is user u i Number of positive reviews, Is user u i The number of negative comments by user u i The sentiment label is s i ∈[-1,+1], the sentiment labels of all users are S={s1,s2,…,s N}.

[0128] Step S3: The sentiment consistency between users is calculated using the sentiment tendency scores between users, and the reply relationship consistency between users is calculated using the Jaccard similarity coefficient. The sentiment consistency and reply relationship consistency are linearly fused to calculate the similarity trust score between users. If the similarity trust score is greater than the trust threshold, the improved HK bounded trust model is used to build an implicit trust relationship between users, and the user trust relationship adjacency matrix is ​​updated.

[0129] Reference Figure 2 The specific process is as follows: according to the initial public opinion network structure, the trust relationship is divided into direct trust and implicit trust, and a trust relationship matrix A∈R is constructed.N×3 , A i,j =1 indicates user u j Trust user u i , using the improved HK bounded trust model to build implicit trust relationships. Specifically: First, count the number of users u i The direct trust relationship is recorded as N(i), and its direct trust neighbor u is counted k The direct trust relationship between users is recorded as N(k), and the Jaccard similarity coefficient is used to calculate the user u i and user u in N(k) j The reply relationship between them is RN:

[0130]

[0131] Where k∈N(i) represents user u i Directly trust user u k , j∈N(k),j no∈N(i) represents user u k Directly trust user u j And user u i Do not directly trust user u j , G i With G j For user u i and user u j The reply relationship set is used to measure the similarity of the public opinion network structure between users using the reply relationship consistency. The greater the similarity, the more likely it is that a trust relationship will be established between users.

[0132] Statistics user u i and user u j The sentiment tendency score of user u is calculated i With user u j Emotional consistency:

[0133]

[0134] Among them, s i ,s j They are user u i With user u j The emotional tendency score of the user, max(s) is the maximum emotional score, which is set to 1 in the present invention. The emotional consistency is used to measure the similarity of emotional tendencies between users. The higher the emotional consistency, the more likely it is that a trust relationship will be established between users.

[0135] The reply relationship consistency and sentiment consistency are linearly integrated to calculate the user u i With user u j The similarity trust score between is calculated as:

[0136] FS(i,j)=θ*RN _Jaccard (i,j)+(1-θ)*EC(i,j)

[0137] Set user u i With user u j The similarity trust score FS(i,j) between them is compared with the trust threshold ε. If the trust value is less than the trust threshold, it means that user u i With user u j There is no trust relationship between them. If the trust value is greater than the trust threshold, then i With user u j Build an implicit trust relationship between them and update user u i Then count the trust relationship set N(j) of user j and continue to build the adjacency matrix of user u i With user u j The implicit trust relationship between users in the trust relationship set N(j). Finally, the public opinion network G(U,A) is reconstructed by combining the direct implicit trust relationship between users, where U is the set of all users and A is i,j =1 indicates user u j Trust user u i .

[0138] Step S4: Calculate the trust between the user and its adjacent users based on the updated user trust relationship adjacency matrix, and reconstruct a public opinion network graph with trust as the directed edge weight.

[0139] The specific process is: statistics the updated user trust relationship adjacency matrix A, and calculate the trust scores of all the user's trusted neighbors and the user. The specific steps are as follows:

[0140] Calculate user u using Jaccard similarity coefficient i Its adjacent user u j The reply relationship between them is consistent with TN:

[0141]

[0142] Among them, G i With G j For user u i and user u j The reply relationship set is used to measure the similarity of the graph network structure between users. The greater the similarity, the more users trust each other.

[0143] Count the sentiment scores of all users S = {s1, s2, ..., s N}, calculate the emotional difference between users and perform normalization to obtain the emotional consistency EC between users:

[0144]

[0145] Among them, EC(i,j) is the i and user u j Emotional consistency between i ,s j For user u i With user u j The emotional tendency score of users, max(s) is the maximum emotional score, which is set to 1 in the present invention. Emotional consistency is used to measure the similarity of emotional tendencies between users. The more consistent the emotions are, the more users trust each other.

[0146] Then count the number of comments each user has made in reply to his or her neighbor's comments, and calculate the number of comments that user u has made in reply to his or her neighbor's comments. i With user u j The degree of interaction between:

[0147]

[0148] Among them, I i (i,j) is user u j Reply to user u i Total number of comments, A is the total number of comments replied by user j to all neighbor users, j Is user u j The set of adjacent users, IN(i,j) is used to measure the user u i With user u j The trust strength between them is that the closer the interaction is, the stronger the trust between them is. j For user u i The more trust;

[0149] The similar trust scores between the user and the adjacent users are calculated by comprehensively considering the graph network structure and the consistency of sentiment tendency, and then the interaction intensity of the adjacent users on the user is integrated. Specifically, the linear fusion method is used to calculate the trust of the adjacent users on the user. The calculation formula is:

[0150] T(i,j)=α×TN(i,j)+β×EC(i,j)+γ×IN(i,j)

[0151] Among them, α, β, γ are the i With user u j The influence weights of the reply relationship consistency TN, emotional consistency EC and interaction closeness are α+β+γ=1. T(i,j) is the j For user u i The trust score of j ∈A i, and then reconstruct a public opinion network graph with trust as the directed edge weight.

[0152] Step S5: Use the graph attention network model GAT to extract user sentiment features in the network structure of the public opinion network graph, and build a linear regression model to predict user sentiment scores.

[0153] Reference Figure 3 The specific process is as follows: according to the initial public opinion network, the initial node vector h of each user is defined, with the dimension R3, h = [f, p, n], and all users form a set H = h1, h2, ..., h n ,h i ∈R 3 , according to the relationship of the adjacency matrix A, the matrix [h i ,h j ],u j ∈A i . Fusion user u j For user u i The trust impact calculation of user u j To u i The importance of is as follows:

[0154]

[0155] Among them, α ij Is user u i and user u j The attention value between them, a∈R 2F is the weight parameter of the neural network, F is the output dimension of the user, W1∈R F×3 is the weight parameter of the initial embedding h, || means concatenating the feature vectors, and the activation function uses LeakyRelu; T(i,j) is the user u j For user u i The trust degree of , δ is the attenuation factor parameter of user trust transfer;

[0156] The present invention adopts a multi-head attention mechanism to update the user's feature vector. Assuming there are K attention heads, each attention head updates the user node u i Update the feature vector of the user node u i All vectors are concatenated and averaged, and finally the user's emotional tendency feature h′ is obtained. i , and its calculation formula is:

[0157]

[0158] Using the tanh activation function, the obtained h′ i is the hidden vector of the i-th user, with dimension R F, count the hidden vectors of all users and define the hidden embedding matrix H′∈R N×F , and then input it into the single-head attention layer to calculate the user's emotional tendency feature embedding:

[0159] Z = tanh(attention(H′,A))

[0160] The calculation uses the tanh activation function to obtain a high-dimensional user sentiment feature matrix Z∈R N×F , T is the output dimension of the user embedding vector. i The final emotional tendency feature z i Perform linear dimensionality reduction to obtain the predicted sentiment tendency score, which is calculated as follows:

[0161] s′ i =tanh(z i w2+b)

[0162] Among them, the calculation of user sentiment tendency score adopts tanh activation function, s′ i Is user u i The predicted sentiment score, w2∈R F is the weight parameter of the linear regression model, b∈R is the bias, and the sentiment tendency scores of all users in all public opinion networks are S′={s′1,s′2,…,s′ N}.

[0163] The sentiment prediction score s′ i With real emotion labels i The loss value is calculated by the MSE loss function, and its calculation formula is:

[0164]

[0165] The Adam optimization algorithm is used to train the model parameters, update and save the model. The optimized model is used to learn the user's emotional tendency characteristics and predict the user's emotions in the test set.

[0166] Example 2

[0167] like Figure 4 As shown, this embodiment provides a user sentiment analysis system for reconstructing a public opinion network based on trust relationships, which includes: a comment text sentiment polarity calculation module, a user sentiment tendency calculation module, a user trust relationship update module, a public opinion network reconstruction module and a user sentiment analysis module.

[0168] The comment text sentiment polarity calculation module is used to: use the Roberta model to encode the comment text to obtain the sentiment semantic features Then Perform Softmax() activation to calculate the sentiment polarity of the comment text. The specific process is: count the comment texts posted by public opinion users, build a related comment set, user u i The set of related comments is in, Is user u i The kth comment text, assuming that the embedding representation of a comment text is t = {w1,w2,...,w n}, use Roberta multi-head attention mechanism to encode the comment text to obtain the emotional semantic features of each comment The calculation formula is:

[0169]

[0170] in, Is user u i The sentiment semantic feature vector of the kth comment text. Assuming there are m comments, user u i The set of related comments T i The vector matrix of the sentiment semantic features is X, and the dimension is R m×n , n is the maximum embedding dimension of the comment text; Perform Softmax() activation to calculate the sentiment polarity of each comment text. The calculation formula is:

[0171]

[0172] in, Is user u i The sentiment polarity of k comments in the comment set, Indicates that the comment is a negative comment. Indicates that the comment is a positive comment, user u i The associated comment text data is

[0173] The user sentiment tendency calculation module is used to: construct the initial public opinion network G(U,E) based on the interaction behavior between user nodes, and calculate the sentiment tendency score of each user based on the sentiment polarity distribution and reply relationship of the user comment text;

[0174] The specific process of the user sentiment tendency calculation module is as follows: taking the user who posted the comment as the node, constructing the initial public opinion network G(U,E) according to the comment reply relationship between users, and calculating the sentiment tendency score of each user. Counting the sentiment polarity distribution of the comment text in the associated comment set T of each user, assuming that user u i There are p positive comments and n negative comments. Then count the number of users who have established reply relationships with this user, recorded as f.i The calculation formula of the sentiment tendency score is:

[0175]

[0176] in, Is user u i The number of reply relations, Is user u i Number of positive reviews, Is user u i The number of negative comments by user u i The sentiment label is s i ∈[-1,+1], the sentiment labels of all users are S={s1,s2,…,s N}.

[0177] The user trust relationship update module is used to: construct the user trust relationship adjacency matrix A based on the initial public opinion network, use the improved HK model to build implicit trust relationships, and update the user trust relationship adjacency matrix A;

[0178] The specific process of the user trust relationship update module is as follows: according to the initial public opinion network structure, the trust relationship is divided into direct trust and implicit trust, and a trust relationship matrix A∈R is constructed. N×3 , A i,j =1 indicates user u j Trust user u i , using the improved HK bounded trust model to build implicit trust relationships. First, count the number of users u i The direct trust relationship is recorded as N(i), and its direct trust neighbor u is counted k The direct trust relationship between users is recorded as N(k), and the Jaccard similarity coefficient is used to calculate the user u i and user u in N(k) j The reply relationship between them is RN:

[0179]

[0180] Where k∈N(i) represents user u i Directly trust user u k , j∈N(k),j no∈N(i) represents user u k Directly trust user u j And user u i Do not directly trust user u j , G i With G j For user u i and user u jThe reply relationship set is used to measure the similarity of the public opinion network structure between users using the reply relationship consistency. The greater the similarity, the more likely it is that a trust relationship will be established between users.

[0181] Statistics user u i and user u j The sentiment tendency score of user u is calculated i With user u j Emotional consistency:

[0182]

[0183] Among them, s i ,s j They are user u i With user u j The emotional tendency score of the user, max(s) is the maximum emotional score, which is set to 1 in the present invention. The emotional consistency is used to measure the similarity of the emotional tendencies between users. The higher the emotional consistency, the more likely it is that a trust relationship will be established between users.

[0184] The reply relationship consistency and sentiment consistency are linearly integrated to calculate the user u i With user u j The similarity trust score between is calculated as:

[0185] FS(i,j)=θ*RN _Jaccard (i,j)+(1-θ)*EC(i,j)

[0186] Set user u i With user u j The similarity trust score FS(i,j) between them is compared with the trust threshold ε. If the trust value is less than the trust threshold, it means that user u i With user u j There is no trust relationship between them. If the trust value is greater than the trust threshold, then i With user u j Build an implicit trust relationship between them and update user u i Then count the trust relationship set N(j) of user j and continue to build the adjacency matrix of user u i With user u j The implicit trust relationship between users in the trust relationship set N(j). Finally, the public opinion network G(U,A) is reconstructed by combining the direct implicit trust relationship between users, where U is the set of all users and A is i,j =1 indicates user u j Trust user u i .

[0187] The public opinion network reconstruction module is used to: calculate the similar trust scores and interaction density between users based on the trust relationship adjacency matrix A, use the linear fusion method to calculate the trust of the adjacent users on the user, and reconstruct a public opinion network graph network structure with trust as the directed edge weight;

[0188] The specific process of the public opinion network reconstruction module is: statistics on the updated user trust relationship adjacency matrix A, and calculate the trust scores of all the user's trust neighbors and the user. The specific steps are as follows:

[0189] Calculate user u using Jaccard similarity coefficient i Its adjacent user u j The reply relationship between them is consistent with TN:

[0190]

[0191] Among them, G i With G j For user u i and user u j The reply relationship set is used to measure the similarity of the graph network structure between users. The greater the similarity, the more users trust each other.

[0192] Count the sentiment scores of all users S = {s1, s2, ..., s N}, calculate the emotional difference between users and perform normalization to obtain the emotional consistency EC between users:

[0193]

[0194] Among them, EC(i,j) is the i and user u j Emotional consistency between i ,s j For user u i With user u j The emotional tendency score of users, max(s) is the maximum emotional score, which is set to 1 in the present invention. Emotional consistency is used to measure the similarity of emotional tendencies between users. The more consistent the emotions are, the more users trust each other.

[0195] Then count the number of comments each user has made in reply to his or her neighbor's comments, and calculate the number of comments that user u has made in reply to his or her neighbor's comments. i With user u j The degree of interaction between:

[0196]

[0197] Among them, I i (i,j) is user u jReply to user u i Total number of comments, A is the total number of comments replied by user j to all neighbor users, j Is user u j The set of adjacent users, IN(i,j) is used to measure the user u i With user u j The closer the trust strength between them, the stronger the interaction. j For user u i The more trust;

[0198] The similar trust scores between the user and the adjacent users are calculated by comprehensively considering the graph network structure and the consistency of sentiment tendency, and then the interaction intensity of the adjacent users on the user is integrated. Specifically, the linear fusion method is used to calculate the trust of the adjacent users on the user. The calculation formula is:

[0199] T(i,j)=α×TN(i,j)+β×EC(i,j)+γ×IN(i,j)

[0200] Among them, α, β, and γ are the i With user u j The influence weights of the reply relationship consistency TN, emotional consistency EC and interaction closeness are α+β+γ=1. T(i,j) is the j For user u i The trust score of j ∈A i , and then reconstruct a public opinion network graph with trust as the directed edge weight.

[0201] The user sentiment analysis module is used to: use the graph attention network model GAT to extract user sentiment tendency features in the user graph network structure, then construct a linear regression model to predict user sentiment scores, and use the Adam optimization algorithm to train samples to update model parameters, and then use the optimized model to perform user sentiment prediction analysis on the test set samples.

[0202] The specific process of the user sentiment analysis module is as follows: according to the initial public opinion network, the initial node vector h of each user is defined, the dimension is R3, h = [f, p, n], and all users form a set H = h1, h2, ..., h n ,h i ∈R 3 , according to the relationship of the adjacency matrix A, the matrix [h i ,h j ],u j ∈A i . Fusion user u j For user u i The trust impact calculation of user u j To ui The importance of is as follows:

[0203]

[0204] Among them, α ij Is user u i and user u j The attention value between them, a∈R 2F is the weight parameter of the neural network, F is the output dimension of the user, W1∈R F×3 is the weight parameter of the initial embedding h, || means concatenating the feature vectors, and the activation function uses LeakyRelu; T(i,j) is the user u j For user u i The trust degree of , δ is the attenuation factor parameter of user trust transfer;

[0205] The present invention adopts a multi-head attention mechanism to update the user's feature vector. Assuming there are K attention heads, each attention head updates the user node u i Update the feature vector of the user node u i All vectors are concatenated and averaged, and finally the user's emotional tendency feature h′ is obtained. i , and its calculation formula is:

[0206]

[0207] Using the tanh activation function, the obtained h′ i is the hidden vector of the i-th user, with dimension R F , count the hidden vectors of all users and define the hidden embedding matrix H′∈R N×F , and then input it into the single-head attention layer to calculate the user's emotional tendency feature embedding:

[0208] Z = tanh(attention(H′,A))

[0209] The calculation uses the tanh activation function to obtain a high-dimensional user sentiment feature matrix Z∈R N×F , T is the output dimension of the user embedding vector. i The final emotional tendency feature z i Perform linear dimensionality reduction to obtain the predicted sentiment tendency score, which is calculated as follows:

[0210] s′ i =tanh(z i w2+b)

[0211] Among them, the calculation of user sentiment tendency score adopts tanh activation function, s′ i Is user ui The predicted sentiment score, w2∈R F is the weight parameter of the linear regression model, b∈R is the bias, and the sentiment tendency scores of all users in all public opinion networks are S′={s′1,s′2,…,s′ N}.

[0212] The sentiment prediction score s′ i With real emotion labels i The loss value is calculated by the MSE loss function, and its calculation formula is:

[0213]

[0214] The Adam optimization algorithm is used to train the model parameters and update and save the model. The optimized model is used to learn the user's emotional tendency characteristics, and the user emotions of the test set are predicted, and the RMSE evaluation model is calculated.

[0215] Example 3

[0216] This embodiment provides an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and can be run on the processor. When the computer program is executed by the processor, the steps in the user sentiment analysis method for reconstructing the public opinion network based on the trust relationship in the above-mentioned embodiment 1 are implemented. For the sake of brevity, it will not be repeated here. It should be understood that in this embodiment, the processor can be a central processing unit CPU, and the processor can also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The memory can include a read-only memory and a random access memory, and provide instructions and data to the processor. A part of the memory can also include a non-volatile random access memory. For example, the memory can also store information about the type of device. Electronic devices include but are not limited to user devices, network devices, or devices formed by integrating user devices and network devices through a network. The user device includes but is not limited to any mobile electronic product that can interact with a user through a touch panel, such as a smart phone, a tablet computer, etc. The mobile electronic product can use any operating system, such as an Android operating system, an IOS operating system, etc. The network device includes an electronic device that can automatically perform numerical calculations and information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), digital signal processors (DSP), embedded devices, etc. The network device includes but is not limited to computers, network hosts, single network servers, multiple network server sets or a cloud composed of multiple servers; here, the cloud is composed of a large number of computers or network servers based on cloud computing, wherein cloud computing is a type of distributed computing, a virtual supercomputer composed of a group of loosely coupled computer sets.

[0217] Example 4

[0218] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the user sentiment analysis method for reconstructing a public opinion network based on a trust relationship in the above-mentioned embodiment 1 are implemented. For the sake of brevity, it is not repeated here. The computer-readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. The computer-readable storage medium can be, for example, - but not limited to - an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), static random access memories (SRAM), portable compact disk read-only memories (CD-ROM), digital versatile disks (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or protruding structures in grooves on which instructions are stored, and any suitable combination of the above. The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0219] It should be noted that the embodiments of the present invention have better practicability and do not impose any form of limitation on the present invention. Any technician familiar with the field may use the technical content disclosed above to change or modify it into an equivalent effective embodiment. However, any modification or equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.

Claims

1. A user sentiment analysis method for reconstructing public opinion networks based on trust relationships, characterized in that: include: Step S1: Collect the comment texts of Internet users that meet specific requirements under topics related to a specific public opinion event, and calculate the sentiment polarity of each comment text; Step S2: Calculate the user's sentiment tendency score by combining the sentiment polarity of the user's comment text and the comment reply relationship; Step S3: Use the sentiment tendency scores between users to calculate the sentiment consistency between users, use the Jaccard similarity coefficient to calculate the reply relationship consistency between users, linearly fuse the sentiment consistency and reply relationship consistency, and calculate the similarity trust score between users. If the similarity trust score is greater than the trust threshold, use the improved HK bounded trust model to build an implicit trust relationship between users, and update the user trust relationship adjacency matrix; Step S4: Calculate the trust between the user and its adjacent users based on the updated user trust relationship adjacency matrix, and reconstruct a public opinion network graph network structure with trust as the directed edge weight; Step S5: Use the graph attention network model GAT to extract user sentiment features in the network structure of the public opinion network graph, and build a linear regression model to predict user sentiment scores.

2. The user sentiment analysis method for reconstructing a public opinion network based on trust relationships according to claim 1 is characterized in that: In step S1, crawl all data under a topic related to a specific public opinion event, select the data that meets the specific requirements as the data source, collect the user information participating in the discussion under the data source and the corresponding comment information, and construct the user public opinion data set {U, T}, where U = {u1, u2, …, u N } is the set of all users in the public opinion network, T is the comment set corresponding to the user, and the user sample is divided into training samples and test samples; then the comment texts posted by the public opinion users are counted to construct an associated comment set, user u i The set of related comments is Is user u i The kth comment text, assuming that the embedding representation of a comment text is t = {w1,w2,...,w n }, use the Roberta model to encode the comment text to obtain the emotional semantic features of each comment The Roberta model uses a multi-head attention mechanism to extract semantic features. The calculation formula is: in, Is user u i The sentiment semantic feature vector of the kth comment text. Assuming there are m comments, user u i The set of related comments T i The vector matrix of the sentiment semantic features is X, and the dimension is R m×n , n is the maximum embedding dimension of the comment text; Perform Softmax activation to calculate the sentiment polarity of each comment text. The calculation formula is: in, Is user u i The sentiment polarity of k comments in the comment set, Indicates that the comment is a negative comment. Indicates that the comment is a positive comment, user u i The associated comment text data is 3. The user sentiment analysis method for reconstructing a public opinion network based on trust relationships as claimed in claim 2 is characterized in that: In step S2, the users who posted comments are taken as nodes, and the initial public opinion network G(U,E) is constructed based on the comment-reply interaction relationship between users, and the sentiment tendency score of each user is calculated; the sentiment polarity distribution of the comment text in the associated comment set T of each user is counted. Assuming that user u i There are p positive comments and n negative comments. Then count the number of users who have established reply relationships with this user, recorded as f, and the public opinion user u i The calculation formula of the sentiment tendency score is: in, Is user u i The number of reply relations, Is user u i Number of positive reviews, Is user u i The number of negative comments by user u i The sentiment label is s i ∈[-1,+1], the sentiment labels of all users are S={s1,s2,…,s N }.

4. The user sentiment analysis method for reconstructing a public opinion network based on trust relationships as claimed in claim 3 is characterized in that: In step S3, the trust relationship is divided into direct trust and implicit trust according to the initial public opinion network structure, and a trust relationship matrix A∈R is constructed. N×3 , A i,j =1 indicates user u j Trust user u i , using the improved HK bounded trust model to build implicit trust relationships, specifically: first count the number of users u i The direct trust relationship is recorded as N(i), and its direct trust neighbor u is counted k The direct trust relationship between users is recorded as N(k), and the Jaccard similarity coefficient is used to calculate the user u i and user u in N(k) j The reply relationship between them is RN: Where k∈N(i) represents user u i Directly trust user u k , j∈N(k),j no∈N(i) represents user u k Directly trust user u j And user u i Do not directly trust user u j , G i With G j For user u i and user u j The reply relation set of ; Statistics user u i and user u j The sentiment tendency score of user u is calculated i With user u j Emotional consistency: Among them, s i ,s j They are user u i With user u j The sentiment tendency score of , max(s) is the maximum sentiment score; The reply relationship consistency and sentiment consistency are linearly integrated to calculate the user u i With user u j The similarity trust score between is calculated as: FS(i,j)=θ*RN _Jaccard (i,j)+(1-θ)*EC(i,j) Set user u i With user u j The similarity trust score FS(i,j) between them is compared with the trust threshold ε. If the trust value is less than the trust threshold, it means that user u i With user u j There is no trust relationship between them. If the trust value is greater than the trust threshold, then i With user u j Build an implicit trust relationship between them and update user u i adjacency matrix; then count the trust relationship set N(j) of user j and continue to build the trust relationship set of user u i With user u j The implicit trust relationship between users in the trust relationship set N(j); finally, the public opinion network G(U,A) is reconstructed by combining the direct implicit trust relationship between users, where U is the set of all users and A is i,j =1 indicates user u j Trust user u i .

5. The user sentiment analysis method for reconstructing a public opinion network based on trust relationships as claimed in claim 4 is characterized in that: In step S4, the updated user trust relationship adjacency matrix A is counted to calculate the trust scores of all the user's trust neighbors and the user. The specific steps are as follows: Calculate user u using Jaccard similarity coefficient i Its adjacent user u j The reply relationship between them is consistent with TN: Among them, G i With G j For user u i and user u j The reply relation set of ; Count the sentiment scores of all users S = {s1, s2, ..., s N }, calculate the emotional difference between users and perform normalization to obtain the emotional consistency EC between users: Among them, EC(i,j) is the i and user u j Emotional consistency between i ,s j For user u i With user u j The sentiment tendency score of , max(s) is the maximum sentiment score; Then count the number of comments each user has made in reply to his or her neighbor's comments, and calculate the number of comments that user u has made in reply to his or her neighbor's comments. i With user u j The degree of interaction between: Among them, I i (i,j) is user u j Reply to user u i Total number of comments, A is the total number of comments replied by user j to all neighbor users, j Is user u j The set of adjacent users, IN(i,j) is used to measure the user u i With user u j The trust strength between them is that the closer the interaction is, the stronger the trust between them is. j For user u i The more trust; The similar trust scores between the user and the adjacent users are calculated by comprehensively considering the graph network structure and the consistency of sentiment tendency, and then the interaction intensity of the adjacent users on the user is integrated. Specifically, the linear fusion method is used to calculate the trust of the adjacent users on the user. The calculation formula is: T(i,j)=α×TN(i,j)+β×EC(i,j)+γ×IN(i,j) Among them, α, β, and γ are the i With user u j The influence weights of the reply relationship consistency TN, emotional consistency EC and interaction closeness are α+β+γ=1; T(i,j) is the influence weight of user u j For user u i The trust score of j ∈A i ; Subsequently, a public opinion network graph with trust as the directed edge weight is reconstructed.

6. The user sentiment analysis method for reconstructing a public opinion network based on trust relationships as claimed in claim 5 is characterized in that: In step S5, the initial node vector h of each user is defined according to the initial public opinion network, with a dimension of R 3 , h=[f,p,n], all users form a set H=h1,h2,…,h n ,h i ∈R 3 , according to the relationship of the adjacency matrix A, the matrix [h i ,h j ],u j ∈A i ; Fusion user u j For user u i The trust impact calculation of user u j To u i The importance of is as follows: Among them, α ij Is user u i and user u j The attention value between them, a∈R 2F is the weight parameter of the neural network, F is the output dimension of the user, W1∈R F×3 is the weight parameter of the initial embedding h, || means concatenating the feature vectors, and the activation function uses LeakyRelu; T(i,j) is the user u j For user u i The trust degree of , δ is the attenuation factor parameter of user trust transfer; A multi-head attention mechanism is used to update the user's feature vector. Assume that there are K attention heads, and each attention head is responsible for the user node u i Update the feature vector of the user node u i All vectors are concatenated and averaged, and finally the user's emotional tendency feature h′ is obtained. i , and its calculation formula is: Using the tanh activation function, the obtained h′ i is the hidden vector of the i-th user, with dimension R F , count the hidden vectors of all users and define the hidden embedding matrix H′∈R N×F , and then input it into the single-head attention layer to calculate the user's emotional tendency feature embedding: Z = tanh(attention(H′,A)) The calculation uses the tanh activation function to obtain a high-dimensional user sentiment feature matrix Z∈R N×F , T is the output dimension of the user embedding vector; user u i The final emotional tendency feature z i Perform linear dimensionality reduction to obtain the predicted sentiment tendency score, which is calculated as follows: S' i =tanh(z i w2+b) Among them, the calculation of user sentiment tendency score adopts tanh activation function, s′ i Is user u i The predicted sentiment score, w2∈R F is the weight parameter of the linear regression model, b∈R is the bias, and the sentiment tendency scores of all users in all public opinion networks are S′={s′1,s′2,…,s′ N }; The sentiment prediction score s′ i With real emotion labels i The loss value is calculated by the MSE loss function, and its calculation formula is: The Adam optimization algorithm is used to train samples to update model parameters, and then the optimized model is used to perform user sentiment prediction analysis on the test set samples.

7. A user sentiment analysis system for reconstructing public opinion networks based on trust relationships, characterized in that: include: A comment text sentiment polarity calculation module, which collects comment texts of network users that meet specific requirements under topics related to specific public opinion events, and calculates the sentiment polarity of each comment text; A user sentiment tendency calculation module, which is used to calculate the user's sentiment tendency score by combining the sentiment polarity of the user's comment text and the comment reply relationship; A user trust relationship updating module, wherein the user trust relationship updating module calculates the emotional consistency between users by using the emotional tendency scores between users, calculates the reply relationship consistency between users by using the Jaccard similarity coefficient, linearly fuses the emotional consistency and the reply relationship consistency, and calculates the similar trust scores between users. If the similar trust score is greater than the trust threshold, an improved HK bounded trust model is used to build an implicit trust relationship between users, and the user trust relationship adjacency matrix is ​​updated; A public opinion network reconstruction module, which calculates the trust between the user and its adjacent users according to the updated user trust relationship adjacency matrix, and reconstructs a public opinion network graph network structure with the trust as the directed edge weight; The user sentiment analysis module uses the graph attention network model GAT to extract user sentiment features in the network structure of the public opinion network graph, and constructs a linear regression model to predict user sentiment scores.

8. The user sentiment analysis system for reconstructing a public opinion network based on trust relationships as claimed in claim 7, characterized in that: The comment text sentiment polarity calculation module is used to crawl all data under a topic related to a specific public opinion event, select the data that meets specific requirements as the data source, collect the user information participating in the discussion under the data source and the corresponding comment information, and construct a user public opinion data set {U, T}, where U = {u1, u2, ..., u N } is the set of all users in the public opinion network, T is the comment set corresponding to the user, and the user sample is divided into training samples and test samples; then the comment texts posted by the public opinion users are counted to construct an associated comment set, user u i The set of related comments is Is user u i The kth comment text, assuming that the embedding representation of a comment text is t = {w1,w2,...,w n }, use the Roberta model to encode the comment text to obtain the emotional semantic features of each comment The Roberta model uses a multi-head attention mechanism to extract semantic features. The calculation formula is: in, Is user u i The sentiment semantic feature vector of the kth comment text. Assuming there are m comments, user u i The set of related comments T i The vector matrix of the sentiment semantic features is X, and the dimension is R m×n , n is the maximum embedding dimension of the comment text; Perform Softmax activation to calculate the sentiment polarity of each comment text. The calculation formula is: in, Is user u i The sentiment polarity of k comments in the comment set, Indicates that the comment is a negative comment. Indicates that the comment is a positive comment, user u i The associated comment text data is The user sentiment tendency calculation module is used to: take the user who posted the comment as a node, build the initial public opinion network G(U,E) according to the comment reply interaction relationship between users, and calculate the sentiment tendency score of each user; count the sentiment polarity distribution of the comment text in the associated comment set T of each user, assuming that user u i There are p positive comments and n negative comments. Then count the number of users who have established reply relationships with this user, recorded as f, and the public opinion user u i The calculation formula of the sentiment tendency score is: in, Is user u i The number of reply relations, Is user u i Number of positive reviews, Is user u i The number of negative comments by user u i The sentiment label is s i ∈[-1,+1], the sentiment labels of all users are S={s1,s2,…,s N }; The user trust relationship update module is used to: divide the trust relationship into direct trust and implicit trust according to the initial public opinion network structure, and construct a trust relationship matrix A∈R N×3 , A i,j =1 indicates user u j Trust user u i , using the improved HK bounded trust model to build implicit trust relationships, specifically: first count the number of users u i The direct trust relationship is recorded as N(i), and its direct trust neighbor u is counted k The direct trust relationship between users is recorded as N(k), and the Jaccard similarity coefficient is used to calculate the user u i and user u in N(k) j The reply relationship between them is RN: Where k∈N(i) represents user u i Directly trust user u k , j∈N(k),j no∈N(i) represents user u k Directly trust user u j And user u i Do not directly trust user u j , G i With G j For user u i and user u j The reply relation set of ; Statistics user u i and user u j The sentiment tendency score of user u is calculated i With user u j Emotional consistency: Among them, s i ,s j They are user u i With user u j The sentiment tendency score of , max(s) is the maximum sentiment score; The reply relationship consistency and sentiment consistency are linearly integrated to calculate the user u i With user u j The similarity trust score between is calculated as: FS(i,j)=θ*RN _Jaccard (i,j)+(1-θ)*EC(i,j) Set user u i With user u j The similarity trust score FS(i,j) between them is compared with the trust threshold ε. If the trust value is less than the trust threshold, it means that user u i With user u j There is no trust relationship between them. If the trust value is greater than the trust threshold, then i With user u j Build an implicit trust relationship between them and update user u i adjacency matrix; then count the trust relationship set N(j) of user j and continue to build the trust relationship set of user u i With user u j The implicit trust relationship between users in the trust relationship set N(j); finally, the public opinion network G(U,A) is reconstructed by combining the direct implicit trust relationship between users, where U is the set of all users and A is i,j =1 indicates user u j Trust user u i ; The public opinion network reconstruction module is used to: count the updated user trust relationship adjacency matrix A, and calculate the trust scores of all the user's trusted neighbors and the user. The specific steps are as follows: Calculate user u using Jaccard similarity coefficient i Its adjacent user u j The reply relationship between them is consistent with TN: Among them, G i With G j For user u i and user u j The reply relation set of ; Count the sentiment scores of all users S = {s1, s2, ..., s N }, calculate the emotional difference between users and perform normalization to obtain the emotional consistency EC between users: Among them, EC(i,j) is the i and user u j Emotional consistency between i ,s j For user u i With user u j The sentiment tendency score of , max(s) is the maximum sentiment score; Then count the number of comments each user has made in reply to his or her neighbor's comments, and calculate the number of comments that user u has made in reply to his or her neighbor's comments. i With user u j The degree of interaction between: Among them, I i (i,j) is user u j Reply to user u i Total number of comments, A is the total number of comments replied by user j to all neighbor users, j Is user u j The set of adjacent users, IN(i,j) is used to measure the user u i With user u j The trust strength between them is that the closer the interaction is, the stronger the trust between them is. j For user u i The more trust; The similar trust scores between the user and the adjacent users are calculated by comprehensively considering the graph network structure and the consistency of sentiment tendency, and then the interaction intensity of the adjacent users on the user is integrated. Specifically, the linear fusion method is used to calculate the trust of the adjacent users on the user. The calculation formula is: T(i,j)=α×TN(i,j)+β×EC(i,j)+γ×IN(i,j) Among them, α, β, and γ are the i With user u j The influence weights of the reply relationship consistency TN, emotional consistency EC and interaction closeness are α+β+γ=1; T(i,j) is the influence weight of user u j For user u i The trust score of j ∈A i ; Then, a public opinion network graph with trust as directed edge weight is reconstructed; The user sentiment analysis module is used to define the initial node vector h of each user according to the initial public opinion network, with a dimension of R 3 , h=[f,p,n], all users form a set H=h1,h2,…,h n ,h i ∈R 3 , according to the relationship of the adjacency matrix A, the matrix [h i ,h j ],u j ∈A i ; Fusion user u j For user u i The trust impact calculation of user u j To u i The importance of is as follows: Among them, α ij Is user u i and user u j The attention value between them, a∈R 2F is the weight parameter of the neural network, F is the output dimension of the user, W1∈R F×3 is the weight parameter of the initial embedding h, || means concatenating the feature vectors, and the activation function uses LeakyRelu; T(i,j) is the user u j For user u i The trust degree of , δ is the attenuation factor parameter of user trust transfer; A multi-head attention mechanism is used to update the user's feature vector. Assume that there are K attention heads, and each attention head is responsible for the user node u i Update the feature vector of the user node u i All vectors are concatenated and averaged, and finally the user's emotional tendency feature h′ is obtained. i , and its calculation formula is: Using the tanh activation function, the obtained h′ i is the hidden vector of the i-th user, with dimension R F , count the hidden vectors of all users and define the hidden embedding matrix H′∈R N×F , and then input it into the single-head attention layer to calculate the user's emotional tendency feature embedding: Z = tanh(attention(H′,A)) The calculation uses the tanh activation function to obtain a high-dimensional user sentiment feature matrix Z∈R N×F , T is the output dimension of the user embedding vector; user u i The final emotional tendency feature z i Perform linear dimensionality reduction to obtain the predicted sentiment tendency score, which is calculated as follows: S' i =tanh(z i w2+b) Among them, the calculation of user sentiment tendency score adopts tanh activation function, s′ i Is user u i The predicted sentiment score, w2∈R F is the weight parameter of the linear regression model, b∈R is the bias, and the sentiment tendency scores of all users in all public opinion networks are S′={s′1,s′2,…,s′ N }; The sentiment prediction score s′ i With real emotion labels i The loss value is calculated by the MSE loss function, and its calculation formula is: The Adam optimization algorithm is used to train samples to update model parameters, and then the optimized model is used to perform user sentiment prediction analysis on the test set samples.

9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the user sentiment analysis method for reconstructing a public opinion network based on trust relationships as described in any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the user sentiment analysis method for reconstructing a public opinion network based on trust relationships are implemented as described in any one of claims 1 to 6.