mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 05:55:02 +03:00
Clean up BleuScorer.
This commit is contained in:
parent
5007f129d8
commit
c6536a134b
@ -141,16 +141,16 @@ void BleuScorer::prepareStats(size_t sid, const string& text, ScoreStats& entry)
|
|||||||
//precision on each ngram type
|
//precision on each ngram type
|
||||||
for (NgramCounts::const_iterator testcounts_it = testcounts.begin();
|
for (NgramCounts::const_iterator testcounts_it = testcounts.begin();
|
||||||
testcounts_it != testcounts.end(); ++testcounts_it) {
|
testcounts_it != testcounts.end(); ++testcounts_it) {
|
||||||
int correct = 0;
|
const NgramCounts::Value guess = testcounts_it->second;
|
||||||
const int guess = testcounts_it->second;
|
const size_t len = testcounts_it->first.size();
|
||||||
|
NgramCounts::Value correct = 0;
|
||||||
|
|
||||||
NgramCounts::Value v = 0;
|
NgramCounts::Value v = 0;
|
||||||
if (m_ref_counts[sid]->lookup(testcounts_it->first, &v)) {
|
if (m_ref_counts[sid]->lookup(testcounts_it->first, &v)) {
|
||||||
correct = min(v, guess);
|
correct = min(v, guess);
|
||||||
}
|
}
|
||||||
const size_t len = testcounts_it->first.size();
|
stats[len * 2 - 2] += correct;
|
||||||
stats[len*2-2] += correct;
|
stats[len * 2 - 1] += guess;
|
||||||
stats[len*2-1] += guess;
|
|
||||||
}
|
}
|
||||||
entry.set(stats);
|
entry.set(stats);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user