In social network, users can manage their social network and social identity, publish information on various topics, and obtain information published by other users through friend relationship. The resulting large amount of text data attract more and more scholars to study it. Text sentiment analysis has become a hot spot in social network data analysis and has important application value in academic field, social field, and business field. Based on the idea of pre-training, this paper improves the random word masking algorithm of deep pretraining task in the BERT (Bidirectional Encoder Representation) model to improve the efficiency and stability of model pretraining. Second, a new pretraining task of original sentence judgment is designed to enable the model to measure the degree of sentence smoothness, so that the BERT model can better understand the semantics of context. By referring to the idea of attention mechanism, a deep learning framework with attention weight added into gated convolution is constructed and the special attention weight method is adopted to enhance semantic information. Second, gating convolution and attention mechanism are combined to model aspect-related semantic information and text complete semantic information. Finally, classify the emotion classifier layer of social network, use Softmax function to complete negative, positive, and neutral multiple classifications and calculate the result of emotion classification. By applying the optimized convolutional neural network cyclic optimization network to single task and multitask in practice, the feasibility of applying the optimized convolutional neural network and cyclic neural network to social network sentiment analysis is verified.