In the present paper, a step-by-step algorithm is considered to analyze the sentiment of text data using machine learning. The article gives an idea of possible approaches to solving the problem. The following steps are indicated to identify the emotional coloring of texts: clearing text data, tokenization, normalization, extracting features from texts, teaching models on data. Stemming and lemmatization are presented as approaches to normalization. In order to extract signs from the text it is proposed to use a bag of words, TF-IDF. Evaluation of the quality of the model is presented using the metrics precision, recall, f1-score.