In [1]:
# Stemming: Taking the root stem word out of the word in a sentence.
# Famous Algorithm: Porter Stemmer
# example: walking -> walk; sing -> sing

from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize

port_stem = PorterStemmer()

#text = ["ride","rider","riding","ridden"]
text = "He went for a ride with his parents. His father is a rider and has ridden many horses. She has been riding for past three years now."

words = word_tokenize(text)

for word in words:
    print(port_stem.stem(word))


He
went
for
a
ride
with
hi
parent
.
Hi
father
is
a
rider
and
ha
ridden
mani
hors
.
She
ha
been
ride
for
past
three
year
now
.

In [ ]: