Microblog sentiment analysis method fusing direct and indirect social relations

By fusing direct and indirect social relationships through a multi-layered hybrid network model and graph attention network, the problems of data sparsity and neglect of indirect relationships in Weibo sentiment analysis are solved, thereby improving the accuracy and consistency of sentiment classification.

CN121327142APending Publication Date: 2026-01-13CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511501413.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-21
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

Existing sentiment analysis methods for Weibo suffer from data sparsity when processing short texts and neglect the influence of indirect social relationships, resulting in the model's inability to capture broader sentiment impact.

Method used

We employ a multi-layer hybrid network model to extract deep semantic features from Weibo texts, mine indirect social relationships through link prediction, construct a Weibo relationship graph, and use graph attention networks to integrate social information, combined with a fully connected classification layer for sentiment prediction.

Benefits of technology

It improves the accuracy of Weibo sentiment classification, captures long-distance sentiment consistency, filters out irrelevant connections, and enriches sentiment context information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121327142A_ABST
    Figure CN121327142A_ABST
Patent Text Reader

Abstract

The invention relates to a microblog sentiment analysis method fusing direct and indirect social relations, and belongs to the field of natural language processing. The method comprises the following steps of: 1, extracting microblog text features by utilizing a multilayer hybrid network; 2, predicting and mining indirect social relationships among users through links, and constructing a microblog relationship graph by utilizing the direct and indirect social relationships; 3, optimizing the microblog relationship graph by utilizing content similarity, 4, fusing social information in the microblog relation graph into microblog text features by using a graph attention network; and 5, predicting the emotion category of the target microblog through a full-connection classification layer. According to the microblog sentiment analysis method fusing the direct and indirect social relations, the direct and indirect social relations between the users are considered at the same time, and the social information is effectively fused into the target microblog features, so that the model can capture wider sentiment information, and the method has high sentiment recognition capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing and relates to a Weibo sentiment analysis method that integrates direct and indirect social relationships. Background Technology

[0002] With the rapid development of the internet, social media has become an important channel for people to share opinions, exchange emotions, and disseminate information. As a typical form of social media, Weibo plays a vital role in information dissemination, social interaction, and public opinion formation due to its short text, real-time nature, and convenient interaction. The Weibo platform generates massive amounts of user-generated content daily, encompassing users' personal emotions and attitudes, as well as public evaluations of current events, policies, social issues, and products and services. This data contains rich emotional information, providing an important data source for social psychological insights and public opinion analysis. Weibo sentiment analysis aims to identify and mine the emotional tendencies within Weibo data, and its applications are of significant value in various fields such as marketing, public opinion monitoring, and social science research.

[0003] Current research on sentiment analysis for Weibo primarily focuses on the text content. Traditional text sentiment analysis models typically perform well when handling grammatically correct and context-rich long texts. However, Weibo text is unique in that it is short, colloquial, and uses informal language, often containing a large amount of internet slang, special symbols, and other non-standard expressions. These characteristics lead to data sparsity in Weibo text, causing traditional methods relying on pure text features to reach a performance bottleneck.

[0004] Leveraging the characteristics of Weibo as networked data, integrating social relationship information into sentiment analysis models can effectively mitigate the negative impact of data sparsity. Early Weibo sentiment analysis methods primarily focused on constructing social relationships as graphs and incorporating them into machine learning models using Laplacian regularization. To uncover deeper textual semantics, more methods began vectorizing social relationships and inputting them as features into deep neural networks, fusing them with textual features. However, existing methods largely focus on users' direct social relationships when considering Weibo connections, neglecting the impact of indirect social relationships. In social networks, some users may not have mutual friends or interactions, but they may share common friends or belong to the same community or interest group. These indirect connections are also important channels for sentiment transmission and the formation of homogeneity; ignoring these relationships causes the model to lose potential long-range dependency information and fail to capture broader emotional influence. Summary of the Invention

