Articles → NLP → Stemming In NLP
Stemming In NLP
Purpose
- playing, played, plays → play
- connection, connected, connecting → connect
Types Of Stemmers
- Porter Stemmer
- Snowball Stemmer
- Lancaster Stemmer
Porter Stemmer
- connection, connected, connecting → connect
- happiness → happi
Snowball Stemmer
Lancaster Stemmer
Example
from nltk.stem import PorterStemmer, LancasterStemmer, SnowballStemmer
porter = PorterStemmer()
lancaster = LancasterStemmer()
snowball = SnowballStemmer("english")
words = ["playing", "played", "happiness", "studies"]
for w in words:
print(f"{w} -> Porter:{porter.stem(w)}, Lancaster:{lancaster.stem(w)}, Snowball:{snowball.stem(w)}")
Output
Posted By - | Karan Gupta |
|
Posted On - | Monday, August 25, 2025 |