CN114443844A - Social network comment text sentiment analysis method and system fusing user sentiment tendency - Google Patents

Social network comment text sentiment analysis method and system fusing user sentiment tendency Download PDF

Info

Publication number
CN114443844A
CN114443844A CN202210054262.0A CN202210054262A CN114443844A CN 114443844 A CN114443844 A CN 114443844A CN 202210054262 A CN202210054262 A CN 202210054262A CN 114443844 A CN114443844 A CN 114443844A
Authority
CN
China
Prior art keywords
user
comment text
emotion
comment
users
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210054262.0A
Other languages
Chinese (zh)
Inventor
陈洁
宋楠
赵姝
张燕平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anhui University
Original Assignee
Anhui University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anhui University filed Critical Anhui University
Priority to CN202210054262.0A priority Critical patent/CN114443844A/en
Publication of CN114443844A publication Critical patent/CN114443844A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • G06F16/355Class or cluster creation or modification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/216Parsing using statistical methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/01Social networking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Business, Economics & Management (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Economics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Computational Linguistics (AREA)
  • Databases & Information Systems (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a social network comment text sentiment analysis method and system fusing user sentiment tendency, wherein the sentiment tendency score of a user is calculated through sentiment polarity distribution and social relation of historical comments of the user; the emotional tendency score of the user is used as attribute information of the user, and the social relationship between the user and the user is used for constructing a user social relationship network for the side information; extracting emotional tendency feature representation of the user; extracting feature representation of the comment text; and integrating the comment text characteristics and the user emotional tendency characteristics corresponding to the comments through a joint strategy to obtain comment joint characteristic representation, and constructing a logistic regression model to perform prediction analysis on the emotional polarity of the social network comment text. The method combines the psychological intervention factors of the user, technically fuses the emotional tendency characteristics of the user and the text characteristics to obtain the characteristic-enhanced combined characteristics for the text emotion analysis of the social network, and has higher accuracy compared with the traditional emotion analysis method only based on the text characteristics.

Description

Social network comment text sentiment analysis method and system fusing user sentiment tendency
Technical Field
The invention relates to the technical field of teenager mental health tracking, in particular to a social network comment text emotion analysis method and system fusing user emotion tendencies.
Background
With the rapid development of socioeconomic, the social competition pressure is getting higher and higher, and the psychological pressure of teenagers is gradually increased. As adolescents are generally in adolescence, their psychological state is relatively fragile, and they are also subject to psychological stress from academic, social, family, emotional, self-cognitive, employment, and the like. When the pressure exceeds the bearing capacity and cannot be effectively solved in time, teenagers may release the pressure by a method of injuring themselves or others, so that the teenagers can walk on the road of crime. Offline psychological counseling agencies typically require families to first perceive whether a teenager's mental state is healthy, and then persuade the teenager to receive psychological counseling. However, some teenagers cannot completely open their minds to the family, the family has a great hysteresis to the psychological state perception of the teenagers, and the teenagers have a certain degree of conflict psychology to psychological dispersion.
In today's networked world, teenagers prefer to share their feelings and opinions on social networks over communicating with their family. On many social networking platforms, such as Amazon and Yelp, the data volume of social networking comment text is increasing as users, particularly adolescent users, and generated comment content continue to grow. Through the emotion analysis of the social network comment text, the emotion change of the user in the social network, particularly the emotion change of teenagers, can be known, and the research work on the emotion change is helpful for relevant organizations to master the mental health of the current teenagers and provide corresponding intervention measures. Therefore, the emotional analysis of the user comment texts in the social network is significant to the teenager mental health development cause. In the social network, text contents of comments are generated by users, the users can express their emotions by publishing online comment texts, the users in the social network can generate psychological intervention on other users, each user has a unique emotional tendency, and the emotional tendency of the users can influence the emotional tendency of other users to change, so that the emotion of the comment texts published by the users is influenced.
Currently, there is a related art that perceives user emotion through a web comment text, and for example, an emotion analysis method based on social network data disclosed by application No. 201610475678.4 includes: extracting published data of a user on a social network platform; performing word segmentation and labeling on the release data by using a labeler; performing text preprocessing and dependency analysis on the published data subjected to word segmentation and labeling; dividing the published data subjected to text preprocessing and dependency analysis into a training set and a prediction set; respectively extracting emotion classification features of the release data of the training set or the prediction set; training the emotion classification features extracted from the training set by adopting a linear support vector machine model to obtain an emotion analysis classifier; and analyzing the emotion classification features in the prediction set by adopting an emotion analysis classifier, and predicting the emotional tendency of the target data issued by the user on the social network platform. The method can effectively improve the accuracy of emotion tendency prediction aiming at the characteristics of social network data. But the method only aims at analyzing the complexity of the text language features, does not consider the psychological intervention influence among users, and ignores the relation between the text content and the emotional tendency of the users.
For example, in the "social network user emotion prediction based on probability factor graph model" at page 35 of the university of Chongqing post and telecommunications university Master academic thesis, "social network-based user emotion analysis method research (Chenqiang D-10617-. The method aims to research the prediction accuracy of the user emotion under the condition of different specific gravities and the rule of influence of three factors on the user emotion. However, the method cannot directly obtain the emotional state of the user, and relevant organizations cannot perform targeted intervention on the user according to the result of the method.
Disclosure of Invention
The invention aims to solve the technical problem that a method for comprehensively judging the emotion of a user is lacked in the prior art.
The invention solves the technical problems through the following technical means:
the social network comment text emotion analysis method fusing the emotion tendencies of the users comprises the following steps:
step 1, firstly, according to the principle that the age range of teenagers is 14-25 years defined by the United nations' population foundation, dividing a social network user data set into 14-25 years as teenager users according to age information of personal data of the users, dividing comment text data sets corresponding to the teenagers into training samples and testing samples, then counting the star-level classification of comments of the users as emotion classification information, counting the social relationship information among the users, and calculating the emotion tendency score of the users; the specific process is as follows: counting the comments of the users in the social network, dividing the comments into negative comments and positive comments according to the star level, assuming that each user has p positive comments and n negative comments, counting the social relations of the users in the data set, counting the number of the social relations as f, and calculating the emotional tendency score according to the formula:
Figure BDA0003475548140000021
where N is the number of users,
Figure BDA0003475548140000022
is the number of social relationships of the ith user,
Figure BDA0003475548140000023
is the number of positive comments by the ith user,
Figure BDA0003475548140000024
is the number of negative comments, s, of the ith useriAn emotional tendency score representing the ith user;
step 2, constructing a graph network structure of a user-user social network by taking the emotional tendency score of the user as attribute information of the user and social network relationship information between the user and the user as side information;
step 3, extracting the user emotional tendency characteristics in the graph network structure of the user by utilizing a graph attention network model GAT;
step 4, coding the comment text by using a Transformers model to obtain comment text characteristics;
and 5, obtaining the joint characteristics of each comment by the aid of the user emotional tendency characteristics and the comment text characteristics through a joint strategy, constructing a logistic regression model, performing parameter training of the model by the aid of the comment joint characteristics of the training samples, and performing emotional polarity prediction analysis on the test samples.
The emotion analysis of the comments, provided by the invention, not only considers the language characteristics of the comment text, but also combines the psychological intervention factors of the user, the emotion tendency characteristics of the user are integrated on the basis of the text characteristics, and the obtained feature-enhanced combined features are used for the emotion analysis of the social network text, so that the accuracy is higher compared with the traditional emotion analysis only analyzing the text characteristics. According to emotion analysis results, a regular teenager psychological counseling institution or a teenager psychological consulting room in a hospital can find teenager users with psychological problems, and positive and healthy comments can be given to the teenager users through a social network tool, and even the teenager users are directly connected to the social network tool to give positive and healthy psychological counseling, so that the teenager users are guided to develop to healthy psychology. If the problem is serious, the teenager with psychological problems can be directly found out for psychotherapy, the teenager is guided to look up and correct the psychological problem of the teenager, and the development of the psychological health of the teenager is promoted.
Further, the specific process of step 2 is as follows: using calculated emotional tendency scores s of all usersiSet of composition s ═ s1,s2,…,sNAnd the set s is used as the attribute information of the user. Counting social relations between users i and j, and forming a combination [ i, j ] with social relations]Constructing an E multiplied by 2 matrix A among the end users, wherein E is the total number of edges, the matrix A represents a social relationship matrix of the users and the users,
Figure BDA0003475548140000031
further, the specific process of step 3 is as follows: defining the initial node vector of each user as h and the dimensionality as
Figure BDA0003475548140000032
h=[f,p,n]All users form a set h ═ h1,h2,…,hN},
Figure BDA0003475548140000033
Forming a matrix h according to the relation of the matrix Ai,hj]The user j is a neighbor of the user i, and the importance, namely the attention value, of the user j to the user i is calculated by using an attention mechanism, which specifically comprises the following steps:
Figure BDA0003475548140000034
wherein alpha isijIs the value of attention between user i and user j,
Figure BDA0003475548140000035
is the weight parameter of the feedforward neural network, F is the vector dimension of the user output,
Figure BDA0003475548140000036
firstly converting a weight parameter of h, | | represents splicing operation, and an activation function adopts LeaKyReLU;
the model adopts a multi-head attention mechanism, K attention heads are provided, each attention head updates the vector of the node i, all vectors of the node i are finally spliced to obtain an average value, and finally the emotional tendency feature h 'of the user is obtained'iThe calculation formula is as follows:
Figure BDA0003475548140000041
h 'obtained by adopting tanh activation function'iThat is, the emotional tendency characteristics of the ith user with the dimension of
Figure BDA0003475548140000042
Further, the method comprisesThe specific process of the step 4 is as follows: for a comment text, add [ CLS ] before the comment text]Mark, punctuate sentence place add [ SEP]Marking, performing one-hot coding on the comment text according to a GoogleNLP corpus of a network authoritative corpus to obtain one-hot coding of the comment text, wherein x is defined,
Figure BDA0003475548140000043
l is the sequence length, x is used as input to calculate an embedded vector of the comment text according to the Self-Attention principle of transformations, a multi-head Attention mechanism is adopted for calculation, and the single-head Attention value calculation process is as follows:
Figure BDA0003475548140000044
wherein Qi Q,Wi K,Wi VIs a weight matrix with dimensions of
Figure BDA0003475548140000046
dkThe dimension of K is the dimension of adjusting the inner product not to be too large, i represents the mark number of the attention head, and q attention heads are shared in totaliThe attention value obtained through SoftMax activation is finally obtained;
and (3) obtaining a final comment text characteristic x' through the splicing calculation of a plurality of attention values, wherein the calculation formula is as follows:
MultiHead=concat(head1,head2,…,headq)WO
by splicing a plurality of head values, the weight matrix is point-multiplied
Figure BDA0003475548140000047
H is the vector dimension of the feature of the comment text, Multihead is the word embedding matrix of the comment text, and the dimension is
Figure BDA0003475548140000048
Taking its first dimension, i.e. [ CLS ]]The embedded vector of (a) is a comment text feature representation, defined as x'.
Further, the specific process of step 5 is as follows: constructing a logistic regression model for emotion prediction, firstly connecting the emotion tendency characteristics of a user and the comment text characteristics through a joint strategy to obtain the joint characteristics of a target comment, wherein the calculation formula is as follows:
Figure BDA0003475548140000049
wherein x'i,h′iFor the ith comment text feature and the comment author's user emotional tendency feature, W3,W4As a weight matrix, dimensions are respectively
Figure BDA00034755481400000410
Medicine for curing cancer
Figure BDA00034755481400000411
b2Is an offset, and has a dimension of
Figure BDA00034755481400000412
Finally obtain ciFor the ith comment joint feature, M comments exist in total, namely the vector matrix of the comment joint feature is defined as c, and the dimensionality is
Figure BDA00034755481400000413
2 represents the result as 2 categories; and performing SoftMax activation on the c to obtain the predicted emotion polarity, wherein the calculation formula is as follows:
y′=softmax(c)
calculating the loss value of the emotion predicted value y' and the real emotion label y through a Cross Encopy loss function, wherein the calculation formula is as follows:
Figure BDA0003475548140000051
updating model parameters according to Loss value Loss back propagation to obtain an optimized model with the minimum Loss value and stability, performing predictive analysis on a test set of the optimized model, wherein an evaluation index adopts MacroF1, and the formula is as follows:
Figure BDA0003475548140000052
Figure BDA0003475548140000053
Figure BDA0003475548140000054
wherein negprecision and negrell are precision rate and recall rate for correctly judging that the polarity is a negative emotion, posreceision and posrecell are precision rate and recall rate for correctly judging that the polarity is a positive emotion, and finally MacroF1 is calculated to serve as an evaluation index of emotion analysis.
Corresponding to the method, the invention also provides a social network comment text sentiment analysis system fusing the user sentiment tendency, which comprises the following steps:
the emotional tendency calculation module is used for issuing emotional polarity distribution of comments on a social network according to the social relationship of the user, namely the number of friends of the user, and calculating the emotional tendency value of the user; the specific process is as follows: counting the comments of the users in the social network, dividing the comments into negative comments and positive comments according to the star level, assuming that each user has p positive comments and n negative comments, counting the social relations of the users in the data set, counting the number of the social relations as f, and calculating the emotional tendency score according to the formula:
Figure BDA0003475548140000055
where N is the number of users,
Figure BDA0003475548140000056
is the number of social relationships of the ith user,
Figure BDA0003475548140000057
is the number of positive comments by the ith user,
Figure BDA0003475548140000058
is the number of negative comments, s, of the ith useriAn emotional tendency score representing the ith user;
the graph network structure construction module of the user social network constructs a graph network structure of a user-user social network by taking the emotional tendency score of the user as attribute information of the user and social network relationship information between the user and the user as side information;
the user emotional tendency feature extraction module is used for extracting user emotional tendency features in the user social network structure by utilizing a graph attention network model GAT;
the comment text feature representation module is used for coding the comment text by using a Transformers model to obtain comment text features;
the comment text feature model training module is used for constructing a comment text feature model, training the comment text feature model based on a comment text and a corpus, acquiring all comment text features in a data set, and summarizing to obtain a vector matrix of all comment text features in the data;
and the combined strategy comment sentiment analysis module is used for constructing a combined strategy comment sentiment analysis model, obtaining the comment combined characteristics by combining the user sentiment tendency characteristics and the comment text characteristics through a combined strategy, performing iterative training on the combined strategy comment sentiment analysis model, and predicting and analyzing the sentiment polarity of the comment text of the test data by using the trained combined strategy comment sentiment analysis model.
Further, the specific process of the user emotional tendency model training module is as follows: using calculated emotional tendency scores s of all usersiSet of composition s ═ s1,s2,…,sNAnd the set s is used as the attribute information of the user. Counting social relations between users i and j, and forming a combination [ i, j ] with social relations]An E x 2 matrix A is constructed between the end users, E is the total number of edges, and the matrix A representsA social relationship matrix of the user with the user,
Figure BDA0003475548140000061
further, the comment text feature model training module specifically processes as follows: defining the initial node vector of each user as h and the dimensionality as
Figure BDA0003475548140000062
h=[f,p,n]All users form a set h ═ h1,h2,…,hN},
Figure BDA0003475548140000063
Forming a matrix h according to the relation of the matrix Ai,hj]The user j is a neighbor of the user i, and the importance, namely the attention value, of the user j to the user i is calculated by using an attention mechanism, which specifically comprises the following steps:
Figure BDA0003475548140000064
wherein alpha isijIs the value of attention between user i and user j,
Figure BDA0003475548140000065
is the weight parameter of the feedforward neural network, F is the vector dimension of the user output,
Figure BDA0003475548140000066
firstly converting a weight parameter of h, | | represents splicing operation, and an activation function adopts LeaKyReLU;
the model adopts a multi-head attention mechanism, K attention heads are provided, each attention head updates the vector of the node i, all vectors of the node i are finally spliced to obtain an average value, and finally the emotional tendency feature h 'of the user is obtained'iThe calculation formula is as follows:
Figure BDA0003475548140000067
h 'obtained by adopting tanh activation function'iThat is, the emotional tendency characteristics of the ith user with the dimension of
Figure BDA0003475548140000068
Further, the comment text feature model training module specifically processes as follows: for a comment text, add [ CLS ] before the comment text]Mark, punctuate sentence place add [ SEP]Marking, performing one-hot coding on the comment text according to a GoogleNLP corpus of a network authoritative corpus to obtain one-hot coding of the comment text, wherein x is defined,
Figure BDA0003475548140000071
l is the sequence length, x is used as input to calculate an embedded vector of the comment text according to the Self-Attention principle of transformations, a multi-head Attention mechanism is adopted for calculation, and the single-head Attention value calculation process is as follows:
Figure BDA0003475548140000072
wherein Wi Q,Wi K,Wi VIs a weight matrix with dimensions of
Figure BDA0003475548140000073
dkThe dimension of K is the dimension of adjusting the inner product not to be too large, i represents the mark number of the attention head, and q attention heads are shared in totaliThe attention value obtained through SoftMax activation is finally obtained;
and (3) obtaining a final comment text characteristic x' through the splicing calculation of a plurality of attention values, wherein the calculation formula is as follows:
MultiHead=concat(head1,head2,…,headq)WO
by splicing a plurality of head values, the weight matrix is point-multiplied
Figure BDA0003475548140000074
H is the vector dimension of the feature of the comment text, Multihead is the word embedding matrix of the comment text, and the dimension is
Figure BDA0003475548140000075
Taking its first dimension, i.e. [ CLS ]]The embedded vector of (a) is a comment text feature representation, defined as x'.
Further, the specific process of the combined strategy comment sentiment analysis module is as follows: constructing a logistic regression model for emotion prediction, firstly connecting the emotion tendency characteristics of a user and the comment text characteristics through a joint strategy to obtain the joint characteristics of a target comment, wherein the calculation formula is as follows:
Figure BDA0003475548140000076
wherein x'i,h′iFor the ith comment text feature and the comment author's user emotional tendency feature, W3,W4As a weight matrix, dimensions are respectively
Figure BDA0003475548140000077
And
Figure BDA0003475548140000078
b2is an offset, and has a dimension of
Figure BDA0003475548140000079
Finally obtain ciFor the ith comment joint feature, M comments exist in total, namely the vector matrix of the comment joint feature is defined as c, and the dimensionality is
Figure BDA00034755481400000710
2 represents the result as 2 categories; and performing SoftMax activation on the c to obtain the predicted emotion polarity, wherein the calculation formula is as follows:
y′=softmax(c)
calculating the loss value of the emotion predicted value y' and the real emotion label y through a Cross Encopy loss function, wherein the calculation formula is as follows:
Figure BDA00034755481400000711
updating model parameters according to Loss value Loss back propagation to obtain an optimized model with the minimum Loss value and stability, performing predictive analysis on a test set of the optimized model, wherein an evaluation index adopts MacroF1, and the formula is as follows:
Figure BDA00034755481400000712
Figure BDA0003475548140000081
Figure BDA0003475548140000082
wherein negprecision and negrell are precision rate and recall rate for correctly judging that the polarity is a negative emotion, posreceision and posrecell are precision rate and recall rate for correctly judging that the polarity is a positive emotion, and finally MacroF1 is calculated to serve as an evaluation index of emotion analysis.
The invention has the advantages that:
the social network comment text emotion analysis method and system integrating the user emotion tendencies, provided by the invention, have the advantages that: the emotion analysis of the comments, provided by the invention, not only considers the language characteristics of the comment text, but also combines the psychological intervention factors of the user, the emotion tendency characteristics of the user are integrated on the basis of the text characteristics, and the obtained feature-enhanced combined features are used for the emotion analysis of the social network text, so that the accuracy is higher compared with the traditional emotion analysis only analyzing the text characteristics.
Drawings
FIG. 1 is a flowchart of a social network comment text sentiment analysis method fusing user sentiment tendencies in the embodiment of the present invention;
FIG. 2 is a flowchart illustrating user emotional tendency feature learning according to an embodiment of the present invention;
FIG. 3 is a flow chart of sentiment analysis of the joint policy comments in the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, the social network comment text sentiment analysis method fusing user sentiment tendencies provided by this embodiment specifically includes the following steps:
step 1, counting comment data sets of social network users, firstly, according to the principle that the age range of teenagers is 14-25 years defined by the United nations' population foundation, dividing the social network user data sets into 14-25 years as the teenager users according to age information of personal data of the users, then dividing comment text data sets corresponding to the teenagers into training samples and testing samples, wherein the comment data sets comprise comment star levels (1-5 stars) and comment content texts.
The method specifically comprises the following steps: for the star level and the content of the user comment data set, the comments are classified into two categories according to the star level, wherein 1 star and 2 stars are negative emotions, 4 stars and 5 stars are positive emotions, 3 stars are neutral emotions, the comments of the neutral emotions are ignored, each user has p positive comments and n negative comments, then the social relations of the users in the data set are counted, the users have social relations with the users, the number of the users is counted as f, and the emotional tendency calculation formula is as follows:
Figure BDA0003475548140000091
where N is the number of users,
Figure BDA0003475548140000092
is the number of social relationships of the ith user,
Figure BDA0003475548140000093
is the number of positive comments by the ith user,
Figure BDA0003475548140000094
is the number of negative comments, s, of the ith useriRepresenting the emotional propensity score of the ith user.
The emotional tendency score of the user is between-1 and +1, and the user is represented by the interval from-1 to +1 from the extreme negative emotional tendency to the extreme positive emotional tendency.
And 2, constructing a user social network structure, taking attribute information [ the number of friends, positive comments and negative comments ] of the user as attributes of the network structure, and taking the social relationship between the user and the user as an edge.
The method specifically comprises the following steps: using calculated emotional tendency scores s of all usersiSet of composition s ═ s1,s2,…,sNAnd the set s is used as an emotional tendency score set of the user. Counting social relations between the user i and the user i, wherein a composition combination [ i, j ] of the social relations]Constructing an E multiplied by 2 matrix A among the end users, wherein E is the total number of edges, the matrix A represents a social relationship matrix of the users and the users,
Figure BDA0003475548140000095
step 3, carrying out unsupervised learning on the social network structure of the user, and calculating and learning the emotional tendency characteristics of the user according to the attributes of the user and the weight between the user and the neighbor, wherein the specific implementation process comprises the following steps:
referring to fig. 2, the present step specifically includes: defining the initial node vector of each user as h and the dimensionality as
Figure BDA0003475548140000096
h=[f,p,n]All users form a set h ═ h1,h2,…,hN},
Figure BDA0003475548140000097
Forming a matrix h according to the relation of the matrix Ai,hj]The user j is a neighbor of the user i, and the importance, namely the attention value, of the user j to the user i is calculated by using an attention mechanism, which specifically comprises the following steps:
Figure BDA0003475548140000098
wherein alpha isijIs the value of attention between user i and user j,
Figure BDA0003475548140000099
is the weight parameter of the feedforward neural network, F is the vector dimension of the user output,
Figure BDA00034755481400000910
the weight parameter of h is firstly converted, | | represents splicing operation, and LeaKyReLU is adopted as an activation function.
The model adopts a multi-head attention mechanism, K attention heads are provided, each attention head updates the vector of the node i, all vectors of the node i are finally spliced to obtain an average value, and finally the emotional tendency feature h 'of the user is obtained'iThe calculation formula is as follows:
Figure BDA0003475548140000101
h 'obtained by adopting tanh activation function'iThat is, the emotional tendency characteristics of the ith user with the dimension of
Figure BDA0003475548140000102
And 4, carrying out unsupervised learning on the comment text content of the user, and learning the feature representation of each comment text.
The method specifically comprises the following steps: for a comment text, add [ CLS ] before the comment text]Mark, punctuate sentence place add [ SEP]Marking, performing one-hot coding on the comment text according to a GoogleNLP corpus of a network authoritative corpus to obtain one-hot coding of the comment text, wherein x is defined,
Figure BDA0003475548140000103
l is the sequence length, x is used as input to calculate an embedded vector of a comment text according to a Self-Attention mechanism of transformations, a multi-head Attention mechanism is adopted for calculation, and the single-head Attention value calculation process is as follows:
Figure BDA0003475548140000104
wherein Wi Q,Wi K,Wi VIs a weight matrix with dimensions of
Figure BDA0003475548140000105
dkThe dimension of K is the dimension of adjusting the inner product not to be too large, i represents the mark number of the attention head, and q attention heads are shared in totaliThe attention value obtained for the final SoftMax activation.
And (3) obtaining a final comment text characteristic x' through the splicing calculation of a plurality of attention values, wherein the calculation formula is as follows:
MultiHead=concat(head1,head2,…,headq)WO
by splicing a plurality of head values, the weight matrix is point-multiplied
Figure BDA0003475548140000106
H is the vector dimension of the feature of the comment text, Multihead is the word embedding matrix of the comment text, and the dimension is
Figure BDA0003475548140000107
Taking its first dimension, i.e. [ CLS ]]The embedded vector of (a) is a comment text feature, defined as x'.
And 5, fusing the feature vectors of the learned user emotional tendency feature and the comment text feature together to obtain a new combined feature, namely an enhanced comment combined feature, so that the comment combined feature also contains the user emotional tendency feature, and then sending the comment combined feature as an input into an emotional analysis model for training, wherein the comment combined feature is responsible for training data of a training set and a real emotional polarity label, and performing emotional analysis on the data of a test set by using a training optimized model, wherein the specific process is as follows:
referring to fig. 3, the present step specifically includes: constructing a logistic regression model for emotion prediction, and firstly connecting the emotional tendency characteristics of the user and the comment text characteristics through a joint strategy to obtain comment joint characteristics, wherein the calculation formula is as follows:
Figure BDA0003475548140000108
wherein x'i,h′iFor the ith comment text feature and the comment author's user emotional tendency feature, W3,W4As a weight matrix, dimensions are respectively
Figure BDA0003475548140000109
And
Figure BDA00034755481400001010
b2is an offset of dimension
Figure BDA00034755481400001011
Finally obtain ciFor the ith comment joint feature, M comments exist in total, namely the vector matrix of the comment joint feature is defined as c, and the dimensionality is
Figure BDA0003475548140000111
2 represents a result of 2 classifications. And performing SoftMax activation on the c to obtain the predicted emotion polarity, wherein the calculation formula is as follows:
y′=softmax(c)
calculating the loss value of the emotion predicted value y' and the real emotion label y through a Cross Encopy loss function, wherein the calculation formula is as follows:
Figure BDA0003475548140000112
updating model parameters according to Loss value Loss back propagation to obtain an optimized model with the minimum Loss value and stability, performing predictive analysis on a test set of the optimized model, wherein an evaluation index adopts MacroF1, and the formula is as follows:
Figure BDA0003475548140000113
Figure BDA0003475548140000114
Figure BDA0003475548140000115
wherein negprecision and negecall are precision and recall rates for correctly judging the polarity as a negative emotion, posrecection and posrecell are precision and recall rates for correctly judging the polarity as a positive emotion, and finally MacroF1 is calculated to serve as an evaluation index of emotion analysis.
According to the method, the comment text content is considered, the user psychological intervention factors are combined, the user emotional tendency characteristics are trained and learned according to the emotional tendency and the social relation of the user, the emotional tendency characteristics of the user are obtained, and compared with the traditional emotional analysis only analyzing the text, the social network comment text emotional analysis integrating the user emotional tendency characteristics and the comment text characteristics has higher accuracy. According to emotion analysis results, a regular teenager psychological counseling institution or a teenager psychological consulting room in a hospital can find teenager users with psychological problems, and positive and healthy comments can be given to the teenager users through a social network tool, and even the teenager users are directly connected to the social network tool to give positive and healthy psychological counseling, so that the teenager users are guided to develop to healthy psychology. If the problem is serious, the teenager with psychological problems can be directly found out for psychotherapy, the teenager is guided to look up and correct the psychological problem of the teenager, and the development of the psychological health of the teenager is promoted.
The invention provides a social network comment text sentiment analysis system fusing user sentiment tendencies, which comprises the following steps:
the emotional tendency score calculation module is used for issuing emotional polarity distribution of comments on a social network according to the social relations of the users, namely the number of friends of the users, and calculating the emotional tendency value of the users; the method specifically comprises the following steps: the method mainly comprises the steps of carrying out judgment and analysis on the emotional polarity of comments according to the social network data information.
The method specifically comprises the following steps: for the star level and the content of the user comment data set, the comments are classified into two categories according to the star level, wherein 1 star and 2 stars are negative emotions, 4 stars and 5 stars are positive emotions, 3 stars are neutral emotions, the comments of the neutral emotions are ignored, each user has p positive comments and n negative comments, then the social relations of the users in the data set are counted, the users have social relations with the users, the number of the users is counted as f, and the emotional tendency calculation formula is as follows:
Figure BDA0003475548140000121
where N is the number of users,
Figure BDA0003475548140000122
is the number of social relationships of the ith user,
Figure BDA0003475548140000123
is the number of positive comments by the ith user,
Figure BDA0003475548140000124
is the number of negative comments, s, of the ith useriRepresenting the emotional propensity score of the ith user.
The emotional tendency score of the user is between-1 and +1, and the user is represented by the interval from-1 to +1 from the extreme negative emotional tendency to the extreme positive emotional tendency.
The graph network structure construction module of the user social network constructs a graph network structure of a user-user social network by taking the emotional tendency score of the user as attribute information of the user and social network relationship information between the user and the user as side information; the method specifically comprises the following steps: using calculated emotional tendency scores s of all usersiSet of composition s ═ s1,s2,…,sNAnd the set s is used as the attribute information of the user. Counting social relations between users i and j, and forming a combination [ i, j ] with social relations]Constructing an E multiplied by 2 matrix A among the end users, wherein E is the total number of edges, the matrix A represents a social relationship matrix of the users and the users,
Figure BDA0003475548140000125
the user emotional tendency model training module is used for constructing a user emotional tendency model, training the user emotional tendency model based on the social relationship and the emotional tendency scores of the users, acquiring all user emotional tendency characteristics in the data set, and summarizing to obtain a vector matrix of all the user emotional tendency characteristics in the data; the method specifically comprises the following steps: defining the initial node vector of each user as h and the dimensionality as
Figure BDA0003475548140000126
h=[f,p,n]All users form a set h ═ h1,h2,…,hN},
Figure BDA0003475548140000127
Forming a matrix h according to the relation of the matrix Ai,hj]User j is a neighbor of user i, and the importance of user j to user i is calculated by using an attention mechanismSex, i.e. attention value, is specified as follows:
Figure BDA0003475548140000128
wherein alpha isijIs the value of attention between user i and user j,
Figure BDA0003475548140000129
is the weight parameter of the feedforward neural network, F is the vector dimension of the user output,
Figure BDA00034755481400001210
the weight parameter of h is firstly converted, | | represents splicing operation, and LeaKyReLU is adopted as an activation function.
The model adopts a multi-head attention mechanism, K attention heads are provided, each attention head updates the vector of the node i, all vectors of the node i are finally spliced to obtain an average value, and finally the emotional tendency feature h 'of the user is obtained'iThe calculation formula is as follows:
Figure BDA0003475548140000131
h 'obtained by adopting tanh activation function'iI.e. the i-th user emotional tendency characteristics with the dimensionality of
Figure BDA0003475548140000132
The comment text feature representation module is used for coding the comment text by using a Transformers model to obtain comment text features;
the comment text feature model training module is used for constructing a comment text feature model, training the comment text feature model based on a comment text and a corpus, acquiring all comment text features in a data set, and summarizing to obtain a vector matrix of all comment text features in the data; the method specifically comprises the following steps: for a comment text, add [ CLS ] before the comment text]Mark, punctuate sentence place add [ SEP]Sign, rootOne-hot coding is carried out on the comment text according to a GoogleNLP corpus of a network authoritative corpus to obtain one-hot numbering of the comment text, x is defined,
Figure BDA0003475548140000133
l is the sequence length, x is used as input to calculate an embedded vector of the comment text according to the Self-Attention principle of transformations, a multi-head Attention mechanism is adopted for calculation, and the single-head Attention value calculation process is as follows:
Figure BDA0003475548140000134
wherein Wi Q,Wi K,Wi VIs a weight matrix with dimensions of
Figure BDA0003475548140000135
dkThe dimension of K is the dimension of adjusting the inner product not to be too large, i represents the mark number of the attention head, and q attention heads are shared in totaliThe attention value obtained for the final SoftMax activation.
And (3) obtaining a final comment text characteristic x' through the splicing calculation of a plurality of attention values, wherein the calculation formula is as follows:
MultiHead=concat(head1,head2,…,headq)WO
by splicing a plurality of head values, the weight matrix is point-multiplied
Figure BDA0003475548140000136
H is the vector dimension of the feature of the comment text, Multihead is the word embedding matrix of the feature of the comment text, and the dimension is
Figure BDA0003475548140000137
Taking its first dimension, i.e. [ CLS ]]The embedded vector of (a) is a feature representation of the comment text, defined as x'.
And the combined strategy comment sentiment analysis module is used for constructing a combined strategy comment sentiment analysis model, obtaining comment combined characteristics by fusing the user sentiment tendency characteristics and the comment text characteristics through a combined strategy, performing iterative training on the combined strategy comment sentiment analysis model, and predicting and analyzing the sentiment polarity of the comment text of the test data by using the trained combined strategy comment sentiment analysis model. The method specifically comprises the following steps: constructing a logistic regression model for emotion prediction, and firstly connecting the emotional tendency characteristics of the user and the comment text characteristics through a joint strategy to obtain comment joint characteristics, wherein the calculation formula is as follows:
Figure BDA0003475548140000141
wherein x'i,h′iFor the ith comment text feature and the comment author's user emotional tendency feature, W3,W4As a weight matrix, dimensions are respectively
Figure BDA0003475548140000142
And
Figure BDA0003475548140000143
b2is an offset, and has a dimension of
Figure BDA0003475548140000144
Finally obtain ciFor the joint feature of the ith comment, there are M comments in total, that is, the vector matrix defining the joint feature of the comment is c, and the dimension is
Figure BDA0003475548140000145
2 represents a result of 2 classifications. And performing SofiMax activation on c to obtain predicted emotion polarity, wherein the calculation formula is as follows:
y′=softmax(c)
calculating the loss value of the emotion predicted value y' and the real emotion label y through a Cross Encopy loss function, wherein the calculation formula is as follows:
Figure BDA0003475548140000146
updating model parameters according to Loss value Loss back propagation to obtain an optimized model with the minimum Loss value and stability, performing predictive analysis on a test set of the optimized model, wherein an evaluation index adopts MacroF1, and the formula is as follows:
Figure BDA0003475548140000147
Figure BDA0003475548140000148
Figure BDA0003475548140000149
wherein negprecision and negrell are precision rate and recall rate for correctly judging that the polarity is a negative emotion, posreceision and posrecell are precision rate and recall rate for correctly judging that the polarity is a positive emotion, and finally MacroF1 is calculated to serve as an evaluation index of emotion analysis.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. The social network comment text emotion analysis method fusing the emotion tendencies of the users is characterized by comprising the following steps of:
step 1, firstly, according to the principle that the age range of teenagers is 14-25 years defined by the United nations' population foundation, dividing a social network user data set into 14-25 years as teenager users according to age information of personal data of the users, dividing comment text data sets corresponding to the teenagers into training samples and testing samples, then counting the star-level classification of comments of the users as emotion classification information, counting the social relationship information among the users, and calculating the emotion tendency score of the users; the specific process is as follows: counting the comments of the users in the social network, dividing the comments into negative comments and positive comments according to the star level, assuming that each user has p positive comments and n negative comments, counting the social relations of the users in the data set, counting the number of the social relations as f, and calculating the emotional tendency score according to the formula:
Figure FDA0003475548130000011
where N is the number of users,
Figure FDA0003475548130000012
is the number of social relationships of the ith user,
Figure FDA0003475548130000013
is the number of positive comments by the ith user,
Figure FDA0003475548130000014
is the number of negative comments, s, of the ith useriAn emotional tendency score representing the ith user;
step 2, constructing a graph network structure of a user-user social network by taking the emotional tendency score of the user as attribute information of the user and social network relationship information between the user and the user as side information;
step 3, extracting the user emotional tendency characteristics in the graph network structure of the user by utilizing a graph attention network model GAT;
step 4, coding the comment text by using a Transformers model to obtain comment text characteristics;
and 5, obtaining the joint characteristics of each comment by the aid of the user emotional tendency characteristics and the comment text characteristics through a joint strategy, constructing a logistic regression model, performing parameter training of the model by the aid of the comment joint characteristics of the training samples, and performing emotional polarity prediction analysis on the test samples.
2. The method for analyzing the emotion of the comment text of the social network fused with the emotion tendency of the user according to claim 1, wherein the specific process of the step 2 is as follows: using calculated emotional tendency scores s of all usersiSet of composition s ═ s1,s2,…,sNAnd the set s is used as the attribute information of the user. Counting social relations between a user i and a user j, wherein a composition combination [ i, j ] of the social relations exists]Constructing an E multiplied by 2 matrix A among the end users, wherein E is the total number of edges, the matrix A represents a social relationship matrix of the users and the users,
Figure FDA0003475548130000015
3. the method for analyzing the emotion of the social network comment text fused with the emotion tendency of the user according to claim 2, wherein the specific process of the step 3 is as follows: defining the initial node vector of each user as h and the dimensionality as
Figure FDA0003475548130000016
h=[f,p,n]All users form a set h ═ h1,h2,…,hN},
Figure FDA0003475548130000017
Forming a matrix h according to the relation of the matrix Ai,hj]The user j is a neighbor of the user i, and the importance, namely the attention value, of the user j to the user i is calculated by using an attention mechanism, which specifically comprises the following steps:
Figure FDA0003475548130000021
wherein alpha isijIs the value of attention between user i and user j,
Figure FDA0003475548130000022
is the weight parameter of the feedforward neural network, F is the vector dimension of the user output,
Figure FDA0003475548130000023
firstly converting a weight parameter of h, | | represents splicing operation, and an activation function adopts LeaKyReLU;
the model adopts a multi-head attention mechanism, K attention heads are provided, each attention head updates the vector of the node i, all vectors of the node i are finally spliced to obtain an average value, and finally the emotional tendency feature h 'of the user is obtained'iThe calculation formula is as follows:
Figure FDA0003475548130000024
h 'obtained by adopting tanh activation function'iThat is, the emotional tendency characteristics of the ith user with the dimension of
Figure FDA0003475548130000025
4. The method for analyzing the emotion of the comment text of the social network fused with the emotion tendency of the user according to claim 3, wherein the specific process of the step 4 is as follows: for a comment text, add [ CLS ] before the comment text]Mark, punctuate sentence place add [ SEP]Marking, performing one-hot coding on the comment text according to a GoogleNLP corpus of a network authoritative corpus to obtain one-hot coding of the comment text, wherein x is defined,
Figure FDA0003475548130000026
l is the sequence length, x is used as input to calculate an embedded vector of the comment text according to the Self-Attention principle of transformations, a multi-head Attention mechanism is adopted for calculation, and the single-head Attention value calculation process is as follows:
Figure FDA0003475548130000027
wherein Wi Q,Wi K,Wi VIs a weight matrix with dimensions of
Figure FDA0003475548130000028
dkThe dimension of K is the dimension of adjusting the inner product not to be too large, i represents the mark number of the attention head, and q attention heads are shared in totaliThe attention value obtained through SoftMax activation is finally obtained;
and (3) obtaining a final comment text characteristic x' through the splicing calculation of a plurality of attention values, wherein the calculation formula is as follows:
MultiHead=concat(head1,head2,…,headq)WO
by splicing a plurality of head values, the weight matrix is point-multiplied
Figure FDA0003475548130000029
H is the vector dimension of the feature of the comment text, Multihead is the word embedding matrix of the comment text, and the dimension is
Figure FDA00034755481300000210
Taking its first dimension, i.e. [ CLS ]]The embedded vector of (a) is a comment text feature representation, defined as x'.
5. The method for analyzing the emotion of the social network comment text fused with the emotion tendency of the user according to claim 4, wherein the specific process of the step 5 is as follows: constructing a logistic regression model for emotion prediction, firstly connecting the emotion tendency characteristics of a user and the comment text characteristics through a joint strategy to obtain the joint characteristics of a target comment, wherein the calculation formula is as follows:
Figure FDA0003475548130000031
wherein x'i,h′iFor the ith comment text feature and the comment author's user emotional tendency feature, W3,W4As a weight matrix, dimensions are respectively
Figure FDA0003475548130000032
And
Figure FDA0003475548130000033
b2is an offset, and has a dimension of
Figure FDA0003475548130000034
Finally obtain ciFor the ith comment joint feature, M comments exist in total, namely the vector matrix of the comment joint feature is defined as c, and the dimensionality is
Figure FDA0003475548130000035
2 represents the result as 2 categories; and performing SoftMax activation on the c to obtain the predicted emotion polarity, wherein the calculation formula is as follows:
y′=softmax(c)
calculating the loss value of the emotion predicted value y' and the real emotion label y through a Cross Encopy loss function, wherein the calculation formula is as follows:
Figure FDA0003475548130000036
updating model parameters according to Loss value Loss back propagation to obtain an optimized model with the minimum Loss value and stability, performing predictive analysis on a test set of the optimized model, wherein an evaluation index adopts MacroF1, and the formula is as follows:
Figure FDA0003475548130000037
Figure FDA0003475548130000038
Figure FDA0003475548130000039
wherein negprecision and negrell are precision rate and recall rate for correctly judging that the polarity is a negative emotion, posreceision and posrecell are precision rate and recall rate for correctly judging that the polarity is a positive emotion, and finally MacroF1 is calculated to serve as an evaluation index of emotion analysis.
6. Social network comment text emotion analysis system fusing user emotion tendencies is characterized by comprising the following steps:
the emotional tendency calculation module is used for issuing emotional polarity distribution of comments on a social network according to the social relationship of the user, namely the number of friends of the user, and calculating the emotional tendency value of the user; the specific process is as follows: counting the comments of the users in the social network, dividing the comments into negative comments and positive comments according to the star level, assuming that each user has p positive comments and n negative comments, counting the social relations of the users in the data set, counting the number of the social relations as f, and calculating the emotional tendency score according to the formula:
Figure FDA0003475548130000041
where N is the number of users,
Figure FDA0003475548130000042
is the number of social relationships of the ith user,
Figure FDA0003475548130000043
is the number of positive comments by the ith user,
Figure FDA0003475548130000044
is the ith userNumber of negative comments of siAn emotional tendency score representing the ith user;
the graph network structure construction module of the user social network constructs a graph network structure of a user-user social network by taking the emotional tendency score of the user as attribute information of the user and social network relationship information between the user and the user as side information;
the user emotional tendency feature extraction module is used for extracting user emotional tendency features in the user social network structure by utilizing a graph attention network model GAT;
the comment text feature representation module is used for coding the comment text by using a Transformers model to obtain comment text features;
the comment text feature model training module is used for constructing a comment text feature model, training the comment text feature model based on a comment text and a corpus, acquiring all comment text features in a data set, and summarizing to obtain a vector matrix of all comment text features in the data;
and the combined strategy comment sentiment analysis module is used for constructing a combined strategy comment sentiment analysis model, obtaining the joint characteristics of comments by combining the user sentiment tendency characteristics and the comment text characteristics through a combined strategy, performing iterative training on the combined strategy comment sentiment analysis model, and predicting and analyzing the sentiment polarity of the comment text of the test data by using the trained combined strategy comment sentiment analysis model.
7. The system for analyzing the text sentiment of the social network comments with the fused emotional tendency of the user according to claim 6, wherein the specific process of the user emotional tendency model training module is as follows: using calculated emotional tendency scores s of all usersiSet of composition s ═ s1,s2,…,sNAnd the set s is used as attribute information of the user. Counting social relations between users i and j, and forming a combination [ i, j ] with social relations]Constructing an E multiplied by 2 matrix A among the end users, wherein E is the total number of edges, the matrix A represents a social relationship matrix of the users and the users,
Figure FDA0003475548130000045
8. the social network comment text sentiment analysis system fusing the user sentiment tendencies according to claim 7, wherein the comment text characteristic model training module comprises the following specific processes: defining the initial node vector of each user as h and the dimensionality as
Figure FDA0003475548130000046
h=[f,p,n]All users form a set h ═ h1,h2,…,hN},
Figure FDA0003475548130000047
Forming a matrix h according to the relation of the matrix Ai,hj]The user j is a neighbor of the user i, and the importance, namely the attention value, of the user j to the user i is calculated by using an attention mechanism, which specifically comprises the following steps:
Figure FDA0003475548130000051
wherein alpha isijIs the value of attention between user i and user j,
Figure FDA0003475548130000052
is the weight parameter of the feedforward neural network, F is the vector dimension of the user output,
Figure FDA0003475548130000053
firstly converting a weight parameter of h, | | represents splicing operation, and an activation function adopts LeaKyReLU;
the model adopts a multi-head attention mechanism, K attention heads are provided, each attention head updates the vector of the node i, all vectors of the node i are finally spliced to obtain an average value, and finally the emotional tendency feature h 'of the user is obtained'iThe calculation formula is as follows:
Figure FDA0003475548130000054
h 'obtained by adopting tanh activation function'iThat is, the emotional tendency characteristics of the ith user with the dimension of
Figure FDA0003475548130000055
9. The social network comment text emotion analysis method fusing user emotion tendencies according to claim 8, wherein the comment text feature model training module comprises the specific processes of: for a comment text, add [ CLS ] before the comment text]Mark, punctuate sentence place add [ SEP]Marking, performing one-hot coding on the comment text according to a GoogleNLP corpus of a network authoritative corpus to obtain one-hot coding of the comment text, wherein x is defined,
Figure FDA0003475548130000056
l is the sequence length, x is used as input to calculate an embedded vector of the comment text according to the Self-Attention principle of transformations, a multi-head Attention mechanism is adopted for calculation, and the single-head Attention value calculation process is as follows:
Figure FDA0003475548130000057
wherein Wi Q,Wi K,Wi VIs a weight matrix with dimensions of
Figure FDA0003475548130000058
dkThe dimension of K is the dimension of adjusting the inner product not to be too large, i represents the mark number of the attention head, and q attention heads are shared in totaliThe attention value obtained through SoftMax activation is finally obtained;
and (3) obtaining a final comment text characteristic x' through the splicing calculation of a plurality of attention values, wherein the calculation formula is as follows:
MultiHead=concat(head1,head2,…,headq)WO
by splicing a plurality of head values, the weight matrix is point-multiplied
Figure FDA0003475548130000059
H is the vector dimension of the feature of the comment text, Multihead is the word embedding matrix of the comment text, and the dimension is
Figure FDA00034755481300000510
Taking its first dimension, i.e. [ CLS ]]The embedded vector of (a) is a comment text feature representation, defined as x'.
10. The method for analyzing the emotion of the comment text of the social network fused with the emotion tendencies of the user according to claim 9, wherein the specific process of the combined strategy comment emotion analysis module is as follows: constructing a logistic regression model for emotion prediction, firstly connecting the emotion tendency characteristics of a user and the comment text characteristics through a joint strategy to obtain the joint characteristics of a target comment, wherein the calculation formula is as follows:
Figure FDA0003475548130000061
wherein x'i,h′iFor the ith comment text feature and the comment author's user emotional tendency feature, W3,W4As a weight matrix, dimensions are respectively
Figure FDA0003475548130000062
And
Figure FDA0003475548130000063
b2is an offset, and has a dimension of
Figure FDA0003475548130000064
Finally obtain ciFor the ith comment joint feature, M comments exist in total, namely the vector matrix of the comment joint feature is defined as c, and the dimensionality is
Figure FDA0003475548130000065
2 represents the result as 2 categories; and performing SoftMax activation on the c to obtain the predicted emotion polarity, wherein the calculation formula is as follows:
y′=softmax(c)
calculating the loss value of the emotion predicted value y' and the real emotion label y through a Cross Encopy loss function, wherein the calculation formula is as follows:
Figure FDA0003475548130000066
updating model parameters according to Loss value Loss back propagation to obtain an optimized model with the minimum Loss value and stability, performing predictive analysis on a test set of the optimized model, wherein an evaluation index adopts MacroF1, and the formula is as follows:
Figure FDA0003475548130000067
Figure FDA0003475548130000068
Figure FDA0003475548130000069
wherein negprecision and negrell are precision rate and recall rate for correctly judging that the polarity is a negative emotion, posreceision and posrecell are precision rate and recall rate for correctly judging that the polarity is a positive emotion, and finally MacroF1 is calculated to serve as an evaluation index of emotion analysis.
CN202210054262.0A 2022-01-18 2022-01-18 Social network comment text sentiment analysis method and system fusing user sentiment tendency Pending CN114443844A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210054262.0A CN114443844A (en) 2022-01-18 2022-01-18 Social network comment text sentiment analysis method and system fusing user sentiment tendency

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210054262.0A CN114443844A (en) 2022-01-18 2022-01-18 Social network comment text sentiment analysis method and system fusing user sentiment tendency

