NMTKD / translation /bleu_bck.py
sakharamg's picture
Uploading all files
158b61b
raw
history blame
349 Bytes
import sacrebleu
h = open("output-translation/flores.mr", 'r').readlines()
r = open("../shivam/flores101_dataset/devtest/mar.devtest", 'r').readlines()
hyp, ref = [], []
for i in range(len(h)):
hh = h[i].strip("\n")
rr = r[i].strip("\n")
hyp.append(hh)
ref.append(rr)
bleu = sacrebleu.corpus_bleu(hyp, [ref])
print(bleu.score)