Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def symmetrization(es, fs, corpus):
'''
forpus
for translation from fs to es
return
alignment **from fs to es**
'''
f2e_train = ibmmodel2._train(corpus, loop_count=10)
f2e = ibmmodel2.viterbi_alignment(es, fs, *f2e_train).items()
e2f_corpus = list(zip(*reversed(list(zip(*corpus)))))
e2f_train = ibmmodel2._train(e2f_corpus, loop_count=10)
e2f = ibmmodel2.viterbi_alignment(fs, es, *e2f_train).items()
return alignment(es, fs, e2f, f2e)
def symmetrization(es, fs, corpus):
'''
forpus
for translation from fs to es
return
alignment **from fs to es**
'''
f2e_train = ibmmodel2._train(corpus, loop_count=10)
f2e = ibmmodel2.viterbi_alignment(es, fs, *f2e_train).items()
e2f_corpus = list(zip(*reversed(list(zip(*corpus)))))
e2f_train = ibmmodel2._train(e2f_corpus, loop_count=10)
e2f = ibmmodel2.viterbi_alignment(fs, es, *e2f_train).items()
return alignment(es, fs, e2f, f2e)