C2W2 Exc. 7 Viterbi Backward


I have a question that seems to be pretty common. I’ve looked at the other proposed solutions for finishing exercise 7 but I can’t seem to figure it out. I’ve tried changing my ranges in the for loop for step 2 to stepping backwards from m-1 to m- the length of the corpus but that doesn’t seem to work either. Is there anyone who could point me in the right direction?

Thank you.


If I understand you correctly, then your for loop range in Step 2 should not be from m-1 to m minus the length of the corpus but as suggested in hints :

# From the last word in the corpus to the 0th word in the corpus

So the last word your corpus is m-1 (start), and your range should go to 0 (stop), by -1 (step)

I tried that previously, however I seemed to still get 3 tests passing with 1 failing. Should I send you my file?

Please, I will see what I can do