It is definitely needed, even at the beginning there’s a code hint: # Go through every word in the corpus starting from word 1
And it is also needed to # Calculate the probability
I don’t think the corpus is needed in viterbi_backward function. The size of corpus is obtained from the shape of best_prob matrix. There is no need to calculate any probability in this function.