Text data matters in fields from healthcare to marketing to the digital humanities, but language has to be transformed into numbers before a model can learn from it.
Emil Hvitfeldt and Julia Silge show how to preprocess text, train supervised models, and evaluate their performance using the tidyverse and tidymodels ecosystem, including the textrecipes package for preparing text within a modeling pipeline.
The book is for data scientists and analysts who know the basics of predictive modeling and want to bring unstructured text into their work. It builds naturally on Text Mining with R, moving from exploring text to making predictions from it, though it also stands on its own. Examples include predicting the year of a United States Supreme Court opinion and classifying GitHub issues, and the authors pay attention to how preprocessing choices affect both model metrics and the fairness of results.
The book is organized in three parts, covering:
- Tokenization, stop words, stemming, and other preprocessing steps
- Word embeddings and how to create and use them
- Regression and classification models for text
- Lightweight machine learning methods such as regularized regression, naive Bayes, and support vector machines
- Deep learning models, including LSTM and convolutional neural networks
- Evaluating models with performance metrics and assessing fairness
The full book is available to read online for free.

