cshanbo / smooth_bleu Goto Github PK
View Code? Open in Web Editor NEWCorpus level and sentence level BLEU calculation for machine translation
Corpus level and sentence level BLEU calculation for machine translation
In the BLEU.py, function modified_precision(references, hypothesis, n):
def modified_precision(references, hypothesis, n):
# Extracts all ngrams in hypothesis.
counts = Counter(ngrams(hypothesis, n))
if not counts:
return Fraction(0)
# Extract a union of references' counts.
max_counts = reduce(or_, [Counter(ngrams(ref, n)) for ref in references])
# Assigns the intersection between hypothesis and references' counts.
clipped_counts = {ngram: min(count, max_counts[ngram]) for ngram, count in counts.items()}
return Fraction(sum(clipped_counts.values()), sum(counts.values()))
function Fraction() returns reduction of a fraction. Such as value = Fraction(3, 6), so value.numerator = 1,
value.denominator= 2. However, when we statistics the number of n-gram, we should add 3 not 1. Looking forward to your reply.
Hi Justin - I saw that you are an original author of the WMT17 translation code for tensor2tensor. May you send me your email so I can ask you some questions about your thoughts and comparisons of Transformer model on English-Chinese translation? I can also be reached on twitter @twairball
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.