C2W3 UNQ_C7 unittests failing


for exercise 7 I get the output below (3 tests are failing) but I don’t understand what is wrong in my code.

Can you please help?

Apparently the problem is in this function, can you trace it back there?

Hi @Randy_Scansani

From the screenshot, most probably you hard-coded the unknown_token (which is a function parameter and you should use this variable, and not “<unk>”). My guess is based on that all the test cases that failed are about “Wrong number of unknown tokens…”.


Hello @arvyzukai. No I did not hardcode the value. In the replace_oov_words_by_unk function I append the variable “unknown_token” passed to the function to the replaced_sentence list (in case the token is not in the vocabulary).

What about the preprocess_data function of the mentioned exercise 7?

Right! Thanks for your help. The issue was that in preprocess_data I wasn’t providing the unknown_token argument to the replace_oov_words_by_unk function. I had (wrongly) assumed that the default token would have been always used. Many thanks

1 Like