Professional Documents
Culture Documents
Ai Ass 10
Ai Ass 10
LAB
MCA first year
Session: (2023-2024)
SECTION – A
Assignment
Q-1 Write a Python program to implement Lemmatization using NLTK.
import nltk
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
nltk.download('punkt')
nltk.download('wordnet')
def lemmatization(sentence):
words = word_tokenize(sentence)
lemmatizer = WordNetLemmatizer()
return lemmatized_sentence
# Example usage:
if name == " main ":
sentence = "The quick brown foxes are jumping over the lazy dogs"
lemmatized_sentence = lemmatization(sentence)
print("Original sentence:", sentence)
print("Lemmatized sentence:", lemmatized_sentence)
Output
Python program to implement Breadth First