Author:
Eleftherios Avramidis
Note:
Modified copy from Hieu Hoang's code for Moses Project
Provides: cook_refs(refs, n=4): Transform a list of reference
sentences as strings into a form usable by cook_test().
cook_test(test, refs, n=4): Transform a test sentence as a string
(together with the cooked reference sentences) into a form usable
by score_cooked(). score_cooked(alltest, n=4): Score a list of
cooked test sentences.
score_set(s, testid, refids, n=4): Interface with dataset.py;
calculate BLEU score of testid against refids.
The reason for breaking the BLEU computation into three phases
cook_refs(), cook_test(), and score_cooked() is to allow the caller
to calculate BLEU scores for multiple test sets as efficiently as
possible.
|
|
|
|
|
cook_refs(refs,
n=4)
Takes a list of reference sentences for a single segment and returns
an object that encapsulates everything that BLEU needs to know about
them. |
source code
|
|
|
cook_test(test,
(reflens, refmaxcounts),
n=4)
Takes a test sentence and returns an object that encapsulates
everything that BLEU needs to know about it. |
source code
|
|
|
|
|
|
|
|
|
score_sentence(translation,
references,
n=4)
Provides the single-sentence BLEU score for one sentence, given n
references |
source code
|
|
|
|
|
score_multitarget_sentences(sentence_tuples,
n=4) |
source code
|
|