0Pricing
NLP Academy · Lesson

Stemming: Chopping to the Root

Map running and runs to run.

Stemming: Chopping to the Root is a free NLP Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the NLP Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

One Word, Many Forms

The verb run shows up as running, runs, and ran. To you they share a meaning, but raw text counts each one separately, splitting the signal. 🌱

Enter Stemming

Stemming chops the endings off a word to reach a rough root called the stem. The goal is to make related forms collapse into one shared token.

Rules, Not a Dictionary

A stemmer follows simple suffix rules instead of looking words up. It strips endings like ing, ed, and s, so it is fast but a bit crude.

The Porter Stemmer

NLTK ships the classic PorterStemmer. You create one instance, then call its stem method on any word you want reduced.

from nltk.stem import PorterStemmer
ps = PorterStemmer()
print(ps.stem('running'))

Forms Collapse Together

Feed in several forms of the same verb and they all reduce to the same stem. Now your counts can finally add up.

for w in ['running', 'runs', 'ran']:
    print(ps.stem(w))

Stems Are Not Real Words

Stemming is blunt. The word studies becomes studi, which is not a real word, but it still matches study and studied as one stem.

print(ps.stem('studies'))

Watch for Over-Stemming

Sometimes a stemmer cuts too far and merges unrelated words. This over-stemming can blur meanings, so always sanity-check the output on your text.

print(ps.stem('universal'))
print(ps.stem('university'))

Stem a Token List

In practice you stem every token in a document. A comprehension applies the stemmer across the whole list in one clean line.

words = ['cats', 'caring', 'cared']
print([ps.stem(w) for w in words])

Other Stemmers Exist

Porter is the default, but NLTK also offers the snappier SnowballStemmer, which supports many languages and fixes some Porter rough edges.

from nltk.stem import SnowballStemmer
sb = SnowballStemmer('english')
print(sb.stem('happily'))

Lowercase First

Stemmers expect lowercase input. Fold case before stemming, or Running and running may slip through as two different tokens again.

print(ps.stem('Running'.lower()))

When to Reach for It

Stemming trades precision for speed. It shines in search and large pipelines where a rough but fast match beats slow, exact analysis. ⚡

Quick Check

Let's lock in how stemming behaves.

Recap

You learned stemming chops suffixes with simple rules to collapse word forms into one stem. It is fast and rough, sometimes yielding non-words. Nice work! 🎉

Frequently asked questions

Is the “Stemming: Chopping to the Root” lesson free?

Yes — the full text of “Stemming: Chopping to the Root” is free to read here on the web, and the NLP Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the NLP Academy course, upgrade to CoddyKit PRO.

What will I learn in “Stemming: Chopping to the Root”?

Map running and runs to run. You practise NLP Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start NLP Academy?

No prior experience is required. NLP Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Stemming: Chopping to the Root” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this NLP Academy lesson?

Yes. Every NLP Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Why Case and Spacing Matter
  2. Lowercasing and Stripping Whitespace
  3. Stemming: Chopping to the Root
  4. Lemmatization: Smarter Base Forms
← Back to NLP Academy