This lesson is not an exhaustive introduction to text preprocessing. However, it does show a few of the most common tricks for cleaning your data. Before building a text preprocessing pipeline, it’s most important to have an idea of how you want your data formatted and why you want it formatted that way. Once you know what you want, you can use these tools to get you there.

Let’s review what we covered in this lesson:

  • Text preprocessing is all about cleaning and prepping text data so that it’s ready for other NLP tasks.
  • Noise removal is a text preprocessing step concerned with removing unnecessary formatting from our text.
  • Tokenization is a text preprocessing step devoted to breaking up text into smaller units (usually words or discrete terms).
  • Normalization is the name we give most other text preprocessing tasks, including stemming, lemmatization, upper and lowercasing, and stopword removal.
  • Stemming is the normalization preprocessing task focused on removing word affixes.
  • Lemmatization is the normalization preprocessing task that more carefully brings words down to their root forms.


To the right, we added some HTML text that we pulled from Oprah Winfrey’s Wikipedia page. See if you can use only the skills you’ve learned in this lesson to:

  1. Select only the string within the <p> tags.
  2. Remove all periods.
  3. Make all of the words lowercase.
  4. Tokenize the string.
  5. Lemmatize the string.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?