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) | |