Abstract: In the field of text sentiment analysis, BERT model is widely used because of its powerful feature extraction ability. However, empirical research shows that without fine-tuning BERT, its accuracy may suffer significant loss, resulting in the actual effect of the model failing to meet expectations. In order to solve this problem, a BERT text emotion analysis model combining self-attention is proposed: BERT-BLSTM-Attention. The model makes comprehensive use of BERT's pre-training ability, BLSTM and self-attention mechanism to enhance the understanding and analysis of text emotion. First, the BERT model is used to represent the input text data as high-dimensional feature vectors. BERT, as a powerful pre-trained model, can capture rich semantic information and contextual features to provide basic input for subsequent models. At this stage, BERT's bidirectional coding capability allows the model to extract more detailed semantic information from the context, which is crucial for sentiment analysis. Then, after the BLSTM layer, the multi-head self-attention mechanism is introduced. With the addition of self-attention mechanism, the model can pay more attention to the important parts of the text when processing the input sequence, and strengthen the role of these key features by dynamically assigning weights. By computing multiple heads of attention in parallel, the multi-head self-attention mechanism allows the model to learn different representations to capture the details and importance of the text on multiple levels. This mechanism enhances the sensitivity of the model to emotional cues, especially in the face of long text, and is more effective in identifying key information that affects emotion. Finally, the model uses SoftMax function in the output layer for text sentiment classification. At this stage, based on the collected features, the model is able to generate a probability distribution for each emotion category, providing an output for emotion classification. In addition to effective classification, the model also shows excellent generalization ability. The experimental results show that the accuracy of the BLSTM model with self-attention mechanism is 1.8% higher than that without BLSTM, and 0.9% higher than that without BERT model, which fully demonstrates the effectiveness of the proposed model in language feature extraction. |