[0005] The present invention aims to solve the problems existing in the prior art and proposes a method to improve the accuracy of Weibo sentiment classification.

[0006] To address the problems encountered in existing research, the present invention provides the following solution:

[0007] A Weibo sentiment analysis method that integrates direct and indirect social relationships includes the following steps:

[0008] Step 1: Use a multi-layer network model to extract and focus hierarchical features from the Weibo text to obtain its deep semantic features.

[0009] Step 2: Discover indirect social relationships in users' social networks through link prediction, and construct a microblog relationship graph using direct and indirect social relationships;

[0010] Step 3: Optimize the Weibo relationship graph using content similarity to filter out irrelevant connections and noise information in the graph;

[0011] Step 4: Utilize graph attention networks to integrate social information from the Weibo relationship graph into the deep semantic features of the text, thereby achieving feature fusion between the target Weibo post and related Weibo posts;

[0012] Step 5: Predict the sentiment category of the target microblog through a fully connected classification layer, and train the model using the cross-entropy function as the target loss function.

[0013] Furthermore, the specific process of step one is as follows:

[0014] For an input text x i First, the BERT word segmenter is used to segment, pad, and truncate the input IDs, resulting in a fixed-length input ID sequence and its corresponding attention mask. Then, this sequence is fed into a pre-trained BERT model, and the hidden states of the last encoder layer are extracted as the embedding representation of each word in the text. The output features of the i-th Weibo text can be represented as:

[0015] s i =BERT(x i )

[0016] in, l is the length of the text sequence; d0 is the dimension of the hidden layer of the BERT pre-trained model.

[0017] To efficiently extract local contextual features from the token sequences generated by BERT, a convolutional neural network (CNN) layer is introduced after the BERT layer. The BERT output features are transformed in dimension and then input into multiple sets of one-dimensional convolutional layers. Feature extraction is performed in parallel using t different sizes of convolutional kernels to capture local information at different scales. When the kernel window size is set to k, the output of the j-th convolutional kernel is:

[0018]

[0019] Among them, W j and b j These are the weights and bias vectors corresponding to the j-th convolutional kernel, respectively. The output of the convolutional layer is represented as:

[0020] y = {y 1 ,y 2 ,…,y t}

[0021] Among them, y i ∈R f×l Where f is the number of convolutional kernels of each size. The outputs of convolutional kernels of different sizes are concatenated along the channel dimension to obtain an enhanced combined feature representation:

[0022] y c =Concat(y 1 ,y 2 ,…,y t )∈R (f×t)×l

[0023] Subsequently, a bidirectional gated recurrent unit (Bi-GRU) is introduced to perform sequence modeling on the output of the CNN layer. The output h of the Bi-GRU layer... g The calculation is expressed as follows:

[0024] h g =[h1,h2,…,h l ]∈R l×(2·h)

[0025] h i =BiGRU(c i )

[0026]

[0027] Among them, h i Let h be the output vector of the bidirectional GRU at the i-th time step; h is the hidden unit dimension of the unidirectional GRU.

[0028] To enable the model to focus on the most critical parts, a multi-head self-attention mechanism is introduced to differentially weight different parts of the sequence. The output of the multi-head attention mechanism is represented as follows:

[0029] Z = Concat(Z1, Z2, ..., Z) c W l

[0030]

[0031] Among them, Z iIt is the output of the i-th multi-head attention mechanism; c is the number of heads in the multi-head attention mechanism; W l This is the weight matrix of the linear layer; These are the weights corresponding to the query vector Q, key vector K, and value vector V, respectively; d k Let k be the dimension of the key vector k.

[0032] To obtain a single vector that represents the sentiment of the entire text, the output of the multi-head attention layer is averaged along the sequence dimension to obtain sentence-level feature representations:

[0033] p = Mean(Z)

[0034] Finally, the output of the multi-head attention layer after average pooling is extracted as the deep feature representation of the Weibo text:

[0035] P = {p1, p2, ..., p} m}

