summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-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..2d575fa
--- /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], hypothesis, smoothing_function=smoothing.method0)
+print("%f"%(score*100))
+