I got stuck here in “Test your function” with the following output (none of the already published tips seemed to help) >>
entered word = dys
suggestions = [‘dye’, ‘days’]
entered word = satr
suggestions = [‘sat’, ‘star’]
entered word = san
suggestions = [‘tan’, ‘sun’, ‘man’, ‘sap’, ‘sat’, ‘saw’, ‘can’, ‘wan’, ‘fan’, ‘an’, ‘sang’, ‘say’, ‘sin’, ‘son’, ‘sad’]
Wrong output type.
Expected: 5.
Got: 15.
Wrong output values.
Expected: [(‘say’, 0.0019770955347483865), (‘can’, 0.0019211400007460738), (‘an’, 0.0017719252434065728), (‘man’, 0.0013242809713880702), (‘son’, 0.0007274219420300668)].
Got: [[‘sad’, 0.00026112582534412656], [‘son’, 0.0007274219420300668], [‘sin’, 0.00026112582534412656], [‘say’, 0.0019770955347483865], [‘sang’, 1.865184466743761e-05], [‘an’, 0.0017719252434065728], [‘fan’, 3.730368933487522e-05], [‘wan’, 1.865184466743761e-05], [‘can’, 0.0019211400007460738], [‘saw’, 0.0002797776700115641], [‘sat’, 5.595553400231283e-05], [‘sap’, 1.865184466743761e-05], [‘man’, 0.0013242809713880702], [‘sun’, 0.0002797776700115641], [‘tan’, 1.865184466743761e-05]].
7 Tests passed
2 Tests failed
Reading over and over the conditions I should check
- If the word is in the vocabulary, suggest the word.
- Otherwise, if there are suggestions from
edit_one_letter
that are in the vocabulary, use those. - Otherwise, if there are suggestions from
edit_two_letters
that are in the vocabulary, use those. - Otherwise, suggest the input word.*
I did not understand the last one. Wasn’t the input word already tested at the first condition? Or do you mean the regular expression “word.*”? this was the only condition i did not include at my code.
And I didnt understand why the output types are wrong, I tried everything but returning the list n_best was the only one that worked.