The invention discloses a method for generating an abstract based on an attention mechanism to generate a text abstract, which totally comprises two stages: the first stage is a sentence sorting process, the second stage is an abstract generation process, and the input of the abstract generation process is N sentences which are most relevant to an article theme and are obtained through the first stage. In the first stage, a supervised sorting method is provided for articles with titles, firstly, the similarity between each sentence and the title is calculated, then the articles are sorted according to the similarity, and finally N sentences with the highest similarity are selected. For the second stage, the invention proposes a new method for calculating the attention distribution betweenthe encoder and the decoder, i.e. the decoder should pay attention to different parts in the encoder at different times. Through the sorting method and the abstract generation method, the problem of article information attenuation caused by the fact that a part of text must be directly cut off to serve as input of the abstract generation model when the article is too long is relieved.