Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to do word lemmatizing using nltk library in NLP

Description

To understand how to do word lemmatizing in natural language processing using nltk library.

Input

Sample text

Output

Lemittized words.

Process

  Import necessary libraries.

  Took sample text.

  Build WordNetLemmatizer constructor.

  Fit the text data into the constructor.

  Lemmatize the words.

  Print the results.

Sample Code

from nltk.stem import WordNetLemmatizer

#sample words
example_words = [“studies”,”leaves”,”vibes”,”rocks”,”corpora”]

print(“Sample words”)
print(example_words)
print(“\n”)

#stemmer constructor
wl = WordNetLemmatizer()

re = []
for i in example_words:
re.append(wl.lemmatize(i))
print(“After Lemmatizing”)
print(re)

Screenshots
word lemmatizing using nltk library in NLP