In order to solve the problems of ignoring key words, insufficient learning of context information and gradient dispersion in the current neural network model, this paper proposes a text emotion analysis model of neural network based on attention mechanism.In this paper, word2vec is combined with term frequency-inverse document frequency (TFIDF) algorithm, and attention mechanism is added into the gated loop unit (GRU) network model to highlight the role of keywords in the text through weighted probability. At the same time, Maxout neuron is introduced at the output end of the model, which can effectively alleviate the gradient dispersion problem.The model in this paper is tested on IMDB English data set. The experimental results show that the model in this paper has a good effect on IMDB data set and can achieve better accuracy and F value compared with other classification models.