Why ex 7,8 in C2W3

For exercise 7 I am currently getting 3 test cases failing though I’m not sure what is wrong, since all we’re doing is just calling the get_words_with_nplus_frequency on the train_data and then calling replace_oov_words_by_unk on the train and test data passing vocabulary we got from the first part of the exercise.

For exercise 8 I’m not sure why the inner for loop’s iterator is set as sentence when shouldn’t it be i? I justh have 1 test case failing for that exercise out of 6 but I’m not sure what is wrong.

Hey @moustafa_fathy,
If you are calling the functions correctly in Exercise 7, then it means that there is an issue in your implementations of these functions. The test-cases can only go so far, it’s not possible for the test-cases to cover the entire spectrum of possible issues. The developers try their best to write test-cases which cover all the most frequent issues, but some issues slide past those test-cases.

That being said, please ensure that your implementations of get_words_with_nplus_frequency and replace_oov_words_by_unk are correct. If you are unable to figure out the issue, feel free to DM me your code for the same.

Now, for exercise 8, I am not sure, I get your point. For that, please share your error stack here (if any). If not, please DM me the code for that as well.

Cheers,
Elemento

hi @Elemento
this my answers

{Moderator’s Edit: Solution Code Removed}

Hey @moustafa_fathy,
In your implementation of the preprocess_data function, you have hard-coded the unknown_token, whereas you are supposed to use the parameter unknown_token that has been defined for the function. This is because the test-cases check your implementation for various values of the parameters, so that it can be ensured that your implementation is as generic as possible.

P.S. - Posting solution code publicly is strictly against the community guidelines. Please refrain from doing so in the future.

Cheers,
Elemento