in src/open-r1-multimodal/src/open_r1/grpo_rec.py [0:0]
def bleu(prediction, reference):
prediction = re.sub(r'[^\sa-zA-Z0-9]', '', prediction)
reference = re.sub(r'[^\sa-zA-Z0-9]', '', reference)
reference = [reference.split()]
# 机器翻译结果
prediction = prediction.split()
bleu_score = sentence_bleu(reference, prediction, weights=(0.5,0.5))
return bleu_score