summaryrefslogtreecommitdiff
path: root/python/psb.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/psb.py')
-rw-r--r--python/psb.py9
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))
+