Publications (1)

Publication Number Publication Date
CN114443844A true CN114443844A (en) 2022-05-06

Family

ID=81367567

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210054262.0A Pending CN114443844A (en) 2022-01-18 2022-01-18 Social network comment text sentiment analysis method and system fusing user sentiment tendency

Country Status (1)

Country Link
CN (1) CN114443844A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116307298A (en) * 2023-05-23 2023-06-23 中国石油大学(华东) Combined carbon emission prediction model based on multi-source heterogeneous tensor data
CN116521872A (en) * 2023-04-27 2023-08-01 华中师范大学 Combined recognition method and system for cognition and emotion and electronic equipment
CN117132004A (en) * 2023-10-27 2023-11-28 四川省建筑设计研究院有限公司 Public place people stream density prediction method, system and equipment based on neural network
WO2024098516A1 (en) * 2022-11-07 2024-05-16 中电科大数据研究院有限公司 Social network key node mining method and device and storage medium
US12001489B1 (en) * 2023-01-25 2024-06-04 Fujitsu Limited Ethics-based multi-modal user post monitoring

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024098516A1 (en) * 2022-11-07 2024-05-16 中电科大数据研究院有限公司 Social network key node mining method and device and storage medium
US12001489B1 (en) * 2023-01-25 2024-06-04 Fujitsu Limited Ethics-based multi-modal user post monitoring
CN116521872A (en) * 2023-04-27 2023-08-01 华中师范大学 Combined recognition method and system for cognition and emotion and electronic equipment
CN116521872B (en) * 2023-04-27 2023-12-26 华中师范大学 Combined recognition method and system for cognition and emotion and electronic equipment
CN116307298A (en) * 2023-05-23 2023-06-23 中国石油大学(华东) Combined carbon emission prediction model based on multi-source heterogeneous tensor data
CN116307298B (en) * 2023-05-23 2023-08-18 中国石油大学(华东) Combined carbon emission prediction method based on multi-source heterogeneous tensor data
CN117132004A (en) * 2023-10-27 2023-11-28 四川省建筑设计研究院有限公司 Public place people stream density prediction method, system and equipment based on neural network
CN117132004B (en) * 2023-10-27 2024-02-09 四川省建筑设计研究院有限公司 Public place people stream density prediction method, system and equipment based on neural network

