Get startedGet started for free

Bag of words

In the field of Natural Language Processing, n-grams are a foundational way to make features from text. n-grams count the sequence of words and n indicates how many word(s) a sequence contains. For example, 2-grams, count the occurrence of two-word sequences.

In this exercise, you can input text and see what are the top 1-gram, 2-gram, and 3-gram features based on occurrence. If you're not sure what to enter, try some of these restaurant reviews:

The food was not great and the service could be faster.

I've seen a lot of bad reviews about this place, but it was not that bad. You get what you pay for!

Which of the following statements is true?

This exercise is part of the course

Understanding Machine Learning

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise