Module: stem_lemmetize.py
Functions
import nltk
from nltk.stem import PorterStemmer, WordNetLemmatizer
# Ensure you have the necessary NLTK data
nltk.download('wordnet')
nltk.download('omw-1.4')
def stem_words(words):
"""
Apply stemming to a list of words.
Parameters:
words (list): List of words to stem.
Returns:
list: List of stemmed words.
"""
def lemmatize_words(words):
"""
Apply lemmatization to a list of words.
Parameters:
words (list): List of words to lemmatize.
Returns:
list: List of lemmatized words.
"""