def remove_stopwords(tokens): """ This function takes in a list of tokens (from the 'preprocess' function) and removes a list of stopwords. Custom stopwords can be added to the 'custom_stopwords' list. """ #set default and custom stopwords stop_words = nltk.corpus.stopwords.words('english') custom_stopwords = [] stop_words.extend(custom_stopwords) #filter out stopwords filtered_tokens = [word for word in tokens if word not in stop_words] return(filtered_tokens)