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, choose a sample text and a sequence length (n) to see the top 1-gram, 2-gram, and 3-gram features based on occurrence, along with how often each one appears.
Which of the following statements is true?
This exercise is part of the course
Understanding Machine Learning
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
Start Exercise