[0036] Where, p i ∈R 2h , where m is the number of texts in the Weibo post.

[0037] Furthermore, the specific process of step two is as follows:

[0038] Let U∈R m×n Let U represent the microblog-user matrix, where m is the number of microblog posts and n is the number of users. For matrix U, u ij =1 represents user i posting a Weibo post j. Let F∈R n×n Let f represent the user-user matrix. For matrix F, f ij =1 indicates that there is a follow relationship between user i and user j. To find indirect relationships between users who do not have a direct follow relationship, the Adamic Adar algorithm is used to mine indirect relationships in the user follow network. The indirect relationship matrix is ​​represented as follows:

[0039]

[0040] Where N(u) represents the set of nodes adjacent to node u.

[0041] The relationships in the indirect relationship matrix are selected by finding user pairs with higher intimacy among users with indirect relationships. The selected indirect relationship matrix is ​​represented as follows:

[0042] O f =S(O)

[0043] S(·) is the relational selection function, and the formula is as follows:

[0044]

[0045] Where δ is the threshold for measuring the intimacy between relational nodes.

[0046] A microblog relationship matrix is ​​constructed using direct and indirect social relationships, as shown below:

[0047] A = UFU T +UO f U T

[0048] Furthermore, the specific process of step three includes:

[0049] To improve the probability of sentiment consistency among Weibo posts in the Weibo relationship graph, content similarity is introduced to further filter relationship pairs in the graph, as shown below:

[0050]

[0051] The function for calculating content similarity considers TF-IDF similarity and cosine similarity between Weibo posts, and the formula is as follows:

[0052]

[0053] Among them, cos1(s i ,s j ) for Weibo i and s j Cosine similarity of text features between them; cos2(s i ,s j To convert each word in the Weibo text to TF-IDF (w i,j After combining the text vectors, the cosine similarity is calculated; θ is the threshold for measuring the content similarity between texts.

[0054] Furthermore, the specific process of step four includes:

[0055] To more accurately capture the emotional propagation mechanism of Weibo in social networks, a graph attention network is used to learn the emotional propagation state of each Weibo node in the relationship graph, quantify the degree to which the target Weibo is influenced by its social neighbors, and achieve feature fusion between the target Weibo and the relationship Weibo.

[0056] The microblog relation matrix A is used as the adjacency matrix of the graph, and the text features p of each microblog are used as the adjacency matrix. i These are represented as node features. The node features are updated using a graph attention layer to obtain a new node vector. The update definition for the i-th Weibo node feature is as follows:

[0057]

[0058] Where K represents the number of heads in the attention mechanism; N i Let W be the set of neighboring nodes of the i-th microblog node in the relation matrix; k Let be the trainable linear transformation matrix corresponding to the kth attention head; These are the normalized attention coefficients calculated for the k-th attention head. The calculation is as follows:

[0059]

[0060] In the formula, W and W are the trainable parameters and the shared parameter matrix, respectively.

[0061] Furthermore, the specific process of step five includes:

[0062] The updated microblog node vector is input into a fully connected classification layer to predict the sentiment category of the target microblog. The probability distribution of the sentiment prediction for the i-th microblog is represented as:

[0063]

[0064] Among them, W c and b c These are the weight matrix and bias vector of the classification layer, respectively.

[0065] The model is trained using the cross-entropy function as the target loss function, as shown below:

[0066]

[0067] Where D is the training set; y i This represents the probability distribution of the true labels.

[0068] The beneficial effects of this invention are as follows: This invention proposes a microblog sentiment analysis method that integrates direct and indirect social relationships, including: (1) designing a multi-layer hybrid network structure to achieve hierarchical feature extraction and focusing of microblog text, while effectively integrating social information into the deep semantic representation of the text, thereby improving classification performance. (2) when constructing the microblog relationship graph, both direct and indirect social relationships are utilized, which enables the model to capture long-distance sentiment consistency and enrich the sentiment context. (3) by introducing content similarity to optimize the microblog relationship graph, irrelevant connections and noise information in the graph are effectively filtered out, improving the sentiment consistency of the network, and enabling the target microblog to learn more effective sentiment features from the relationship microblogs.

[0069] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description

[0070] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein:

[0071] Figure 1 To integrate the sentiment analysis process of Weibo with direct and indirect social relationships;

[0072] Figure 2 A diagram of a Weibo sentiment analysis model that integrates direct and indirect social relationships. Detailed Implementation

[0073] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0074] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.

[0075] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "front," and "rear" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.

[0076] like Figure 1 As shown, this invention provides a Weibo sentiment analysis method that integrates direct and indirect social relationships. First, Weibo text is processed through a multi-layer hybrid network to extract text features. Indirect social relationships between users are mined through link prediction, and a Weibo relationship graph is constructed using both direct and indirect social relationships, then optimized by incorporating content similarity. Finally, a graph attention network is used to integrate social information into the text features, and sentiment classification is performed through fully connected layers.

[0077] Figure 2 This is a system model diagram of the present invention. The following description, in conjunction with the accompanying drawings, includes the following modules:

[0078] Module 1: Using a multi-layer hybrid network model, hierarchical feature extraction and focusing are performed on Weibo text to obtain deep semantic features of the text;

[0079] Module 2: Using users' explicit follows as direct relationships, we will use link prediction to uncover potential indirect relationships between users and construct a microblog relationship graph using direct and indirect social relationships.

[0080] Module 3: Optimize the Weibo relationship graph by using content similarity to filter out irrelevant connections and noise information in the graph and improve the probability of sentiment consistency of Weibo connections in the relationship graph;

[0081] Module 4: Utilizing graph attention networks to integrate social information from the microblog relationship graph into the deep semantic features of the text, achieving feature fusion between the target microblog and related microblogs;

[0082] Module 5: Predict the sentiment category of the target microblog through a fully connected classification layer, and train the model using the cross-entropy function as the target loss function.

[0083] Optionally, module one specifically includes:

[0084] For an input text x i First, the BERT word segmenter is used to segment, pad, and truncate the input IDs, resulting in a fixed-length input ID sequence and its corresponding attention mask. Then, this sequence is fed into a pre-trained BERT model, and the hidden states of the last encoder layer are extracted as the embedding representation of each word in the text. The output features of the i-th Weibo text can be represented as:

[0085] s i =BERT(x i )

[0086] in, l is the length of the text sequence; d0 is the dimension of the hidden layer of the BERT pre-trained model.

[0087] To efficiently extract local contextual features from the token sequences generated by BERT, a convolutional neural network (CNN) layer is introduced after the BERT layer. The BERT output features are transformed in dimension and then input into multiple sets of one-dimensional convolutional layers. Feature extraction is performed in parallel using t different sizes of convolutional kernels to capture local information at different scales. When the kernel window size is set to k, the output of the j-th convolutional kernel is:

[0088]

[0089] Among them, W j and b j These are the weights and bias vectors corresponding to the j-th convolutional kernel, respectively. The output of the convolutional layer is represented as:

[0090] y = {y 1 ,y 2 ,…,y t}

[0091] Among them, y i ∈R f×l Where f is the number of convolutional kernels of each size. The outputs of convolutional kernels of different sizes are concatenated along the channel dimension to obtain an enhanced combined feature representation:

[0092] y c =Concat(y 1 ,y 2 ,…,y t )∈R (f×t)×l

[0093] Subsequently, a bidirectional gated recurrent unit (Bi-GRU) is introduced to perform sequence modeling on the output of the CNN layer. The output h of the Bi-GRU layer... g The calculation is expressed as follows:

[0094] h g =[h1,h2,…,h l ]∈R l×(2·h)

[0095] h i =BiGRU(c i )

[0096]

[0097] Among them, h i Let h be the output vector of the bidirectional GRU at the i-th time step; h is the hidden unit dimension of the unidirectional GRU.

[0098] To enable the model to focus on the most critical parts, a multi-head self-attention mechanism is introduced to differentially weight different parts of the sequence. The output of the multi-head attention mechanism is represented as follows:

[0099] Z = Concat(Z1, Z2, ..., Z) c W l

[0100]

[0101] Among them, Z i It is the output of the i-th multi-head attention mechanism; c is the number of heads in the multi-head attention mechanism; W l This is the weight matrix of the linear layer; These are the weights corresponding to the query vector Q, key vector K, and value vector V, respectively; d k Let k be the dimension of the key vector k.

[0102] To obtain a single vector that represents the sentiment of the entire text, the output of the multi-head attention layer is averaged along the sequence dimension to obtain sentence-level feature representations:

[0103] p = Mean(Z)

[0104] Finally, the output of the multi-head attention layer after average pooling is extracted as the deep feature representation of the Weibo text:

[0105] P = {p1, p2, ..., p} m}

