A computer text sentiment recognition method
By combining convolutional neural networks and recurrent neural networks, and integrating word-level and character-level embeddings, the attention mechanism is optimized, which solves the problem of lack of contextual semantic understanding in existing text sentiment analysis methods, and improves the accuracy and computational efficiency of sentiment recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUANGGANG POLYTECHNIC COLLEGE
- Filing Date
- 2025-07-15
- Publication Date
- 2026-04-21
AI Technical Summary
Existing text sentiment analysis methods, such as those based on sentiment dictionaries, lack contextual semantic understanding capabilities, resulting in low accuracy in sentiment judgment.
This paper adopts a method combining convolutional neural networks and recurrent neural networks to extract sentiment feature vectors through word-level and character-level embeddings, optimizes the attention mechanism, uses a machine learning system for refined classification, and establishes an adaptive adjustment mechanism for sentiment intensity by combining multi-scale convolutional kernels and hybrid pooling strategies.
It improves the accuracy of text sentiment recognition, enhances semantic expression, reduces spelling errors and noise interference, optimizes computational efficiency, and achieves accurate capture of weak and strong sentiments.
Smart Images

Figure CN120821846B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of text emotion recognition technology, specifically a computer text emotion recognition method. Background Technology
[0002] With the explosive growth of internet text data, text sentiment recognition technology has important application value in fields such as public opinion analysis, product evaluation, and social media monitoring. Existing text sentiment analysis methods, such as sentiment dictionary-based methods (e.g., AFINN dictionary), accumulate scores by pre-setting the polarity and intensity of sentiment words. Although simple to implement, they lack the ability to understand contextual semantics, resulting in low accuracy of sentiment judgment. Therefore, a computer text sentiment recognition method is proposed to solve the above problems. Summary of the Invention
[0003] (a) Technical problems to be solved
[0004] The purpose of this invention is to address the problem that existing text sentiment analysis methods, such as those based on sentiment dictionaries, accumulate scores by pre-setting the polarity and intensity of sentiment words. While simple to implement, these methods lack contextual semantic understanding capabilities, resulting in low accuracy in sentiment judgment. Therefore, this invention proposes a computer text sentiment recognition method.
[0005] (II) Technical Solution
[0006] The technical solution of the present invention to solve the above-mentioned technical problems is as follows:
[0007] A computer text sentiment recognition method includes the following steps:
[0008] S1: First, preprocess the computer text;
[0009] S2: Establish a sentiment scoring function by matching the sentiment dictionary in the text with the AFINN sentiment dictionary to make a preliminary judgment on sentiment tendency;
[0010] S3: Extracting sentiment feature vectors from computer text using a convolutional neural network;
[0011] S4: Further extract the sentiment feature vector through a recurrent neural network to form a sentiment feature vector containing multi-level semantic information;
[0012] S5: Optimize the attention mechanism and improve the extraction process of convolutional neural networks and recurrent neural networks;
[0013] S6: Input the sentiment feature vector into the machine learning system for training, and perform detailed classification of the sentiment data of computer text;
[0014] S7: Obtain the computer text to be analyzed, and use a machine learning system to automatically analyze and identify the computer text to obtain the corresponding sentiment of the computer text.
[0015] Based on the above technical solution, the present invention can be further improved as follows.
[0016] Preferably, the process of establishing the emotion scoring function in S2 is as follows:
[0017] ;
[0018] Where S represents the sentiment score. The original sentiment intensity of the AFINN sentiment dictionary. This represents the product of the influence of all intensity modifiers. To negate the sentiment coefficient, Emotional weighting for different business areas For emotional punctuation coefficients.
[0019] Preferably, step S3 includes the following steps:
[0020] First, a multi-granularity text representation is constructed through hybrid word-level and character-level embeddings. Word-level embeddings capture global semantics, while character-level embeddings mine word-form features. Then, parallel multi-scale 1D convolutional kernels are used to simultaneously extract local combined features, and the weight distribution of each convolutional kernel is dynamically adjusted. Next, the LeakyReLU activation function is used to enhance non-linear expressive power and avoid neuron inactivation. Then, the Swish activation function is used to enhance the expressive power of deep networks. Then, a hybrid pooling strategy is used to achieve hierarchical feature aggregation. At the same time, residual connections are combined to fuse the original input embeddings and pooling results to alleviate gradient vanishing. Finally, the features are reduced in dimensionality by fully connected layers and Dropout regularization is applied to output a sentiment feature vector that is both locally sensitive and robust.
[0021] Preferably, the step of employing parallel multi-scale 1D convolutional kernels is as follows:
[0022] ;
[0023] in, The kernel size is [size]. , For convolution kernel weights, For convolution bias, For the input feature matrix, To activate the rectification function.
[0024] Preferably, the dynamic adjustment of the weight allocation of each convolutional kernel is as follows:
[0025] First, calculate the global average pooling result for each channel:
[0026] ;
[0027] in, The result is the global average pooling of the c-th channel, where H and W are the height and width of the feature map, respectively. This is the feature map of the c-th channel;
[0028] Then, calculate the weight vector for each channel based on the global average pooling result for each channel:
[0029] ;
[0030] in, This is the weight matrix of the first fully connected layer. This is the weight matrix for the second fully connected layer. for Activate the rectification function, The Sogmoid activation function normalizes the weights to the range of 0-1. Let be the weight vector of the c-th channel. This represents the global average pooling result for the c-th channel;
[0031] Finally, the channel-weighted feature map is calculated based on the weight vector of each channel:
[0032] ;
[0033] in, Let be the weight vector of the c-th channel. This is the feature map of the c-th channel.
[0034] Preferably, the process of enhancing nonlinear expressive power using the LeakyReLU activation function is as follows:
[0035] ;
[0036] in, For input values, The output value of the LeakyReLU activation function;
[0037] The process of enhancing the expressive power of deep networks through the Swish activation function is as follows:
[0038] ;
[0039] in, For input values, The Sogmoid activation function is used. For learning parameters, This is the output value of the Swish activation function.
[0040] Preferably, the learning parameters The setup process is as follows:
[0041] Establish learning parameters AFINN sentiment intensity index Association mechanism:
[0042] ;
[0043] in, These are the initial learning parameters. As an indicator of emotional intensity, Indicates will Constraints are set between [0.5, 2].
[0044] Emotional intensity index The calculation process is as follows:
[0045] ;
[0046] Where N is the number of sentiment words in the text. For the k-th sentiment score, This represents the maximum absolute value of the emotional score.
[0047] Preferably, the hybrid pooling strategy includes the following steps:
[0048] Comparing texture complexity With the evaluation threshold Based on the size between them, determine whether to perform local max pooling or global average pooling;
[0049] when Local max pooling is performed at the same time:
[0050] ;
[0051] in, This is the output after local max pooling. For the pooled window height size, To determine the width of the pooled window, For pooling height step size, H represents the pooling width stride, and H and W represent the feature map height and width dimensions, respectively.
[0052] when Global average pooling is performed at that time.
[0053] ;
[0054] in, This is the output after global average pooling, where H and W are the height and width dimensions of the feature map, respectively. It is a location eigenvalues;
[0055] Then, the local feature vectors of all scales are concatenated and fused to obtain the local feature matrix, and the global feature vectors of all scales are concatenated and fused to obtain the global feature matrix.
[0056] Finally, the local feature matrix and the global feature matrix are concatenated to obtain the joint feature matrix, as shown in the following formula:
[0057] ;
[0058] in, The matrix represents the joint feature matrix, where m is the spatial dimension, n is the number of local feature channels, and k is the global feature dimension. Let be a local feature matrix with m spatial dimensions and n local feature channels. It is a global feature matrix with m spatial dimensions and k global feature dimensions.
[0059] Preferably, the texture complexity The calculation formula is as follows:
[0060] ;
[0061] Where H and W are the height and width of the feature map, respectively. It is a location eigenvalues, It is the mean of the feature map;
[0062] Evaluation threshold The calculation formula is as follows:
[0063] ;
[0064] Where M is the number of samples, and r is the sample index. Let be the texture complexity of the r-th sample.
[0065] Preferably, the process of reducing the dimensionality of the features through the fully connected layer and applying Dropout regularization to output the sentiment feature vector is as follows:
[0066] First, we perform dimensionality reduction on the features of the fully connected layer:
[0067]
[0068] in, It is the feature matrix after dimensionality reduction. It activates the rectifier function to ensure that the output eigenvalues are non-negative. These are features after pooling. It is the feature matrix before dimensionality reduction. It is the bias vector;
[0069] Then apply Dropout regularization to force the network to not depend on specific neurons.
[0070] ;
[0071] in, It is the output value of the i-th dimension after Dropout. It's the Dropout probability. Other cases, These are the elements of the feature vector;
[0072] Finally, the sentiment feature vector is output:
[0073] ;
[0074] in, It is the batch average. It is the batch variance. It is a very small constant. It is a scaling parameter. It is an offset parameter. It is an emotional feature vector.
[0075] (III) Beneficial Effects
[0076] Compared with the prior art, the technical solution of this application has the following beneficial technical effects:
[0077] 1. This invention achieves dual parsing of "semantic kernel + morphological details" through a word-level and character-level collaborative mechanism. The word-level vector captures the overall negative semantics, ensuring accurate quantification of emotional intensity. The fusion of word-level and character-level embeddings can also enhance semantic expression capabilities.
[0078] 2. This invention improves feature robustness through multi-scale convolution and hybrid pooling, which can enhance spelling interference and focus on key features.
[0079] 3. By comparing the size between texture complexity and the evaluation threshold, this invention can treat all feature points equally, thereby enhancing background perception, suppressing local outlier interference, diluting noise, avoiding redundant peak detection, and optimizing computational efficiency.
[0080] 4. This invention establishes a correlation mechanism between learning parameters and AFINN emotional intensity, that is, it establishes an adaptive adjustment mechanism for emotional intensity, which can achieve accurate capture of weak emotions and enhanced response to strong emotions, and can reduce noise interference such as spelling errors and ironic expressions. Attached Figure Description
[0081] Figure 1 This is a schematic diagram of the computer text emotion recognition method of the present invention;
[0082] Figure 2 This is a schematic diagram of step S5 of the present invention;
[0083] Figure 3 This is a schematic diagram illustrating the logic for determining whether to perform local max pooling or global average pooling in this invention. Detailed Implementation
[0084] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0085] A computer text sentiment recognition method includes the following steps:
[0086] S1: First, preprocess the computer text;
[0087] S2: Establish a sentiment scoring function by matching the sentiment dictionary in the text with the AFINN sentiment dictionary to make a preliminary judgment on sentiment tendency;
[0088] S3: Extracting sentiment feature vectors from computer text using a convolutional neural network;
[0089] S4: Further extract the sentiment feature vector through a recurrent neural network to form a sentiment feature vector containing multi-level semantic information;
[0090] S5: Optimize the attention mechanism and improve the extraction process of convolutional neural networks and recurrent neural networks;
[0091] S6: Input the sentiment feature vector into the machine learning system for training, and perform detailed classification of the sentiment data of computer text;
[0092] S7: Obtain the computer text to be analyzed, and use a machine learning system to automatically analyze and identify the computer text to obtain the corresponding sentiment of the computer text.
[0093] The process of establishing the sentiment scoring function in S2 is as follows:
[0094] ;
[0095] Where S represents the sentiment score. The original sentiment intensity of the AFINN sentiment dictionary. This represents the product of the influence of all intensity modifiers. To negate the sentiment coefficient, Emotional weighting for different business areas For emotional punctuation coefficients.
[0096] S3 includes the following steps:
[0097] In optimizing the extraction of local sentiment features from text using convolutional neural networks (CNNs), a multi-granularity text representation is first constructed through hybrid word-level and character-level embeddings. Word-level embeddings capture global semantics, while character-level embeddings mine word-form features (such as suffix patterns). Then, parallel multi-scale 1D convolutional kernels (such as sizes 2, 3, and 5) are used to simultaneously extract local n-gram combined features. A Squeeze-and-Excitation attention module is introduced to dynamically adjust the weight distribution of each convolutional kernel to focus on key semantic segments. Next, the LeakyReLU activation function is used to enhance non-linear expressive power and avoid neuron inactivation. Then, the Swish activation function is used to enhance the expressive power of deep networks. Then, a hybrid pooling strategy (local max pooling to retain salient features + global average pooling to capture distribution information) is used to achieve hierarchical feature aggregation. At the same time, residual connections are combined to fuse the original input embeddings and pooling results to alleviate gradient vanishing. Finally, the features are reduced in dimensionality by fully connected layers and Dropout regularization is applied to output sentiment feature vectors that are both locally sensitive and robust, laying a refined foundation for the subsequent global feature extraction of recurrent neural networks.
[0098] The process of constructing multi-granularity text representations is as follows:
[0099] The process of word-level semantic representation is as follows: Semantic vector mapping: For general domains, pre-trained word vectors (such as GloVe-300d) are used to map each word to a 300-dimensional real vector. For specialized domains (such as medical and financial), domain-fine-tuned BERT models are used to generate 768-dimensional context-related vectors. Special vocabulary processing: Out-of-vocabulary words are replaced by sub-word combination vectors. Polysemous words are distinguished based on context (such as "bank" is represented based on context). Sequence modeling: The original order of words in the sentence is preserved, and the original position information of each word is recorded.
[0100] The process of character-level morphological representation is as follows:
[0101] Character sequence decomposition: Each word is split into basic character sequences. Multi-scale feature extraction: Three convolutional kernels of different widths are used for parallel processing: the small kernel (width 3) captures adjacent character combinations ("bre").
[0102] The medium kernel (5 width) identifies word root fragments ("breat"), and the large kernel (7 width) captures complete word morphemes ("taking"). Each convolutional layer is configured with 128 feature detectors. Feature refinement and integration: the maximum value is extracted from each convolution output (the most significant feature is retained), and the features of the three scales are merged into a 384-dimensional character representation vector.
[0103] Multi-granularity information fusion: Dimension alignment processing: The word vectors are projected to a 256-dimensional space through a fully connected layer, and the character features are kept at 384 dimensions or compressed to 256 dimensions. Vertical feature combination: The word-level and character-level vectors are concatenated according to the last dimension to generate a 512-dimensional fused feature vector. Sine position encoding (reflecting the absolute position of the word in the sentence) is added, and a unique waveform feature is generated for each position.
[0104] The steps for employing parallel multi-scale 1D convolutional kernels are as follows:
[0105] ;
[0106] in, The kernel size is [size]. , For convolution kernel weights, For convolution bias, For the input feature matrix, To activate the rectification function.
[0107] The dynamic adjustment of the weight allocation of each convolutional kernel is as follows:
[0108] First, calculate the global average pooling result for each channel:
[0109] ;
[0110] in, The result is the global average pooling of the c-th channel, where H and W are the height and width of the feature map, respectively. This is the feature map of the c-th channel;
[0111] Then, calculate the weight vector for each channel based on the global average pooling result for each channel:
[0112] ;
[0113] in, This is the weight matrix of the first fully connected layer. This is the weight matrix for the second fully connected layer. for Activate the rectification function, The Sogmoid activation function normalizes the weights to the range of 0-1. Let be the weight vector of the c-th channel. This represents the global average pooling result for the c-th channel;
[0114] Finally, the channel-weighted feature map is calculated based on the weight vector of each channel:
[0115]
[0116] in, Let be the weight vector of the c-th channel. This is the feature map of the c-th channel.
[0117] The process of enhancing nonlinear expressive power using the LeakyReLU activation function is as follows:
[0118] ;
[0119] in, For input values, The output value of the LeakyReLU activation function;
[0120] The process of enhancing the expressive power of deep networks through the Swish activation function is as follows:
[0121] ;
[0122] in, For input values, The Sogmoid activation function is used. For learning parameters, This is the output value of the Swish activation function.
[0123] The learning parameters The setup process is as follows:
[0124] Establish learning parameters AFINN sentiment intensity index Association mechanism:
[0125] ;
[0126] in, These are the initial learning parameters. As an indicator of emotional intensity, Indicates will Constraints are set between [0.5, 2].
[0127] Emotional intensity index The calculation process is as follows:
[0128] ;
[0129] Where N is the number of sentiment words in the text. For the k-th sentiment score, This represents the maximum absolute value of the emotional score.
[0130] The hybrid pooling strategy includes the following steps:
[0131] Comparing texture complexity With the evaluation threshold Based on the size between them, determine whether to perform local max pooling or global average pooling;
[0132] when Local max pooling is performed at the same time:
[0133] ;
[0134] in, This is the output after local max pooling. For the pooled window height size, To determine the width of the pooled window, For pooling height step size, H represents the pooling width stride, and H and W represent the feature map height and width dimensions, respectively.
[0135] when Global average pooling is performed at that time.
[0136] ;
[0137] in, This is the output after global average pooling, where H and W are the height and width dimensions of the feature map, respectively. It is a location eigenvalues;
[0138] Then, the local feature vectors of all scales are concatenated and fused to obtain the local feature matrix, and the global feature vectors of all scales are concatenated and fused to obtain the global feature matrix.
[0139] Finally, the local feature matrix and the global feature matrix are concatenated to obtain the joint feature matrix, as shown in the following formula:
[0140] ;
[0141] in, The matrix represents the joint feature matrix, where m is the spatial dimension, n is the number of local feature channels, and k is the global feature dimension. Let be a local feature matrix with m spatial dimensions and n local feature channels. It is a global feature matrix with m spatial dimensions and k global feature dimensions.
[0142] The texture complexity The calculation formula is as follows:
[0143] ;
[0144] Where H and W are the height and width of the feature map, respectively. It is a location eigenvalues, It is the mean of the feature map;
[0145] Evaluation threshold The calculation formula is as follows:
[0146]
[0147] Where M is the number of samples, and r is the sample index. Let be the texture complexity of the r-th sample.
[0148] The residual connection process is as follows:
[0149] ;
[0150] ;
[0151] in, This is the output of the residual block. It is a residual input. It is a convolution transformation. It is the identity matrix. It is a 1×1 convolution operation. These are treaty connection parameters. express and The two dimensions match. express and The two dimensions do not match.
[0152] The process of reducing the dimensionality of features through the fully connected layer and applying Dropout regularization to output the sentiment feature vector is as follows:
[0153] First, we perform dimensionality reduction on the features of the fully connected layer:
[0154] ;
[0155] in, It is the feature matrix after dimensionality reduction. It activates the rectifier function to ensure that the output eigenvalues are non-negative. These are features after pooling. It is the feature matrix before dimensionality reduction. It is the bias vector;
[0156] Then apply Dropout regularization to force the network to not depend on specific neurons.
[0157] ;
[0158] in, It is the output value of the i-th dimension after Dropout. It's the Dropout probability. Other cases, These are the elements of the feature vector;
[0159] Finally, the sentiment feature vector is output:
[0160] ;
[0161] in, It is the batch average. It is the batch variance. It is a very small constant. It is a scaling parameter. It is an offset parameter. It is an emotional feature vector.
[0162] S4 includes the following steps:
[0163] This stage achieves feature fusion through multi-path parallel processing: First, the input word embedding vector is simultaneously fed into two processing branches—the first path captures local semantic features through a CNN feature extractor and then extracts the most salient features through a max pooling layer; the second path models long-distance dependencies through a bidirectional GRU sequence encoder and then obtains global temporal features by taking its last hidden state; then, the output features of the two branches (i.e., the max-pooled CNN features and the final hidden state of the GRU) are vertically fused in the feature concatenation layer to form a joint feature representation; finally, this joint feature enters the attention weighting module, which calculates the importance weights of each feature element and dynamically enhances key sentiment features, thereby forming a sentiment feature vector containing multi-level semantic information;
[0164] S5 includes the following steps:
[0165] This step achieves deep sentiment feature optimization through a three-level attention architecture: First, the interaction weight of each text unit is calculated in the self-attention layer (using a scaled dot product attention mechanism). Where Q is the query vector, representing the target unit for which attention needs to be calculated, derived from the input word vector matrix through a learnable weight matrix. Obtained by linear transformation: K is the key vector, representing all context units to be matched, obtained from the input word vector matrix through a learnable weight matrix. Obtained by linear transformation: V is a value vector representing the actual information content at each position, obtained from the input word vector matrix through a learnable weight matrix. Obtained by linear transformation: , It is the dimension of the key vector, i.e., the scaling factor, used to stabilize the gradient. Its technical function is: when... To prevent the dot product result from becoming too large when the size is large, avoid... The system dynamically captures cross-distance sentiment dependencies (such as semantic reversal in ironic sentences) by ensuring the input falls within the gradient saturation region. Secondly, it constructs a three-tiered attention system: word-level attention focuses on core sentiment words (such as "excellent"), phrase-level attention strengthens multi-word sentiment combinations (such as "not bad"), and sentence-level attention integrates contrastive relationships (such as the dominant sentiment after "but"). Finally, it introduces a gating attention mechanism, using the local feature output of the CNN (containing sentiment intensity information) as a modulator. A sigmoid gate controls the memory update of the GRU unit, allowing the model to prioritize sentiment-significant contexts in recurrent neural network processing (such as "extremely disappointed" receiving a higher gating weight than "somewhat inadequate"). This mechanism improves the accuracy of fine-grained sentiment recognition, particularly optimizing sentiment intensity judgment (such as distinguishing the gradient from "good" to "perfect") and the parsing of complex negation structures (such as the weak negative judgment of "not particularly annoying").
[0166] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0167] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A computer text sentiment recognition method, characterized in that, Includes the following steps: S1: First, preprocess the computer text; S2: Establish a sentiment scoring function by matching the sentiment dictionary in the text with the AFINN sentiment dictionary to make a preliminary judgment on sentiment tendency; S3: Extracting sentiment feature vectors from computer text using a convolutional neural network; S4: Further extract the sentiment feature vector through a recurrent neural network to form a sentiment feature vector containing multi-level semantic information; S5: Optimize the attention mechanism and improve the extraction process of convolutional neural networks and recurrent neural networks; S6: Input the sentiment feature vector into the machine learning system for training, and perform detailed classification of the sentiment data of computer text; S7: Obtain the computer text to be analyzed, and use the machine learning system to automatically analyze and identify the computer text to obtain the corresponding sentiment of the computer text; S3 includes the following steps: First, a multi-granularity text representation is constructed through hybrid word-level and character-level embeddings. Word-level embeddings capture global semantics, while character-level embeddings mine lexical features. Then, parallel multi-scale 1D convolutional kernels are used to simultaneously extract local combined features, and the weight distribution of each convolutional kernel is dynamically adjusted. Next, the LeakyReLU activation function is used to enhance non-linear expressive power and avoid neuron inactivation. Then, the Swish activation function is used to enhance the expressive power of deep networks. Then, a hybrid pooling strategy is used to achieve hierarchical feature aggregation. At the same time, residual connections are combined to fuse the original input embeddings and pooling results to alleviate gradient vanishing. Finally, the features are reduced in dimensionality by fully connected layers and Dropout regularization is applied to output a sentiment feature vector that is both locally sensitive and robust. The hybrid pooling strategy includes the following steps: Comparing the texture complexity with the judgment threshold value , judging to perform local maximum pooling or global average pooling; When Local max pooling is performed: ; wherein, is the output of the local max pooling, is the height size of the pooling window, is the width size of the pooling window, is the height stride of the pooling, is the width stride of the pooling, H, W are the height size and width size of the feature map, respectively; When global average pooling is performed: ; wherein, is the output after global average pooling, H, W are the height and width dimensions of the feature map, respectively, is the feature value at position . Then, the local feature vectors of all scales are concatenated and fused to obtain the local feature matrix, and the global feature vectors of all scales are concatenated and fused to obtain the global feature matrix. Finally, the local feature matrix and the global feature matrix are concatenated to obtain the joint feature matrix, as shown in the following formula: ; wherein, is a joint feature matrix, m is a spatial dimension, n is a number of local feature channels, k is a global feature dimension, is a local feature matrix of m-dimensional spatial dimension, n local feature channels, is a global feature matrix of m-dimensional spatial dimension, k-dimensional global feature dimension. The texture complexity The formula for calculating the texture complexity is as follows: ; where H, W are the height and width of the feature map, respectively, is the feature value at position , is the mean of the feature map. Judgment threshold The calculation formula is as follows: ; where M is the number of samples, r is the sample index, is the texture complexity of the rth sample.
2. The computer text sentiment recognition method of claim 1, wherein: The process of establishing the sentiment scoring function in S2 is as follows: ; where S is the sentiment score, is the original sentiment intensity from the AFINN sentiment dictionary, represents the impact of all intensity modifiers multiplied, is the negation sentiment coefficient, is the sentiment weight for different business domains, is the sentiment punctuation coefficient.
3. The computer text sentiment recognition method of claim 1, wherein: The steps for employing parallel multi-scale 1D convolutional kernels are as follows: ; wherein, is a convolution kernel size, , is a convolution kernel weight, is a convolution bias, is an input feature matrix, is an activation rectifier function.
4. The computer text sentiment recognition method of claim 1, wherein, The dynamic adjustment of the weight allocation of each convolutional kernel is as follows: First, calculate the global average pooling result for each channel: ; wherein, is the global average pooling result of the c-th channel, H and W are the height and width of the feature map, respectively, is the feature map of the c-th channel; Then, calculate the weight vector for each channel based on the global average pooling result for each channel: ; wherein, is a weight matrix for the first fully connected layer, is a weight matrix for the second fully connected layer, is is an activation rectifier function, is a Sogmoid activation function that normalizes the weights to 0-1, is a weight vector for the cth channel, is a global average pooling result for the cth channel; Finally, the channel-weighted feature map is calculated based on the weight vector of each channel: ; wherein, is a weight vector for the cth channel, is a feature map for the cth channel.
5. The computer text sentiment recognition method of claim 1, wherein, The process of enhancing nonlinear expressive power using the LeakyReLU activation function is as follows: ; wherein, is an input value, is an output value of a LeakyReLU activation function; The process of enhancing the expressive power of deep networks through the Swish activation function is as follows: ; wherein, is an input value, is a Sogmoid activation function, is a learning parameter, is an output value of a Swish activation function.
6. The computer text sentiment recognition method of claim 5, wherein: The learning parameters The setting process is as follows: Establishing learning parameters Correlation mechanism with AFINN sentiment intensity index Correlation mechanism with AFINN sentiment intensity index ; wherein, is an initial learning parameter, is an affect intensity indicator, denotes to constrain between [0.5, 2]; Emotion intensity indicator The calculation process is as follows: ; wherein N is the number of sentiment words contained in the text, is the kth sentiment score, is the maximum absolute value of the sentiment scores.
7. The computer text sentiment recognition method of claim 1, wherein: The process of reducing the dimensionality of features through the fully connected layer and applying Dropout regularization to output the sentiment feature vector is as follows: First, we perform dimensionality reduction on the features of the fully connected layer: ; wherein, is the reduced dimension feature matrix, is an activation rectifier function to ensure the output feature value is non-negative, is the pooled feature, is the feature matrix before dimension reduction, is the bias vector; Then apply Dropout regularization to force the network to not depend on specific neurons. ; wherein, is the output value of the i-th dimension after Dropout, is the Dropout probability, is otherwise, is the feature vector element; Finally, the sentiment feature vector is output: ; wherein, is a batch mean, is a batch variance, is a minimum constant, is a scaling parameter, is an offset parameter, is an emotion feature vector.
Citation Information
Patent Citations
Text sentiment analysis method based on multi-channel neural network
CN111881262A
Social short text sentiment classification method and device and storage medium
CN112214601A