File size: 349 Bytes
158b61b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)