[0106] Where, p i ∈R 2h , where m is the number of texts in the Weibo post.

[0107] Optionally, Module Two specifically includes:

[0108] Let U∈R m×n Let U represent the microblog-user matrix, where m is the number of microblog posts and n is the number of users. For matrix U, u ij =1 represents user i posting a Weibo post j. Let F∈R n×n Let f represent the user-user matrix. For matrix F, f ij =1 indicates that there is a follow relationship between user i and user j. To find indirect relationships between users who do not have a direct follow relationship, the Adamic Adar algorithm is used to mine indirect relationships in the user follow network. The indirect relationship matrix is ​​represented as follows:

[0109]

[0110] Where N(u) represents the set of nodes adjacent to node u.

[0111] The relationships in the indirect relationship matrix are selected by finding user pairs with higher intimacy among users with indirect relationships. The selected indirect relationship matrix is ​​represented as follows:

[0112] O f =S(O)

[0113] S(·) is the relational selection function, and the formula is as follows:

[0114]

[0115] Where δ is the threshold for measuring the intimacy between relational nodes.

[0116] A microblog relationship matrix is ​​constructed using direct and indirect social relationships, as shown below:

[0117] A = UFU T +UO f U T

[0118] Optionally, Module 3 specifically includes:

[0119] To improve the probability of sentiment consistency among Weibo posts in the Weibo relationship graph, content similarity is introduced to further filter relationship pairs in the graph, as shown below:

[0120]

[0121] The function for calculating content similarity considers TF-IDF similarity and cosine similarity between Weibo posts, and the formula is as follows:

[0122]