Similar Documents

Publication Publication Date Title
CN111914096B (en) Public opinion knowledge graph-based public transportation passenger satisfaction evaluation method and system
CN106919673B (en) Text mood analysis system based on deep learning
CN114443844A (en) Social network comment text sentiment analysis method and system fusing user sentiment tendency
Bharadwaj et al. Persona traits identification based on Myers-Briggs Type Indicator (MBTI)-a text classification approach
CN110210037A (en) Category detection method towards evidence-based medicine EBM field
CN107808008B (en) Theme-emotion combined modeling method considering user characteristic information
CN107247702A (en) A kind of text emotion analysis and processing method and system
CN112256866B (en) Text fine-grained emotion analysis algorithm based on deep learning
CN113094578B (en) Deep learning-based content recommendation method, device, equipment and storage medium
CN111666496B (en) Group recommendation method based on comment text
CN112800225B (en) Microblog comment emotion classification method and system
CN111275401A (en) Intelligent interviewing method and system based on position relation
CN111914556A (en) Emotion guiding method and system based on emotion semantic transfer map
CN110472245B (en) Multi-label emotion intensity prediction method based on hierarchical convolutional neural network
CN111339260A (en) BERT and QA thought-based fine-grained emotion analysis method
CN111651606B (en) Text processing method and device and electronic equipment
CN111611375B (en) Text emotion classification method based on deep learning and turning relation
CN110851593A (en) Complex value word vector construction method based on position and semantics
CN115017879A (en) Text comparison method, computer device and computer storage medium
Tripathy et al. Sentiment classification of movie reviews using GA and NeuroGA
CN112950414B (en) Legal text representation method based on decoupling legal elements
CN111581379B (en) Automatic composition scoring calculation method based on composition question-deducting degree
CN112200674B (en) Stock market emotion index intelligent calculation information system
CN116702753A (en) Text emotion analysis method based on graph attention network
CN115906824A (en) Text fine-grained emotion analysis method, system, medium and computing equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination