For whatever reason this function (insert_letter) neither requires de-duping (i.e., create a set) nor sorts the outputs. This is slightly confusing because that is required for the exercise above it (replace_letter).
The reason this gets confusing, is that if you do properly de-dupe, it cuts down the number of suggesetions in both the expected output and the unit tests (which in turn will fail).
Are you referring to
viterbi_backward function for predicting POS tags ? Because that is what Exercise 7 is about.
This is from W1, I have corrected the typo in the topic header.
the reason for using set function in
replace_letter was to simply to remove the original input word from the list of output. While performing
insert_letter at every offset, that situation will not arise, so we do not perform word removal from list.
The purpose of using set was not de-duplication but only to remove original input word from output list.
But I understand that
set deduplicates the final output as well for
replace_letter, which was not the intention of the task. Your feedback will be taken into consideration to improve the assignment further, thanks!