The present application relates to the technical field of artificial intelligence, and provides a text emotion recognition method and apparatus, an electronic device, and a computer non-volatile readable storage medium. The method comprises: obtaining a sample text set, the sample text set comprising multiple sample texts and emotion classification labels corresponding to the multiple sample texts; carrying out correction calculation on an initial cost according to the number distribution of the emotion classification labels in the sample text set to obtain a correction cost; training a lifting algorithm learning model by means of the sample text set and the correction cost to obtain a text emotion recognition model; and recognizing a text to be recognized by means of the text emotion recognition model to obtain the emotion recognition result of said text. By means of the present application, the recognition accuracy and balance of the text of different emotional categories can be improved, the recognition effect is improved, and the method has strong applicability. (FIG. 3)
展开▼