import nltk import string # Download necessary NLTK resources nltk.download('punkt') nltk.download("stopwords") from nltk.corpus import stopwords from nltk.tokenize import word_tokenize # Define the quote word_quote = "Have you a pen I can borrow?” she asked." # Tokenize the quote into words words_in_quote = word_tokenize(word_quote) # Get the set of stop words in English stop_words = set(stopwords.words("english")) # Define a set of punctuation characters, including additional punctuation marks additional_punctuation = "”" punctuation = set(string.punctuation).union(set(additional_punctuation)) # Filter out the stop words and punctuation filtered_list = [word for word in words_in_quote if word.casefold() not in stop_words and word not in punctuation and word not in string.punctuation] # Print the filtered list of words print(filtered_list)