In your assignment explain your codes with comments. Without comments, your assignment will not be marked. Problem In th
Posted: Fri May 20, 2022 10:08 am
– Iterate total five times over the two pairs sentence that we
have explained in the lecture
– s-total(e) values for each pairs
– expected counts: count(e|f)
– total(f)
– estimate probabilities: t(e|f)
• Test your code with five pairs Turkish-to- English sentences
(5 parallel sentence, you can write these sentence yourself). Just
record result of the last iteration
• Compare your results with the Python IBM modules of the NLTK
library
• Write a short report that contains the result that you have
gotten from previous tasks.
In your assignment explain your codes with comments. Without comments, your assignment will not be marked. Problem In this assignment you are asked to implement the IBM Module 1 (Figure I) with python programming language. 14: 16: 17: 4: Input: set of sentence pairs (e, f) Output: translation prob. telf) 1: initialize t(els) uniformly 2: while not converged do 3: // initialize count(elf) = 0 for all e, f 5: total(f) = 0 for all f for all sentence pairs (e,f) do // compute normalization for all words e in e do s-total(e) = 0 for all words f in f do s-total(e) +=t(ef) end for end for 6: // collect counts 15: for all words e in e do for all words f in f do count(els) += tſelf) s-total(e) 18: total(s) += telf) s-total(e) 19: end for 20: end for 21: end for // estimate probabilities for all foreign words f do for all English words e do 25: t(ef) = count(elf) total (S) 26 end for 27: end for 28: end while 7: 22: 8: 23: 9: 24: 10: 11: 12 13: Figure 1: EM training algorithm for IBM Model 1