The invention discloses a text emotion analysis method based on attention mechanism, which comprises the following steps: 1, preprocessing text data; 2, constructing a vocabulary and constructing a word vector by using a GloVe model; Thirdly, the sentence vector is encoded by intrinsic attention, and the target word vector is encoded by interactive attention. The two encoded vectors are fused by GRU, and the fused representation is obtained after average pooling. Fourthly, according to the fusion representation, the abstract feature of context vector is obtained by point-by-point feed-forwardnetwork (FFN), and then the probability distribution of affective classification labels is calculated by full connection and Softmax function, and the classification result is obtained. Fifthly, the preprocessed corpus is divided into training set and test set, the parameters of the model are trained many times, and the model with the highest classification accuracy is selected to classify the affective tendencies. The method of the invention only uses the attention mechanism to model the text, and strengthens the understanding of the target word, so that the user can understand the emotionaltendency held by the specific target word in the text.