TensorFlow text processing tutorials

The TensorFlow text processing tutorials provide step-by-step instructions for solving common text and natural language processing (NLP) problems.

TensorFlow provides two solutions for text and natural language processing: KerasNLP and TensorFlow Text. KerasNLP is a high-level NLP library that includes all the latest Transformer-based models as well as lower-level tokenization utilities. It's the recommended solution for most NLP use cases.

If you need access to lower-level text processing tools, you can use TensorFlow Text. TensorFlow Text provides a collection of ops and libraries to help you work with input in text form such as raw text strings or documents.


  • Getting Started with KerasNLP: Learn KerasNLP by performing sentiment analysis at progressive levels of complexity, from using a pre-trained model to building your own Transformer from scratch.

Text generation

Text classification

  • Classify text with BERT: Fine-tune BERT to perform sentiment analysis on a dataset of plain-text IMDb movie reviews.
  • Text classification with an RNN: Train an RNN to perform sentiment analysis on IMDb movie reviews.
  • TF.Text Metrics: Learn about the metrics available through TensorFlow Text. The library contains implementations of text-similarity metrics such as ROUGE-L, which can be used for automatic evaluation of text generation models.