Instantly share code, notes, and snippets.

Embed
What would you like to do?
Machine Translation Metric - BLEU Score
from nltk.translate.bleu_score import sentence_bleu
reference = [['the', 'cat',"is","sitting","on","the","mat"]]
candidate = ["on",'the',"mat","is","a","cat"]
score = sentence_bleu( reference, candidate)
print(score)
from nltk.translate.bleu_score import sentence_bleu
reference = [['the', 'cat',"is","sitting","on","the","mat"]]
candidate = ["there",'is',"cat","sitting","cat"]
score = sentence_bleu( reference, candidate)
print(score)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment