diff options
Diffstat (limited to 'python/psb.py')
-rw-r--r-- | python/psb.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/python/psb.py b/python/psb.py new file mode 100644 index 0000000..9d963f1 --- /dev/null +++ b/python/psb.py @@ -0,0 +1,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.split()], hypothesis.split(), smoothing_function=smoothing.method2) +print("%f"%(score*100)) + |