C3W2 Error running

The provided function def standardize_func(sentence):“Removes a list of stopwords” does not remove all stop_words.

Runing the Unit test"unittests.test_fit_vectorizer(fit_vectorizer, standardize_func)" produces:

Error: Failed test case: Found stopwords in the vocabulary.

Any help appreciated "

Hi @Joseph_Porrovecchio

Make sure to apply the standardize_func to all of your sentences. Also, ensure that the stopwords list and replacement action in your function are correct.

Hope it helps! Feel free to ask if you need further assistance.

Thank you Alirez,

I call the ‘standardize_func’ in from vectorizer.adapt(train_sentences, standardize_func) . Also, The result for test_sentence call to standardized_sentence = standardize_func(test_sentence) does not seem correct?

you are using standardize_func at the wrong place, this need to be recalled where we instantiate the tokenizer class.

See the below thread for more detail

Regards
DP

Thank you DP!

Moved standardize_func and that solved it!

1 Like