Generation

generate functionMon, 27 Mar 2023

This code removes stopwords in lists incorrectly: without_sw = [[word for word in text if word not in stopwords_set] for text in only_words_text] It turns out like this: [[g], [u, n, l], [j, u, r, n, g], [p, n, ] It should be like this: [go, until, jurong, point Correct it.

stopwords_set = set(stopwords.words('english')) without_sw = [[word for word in text if word not in stopwords_set] for text in only_words_text] without_sw = [item for sublist in without_sw for item in sublist]

Questions about programming?Chat with your personal AI assistant