[Hindi]NLP 15# Stemming |NLP|Python 3|Natural Language Processing|2019
Code:
# -*- coding: utf-8 -*-
"""NLP_Ex9.ipynb
Automatically generated by Colaboratory.
"""
#running ----> run
#gaming -----> game
#boating ----> boat
#easily -----> easy
import nltk
from nltk.stem.porter import PorterStemmer
p_stemmer = PorterStemmer()
words = ['run','runner','ran','runs','easily','fairly']
for word in words:
print(word+' ----->'+p_stemmer.stem(word))
from nltk.stem.snowball import SnowballStemmer
s_stemmer = SnowballStemmer(language='english')
for word in words:
print(word+' ----->'+s_stemmer.stem(word))
words = ['generous','generation','genereously','generate']
for word in words:
print(word+' ----->'+s_stemmer.stem(word))
"""NLP_Ex9.ipynb
Automatically generated by Colaboratory.
"""
#running ----> run
#gaming -----> game
#boating ----> boat
#easily -----> easy
import nltk
from nltk.stem.porter import PorterStemmer
p_stemmer = PorterStemmer()
words = ['run','runner','ran','runs','easily','fairly']
for word in words:
print(word+' ----->'+p_stemmer.stem(word))
from nltk.stem.snowball import SnowballStemmer
s_stemmer = SnowballStemmer(language='english')
for word in words:
print(word+' ----->'+s_stemmer.stem(word))
words = ['generous','generation','genereously','generate']
for word in words:
print(word+' ----->'+s_stemmer.stem(word))
0 Comments