0Pricing
NLP Academy · Lección

Stemming: recortar hasta la raíz

Mapear running y runs a run

Stemming: recortar hasta la raíz es una lección gratuita de NLP Academy en CoddyKit. Esta es la lección 3 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de NLP Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de NLP Academy incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en inglés.

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! 🎉

Preguntas frecuentes

¿La lección «Stemming: recortar hasta la raíz» es gratis?

Sí — el texto completo de «Stemming: recortar hasta la raíz» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de NLP Academy, actualiza a CoddyKit PRO. El curso de NLP Academy incluye 4 lecciones en total.

¿Qué aprenderé en «Stemming: recortar hasta la raíz»?

Mapear running y runs a run Practicas NLP Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar NLP Academy?

No se requiere experiencia previa. NLP Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 3 de 4.

¿Cuánto tiempo toma la lección «Stemming: recortar hasta la raíz»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de NLP Academy?

Sí. Cada lección de NLP Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Por qué importan las mayúsculas y los espacios
  2. Conversión a minúsculas y eliminación de espacios
  3. Stemming: recortar hasta la raíz
  4. Lematización: formas base más inteligentes
← Volver a NLP Academy