[0123] Among them, cos1(s i ,s j ) for Weibo i and s j Cosine similarity of text features between them; cos2(s i ,s j To convert each word in the Weibo text to TF-IDF (w i,j After combining the text vectors, the cosine similarity is calculated; θ is the threshold for measuring the content similarity between texts.

[0124] Optionally, Module 4 specifically includes:

[0125] To more accurately capture the emotional propagation mechanism of Weibo in social networks, a graph attention network is used to learn the emotional propagation state of each Weibo node in the relationship graph, quantify the degree to which the target Weibo is influenced by its social neighbors, and achieve feature fusion between the target Weibo and the relationship Weibo.

[0126] The microblog relation matrix A is used as the adjacency matrix of the graph, and the text features p of each microblog are used as the adjacency matrix. i These are represented as node features. The node features are updated using a graph attention layer to obtain a new node vector. The update definition for the i-th Weibo node feature is as follows:

[0127]

[0128] Where K represents the number of heads in the attention mechanism; N i Let W be the set of neighboring nodes of the i-th microblog node in the relation matrix; k Let be the trainable linear transformation matrix corresponding to the kth attention head; These are the normalized attention coefficients calculated for the k-th attention head. The calculation is as follows:

[0129]

[0130]

[0131] In the formula, W and W are the trainable parameters and the shared parameter matrix, respectively.

[0132] Optionally, Module 5 specifically includes:

[0133] The updated microblog node vector is input into a fully connected classification layer to predict the sentiment category of the target microblog. The probability distribution of the sentiment prediction for the i-th microblog is represented as:

[0134]

[0135] Among them, W c and b c These are the weight matrix and bias vector of the classification layer, respectively.

[0136] The model is trained using the cross-entropy function as the target loss function, as shown below:

[0137]

[0138] Where D is the training set; y i This represents the probability distribution of the true labels.

[0139] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A Weibo sentiment analysis method that integrates direct and indirect social relationships, characterized in that, This method uses explicit user follows as direct relationships and employs a link prediction algorithm to mine indirect relationships within users' social networks. It then constructs a microblog relationship graph using both direct and indirect social relationships. Secondly, it optimizes the microblog relationship graph by introducing content similarity, filtering out noise and improving the probability of sentiment consistency between microblog connections. Finally, it integrates social information from the microblog relationship graph into deep text features using a graph attention network to optimize the target microblog feature representation. The specific steps of this method are as follows: Step 1: Use a multi-layer hybrid network to extract and focus hierarchical features from the Weibo text to obtain the deep semantic features of the text; Step 2: Based on user follow relationships, use link prediction algorithms to mine indirect social relationships between users, and construct a microblog relationship graph using direct and indirect social relationships; Step 3: Optimize the Weibo relationship graph using content similarity to filter out irrelevant connections and noise information in the graph; Step 4: Use graph attention network to integrate social information from the Weibo relationship graph into the deep semantic features of the text, realize feature fusion between the target Weibo and the related Weibo, and obtain the updated feature representation of the target Weibo. Step 5: Predict the sentiment category of the target microblog through a fully connected classification layer, and train the model using the cross-entropy function as the target loss function.

2. The Weibo sentiment analysis method integrating direct and indirect social relationships according to claim 1, characterized in that: The specific process described in step one includes: For an input text x i First, the BERT word segmenter is used to segment, pad, and truncate the input IDs, resulting in a fixed-length input ID sequence and its corresponding attention mask. Then, this sequence is fed into a pre-trained BERT model, and the hidden states of the last encoder layer are extracted as the embedding representation of each word in the text. The output features of the i-th Weibo text can be represented as: s i =BERT(x i ) in, l is the length of the text sequence; d0 is the dimension of the hidden layer of the BERT pre-trained model. To efficiently extract local contextual features from the token sequences generated by BERT, a convolutional neural network (CNN) layer is introduced after the BERT layer. The BERT output features are transformed in dimension and then input into multiple sets of one-dimensional convolutional layers. Feature extraction is performed in parallel using t different sizes of convolutional kernels to capture local information at different scales. When the kernel window size is k, the output of the j-th convolutional kernel is: Among them, W j and b j These are the weights and bias vectors corresponding to the j-th convolutional kernel, respectively. The output of the convolutional layer is represented as: y={y 1 ,and 2 ,…,and t } Among them, y i ∈R f×l Where f is the number of convolutional kernels of each size. The outputs of convolutional kernels of different sizes are concatenated along the channel dimension to obtain an enhanced combined feature representation: and c =Concat(y 1 ,and 2 ,…,and t )∈R (f×t)×l Subsequently, a bidirectional gated recurrent unit (Bi-GRU) is introduced to model the sequence expansion of the CNN layer's output. The output h of the Bi-GRU layer... g The calculation is expressed as follows: h g =[h1,h2,…,h l ]∈R l×(2·h) h i =BiGRU(c i ) Among them, h i Let h be the output vector of the bidirectional GRU at the i-th time step; h is the hidden unit dimension of the unidirectional GRU. To enable the model to focus on the most critical parts, a multi-head self-attention mechanism is introduced to differentially weight different parts of the sequence. The output of the multi-head attention mechanism is represented as follows: Z=Concat(Z1,Z2,…,Z c )IN l Among them, Z i It is the output of the i-th multi-head attention mechanism; c is the number of heads in the multi-head attention mechanism; W l This is the weight matrix of the linear layer; These are the weights corresponding to the query vector Q, key vector K, and value vector V, respectively; d k Let k be the dimension of the key vector k. To obtain a single vector that represents the sentiment of the entire text, the output of the multi-head attention layer is averaged along the sequence dimension to obtain sentence-level feature representations: p = Mean(Z) Finally, the output of the multi-head attention layer after average pooling is extracted as the deep feature representation of the Weibo text: P={p1,p2,…,p m } Where, p i ∈R 2h , where m is the number of texts in the Weibo post.

3. The Weibo sentiment analysis method integrating direct and indirect social relationships according to claim 1, characterized in that: The specific process described in step two includes: Let U∈R m×n Let U represent the microblog-user matrix, where m is the number of microblog posts and n is the number of users. For matrix U, u ij =1 represents user i posting a Weibo post j. Let F∈R n×n Let f represent the user-user matrix. For matrix F, f ij =1 indicates that there is a follow relationship between user i and user j. To find indirect relationships between users who do not have a direct follow relationship, the AdamicAdar algorithm is used to mine indirect relationships in the user follow network. The indirect relationship matrix is ​​represented as follows: Where N(u) represents the set of nodes adjacent to node u. The relationships in the indirect relationship matrix are selected by finding user pairs with higher intimacy among users with indirect relationships. The selected indirect relationship matrix is ​​represented as follows: THE f = S(O) S(·) is the relational selection function, and the formula is as follows: Where δ is the threshold for measuring the intimacy between relational nodes. A microblog relationship matrix is ​​constructed using direct and indirect social relationships, as shown below: A=WOOD T +UO f U T 。 4. The Weibo sentiment analysis method integrating direct and indirect social relationships according to claim 1, characterized in that: The specific process described in step three includes: To improve the probability of sentiment consistency among Weibo posts in the Weibo relationship graph, content similarity is introduced to further filter relationship pairs in the graph, as shown below: The function for calculating content similarity considers TF-IDF similarity and cosine similarity between Weibo posts, and the formula is as follows: Among them, cos1(s i ,s j ) for Weibo i and s j Cosine similarity of text features between them; cos2(s i ,s j To convert each word in the Weibo text to TF-IDF (w i,j After combining the text vectors, the cosine similarity is calculated; θ is the threshold for measuring the content similarity between texts.

5. The Weibo sentiment analysis method integrating direct and indirect social relationships according to claim 1, characterized in that: The specific process described in step four includes: To more accurately capture the emotional propagation mechanism of Weibo in social networks, a graph attention network is used to learn the emotional propagation state of each Weibo node in the relationship graph, quantify the degree to which the target Weibo is influenced by its social neighbors, and achieve feature fusion between the target Weibo and the relationship Weibo. The microblog relation matrix A is used as the adjacency matrix of the graph, and the text features p of each microblog are used as the adjacency matrix. i These are represented as node features. The node features are updated using a graph attention layer to obtain a new node vector. The update definition for the i-th Weibo node feature is as follows: Where K represents the number of heads in the attention mechanism; N i Let W be the set of neighboring nodes of the i-th microblog node in the relation matrix; k Let be the trainable linear transformation matrix corresponding to the kth attention head; These are the normalized attention coefficients calculated for the k-th attention head. The calculation is as follows: In the formula, W and W are the trainable parameters and the shared parameter matrix, respectively.

6. The Weibo sentiment analysis method integrating direct and indirect social relationships according to claim 1, characterized in that: The specific process described in step five includes: The updated microblog node vector is input into a fully connected classification layer to predict the sentiment category of the target microblog. The probability distribution of the sentiment prediction for the i-th microblog is represented as: Among them, W c and b c These are the weight matrix and bias vector of the classification layer, respectively. The model is trained using the cross-entropy function as the target loss function, as shown below: Where D is the training set; y i This represents the probability distribution of the true labels.