import nltk from nltk.stem import PorterStemmer from nltk.tokenize import word_tokenize nltk.download('punkt') stemmer = PorterStemmer() sentence = "The leaves are falling and the cats are running swiftly" words = word_tokenize(sentence) stemmed_words = [stemmer.stem(word) for word in words] print("Original Words:", words) print("Stemmed Words:", stemmed_words) # Original Words: ['The', 'leaves', 'are', 'falling', 'and', 'the', 'cats', 'are', 'running', 'swiftly'] # Stemmed Words: ['the', 'leav', 'are', 'fall', 'and', 'the', 'cat', 'are', 'run', 'swiftli']