summaryrefslogtreecommitdiff
path: root/python/psb.py
blob: 2d575fa191fe997cacc25237a23553950a446f69 (plain)
1
2
3
4
5
6
7
8
9
import nltk
from nltk.translate.bleu_score import SmoothingFunction
smoothing = SmoothingFunction()

hypothesis = open('in').read().strip()
reference =  open('ref').read().strip()
score = nltk.translate.bleu_score.sentence_bleu([reference], hypothesis, smoothing_function=smoothing.method0)
print("%f"%(score*100))