

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Retrieval Augmented Generation
incomplete
2: What Is Search?
incomplete
3: Project Overview
incomplete
4: Keyword Search
incomplete
5: Text Processing
incomplete
6: Punctuation
incomplete
7: Tokenization
incomplete
8: Stop Words
incomplete
9: Stemming
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Now that we have a list of tokens, we need to reduce related word forms to a shared base form. This helps match different variations of the same word.
These variations are normalized to their stem, a simplified form used for matching. The process is called stemming.
Our goal is to match words from the user's input to words in our dataset. If we don't stem words, we can miss valid results. Here's an example:
User query: "running"
Ugh! Both contain the concept, but in different forms that don't quite match the query.
Implementing stemming from scratch is a lot of work, so we'll use the nltk.stem library to handle it for us.
uv add nltk==3.9.1
from nltk.stem import PorterStemmer
stemmer = PorterStemmer()
Run and submit the CLI tests.