Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatous Machacek <matous-ubuntu>2013-06-03 18:59:13 +0400
committerMatous Machacek <matous-ubuntu>2013-06-03 18:59:13 +0400
commit3055be8837e6be6df12a667d16828a3d1dd41497 (patch)
treec31a2367ae27708270cb123109068b628687e510
parent513af400ee762ac75fbfac49a216859f5abb9cf1 (diff)
fixed two bugs in CderScorer.cpp
-rw-r--r--mert/CderScorer.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/mert/CderScorer.cpp b/mert/CderScorer.cpp
index 21a80ad52..05c55d9ba 100644
--- a/mert/CderScorer.cpp
+++ b/mert/CderScorer.cpp
@@ -68,8 +68,16 @@ void CderScorer::prepareStatsVector(size_t sid, const string& text, vector<int>&
const sent_t& ref = m_ref_sentences[rid][sid];
tmp.clear();
computeCD(cand, ref, tmp);
- if (calculateScore(tmp) > max) {
+ int score = calculateScore(tmp);
+ if (rid == 0)
+ {
stats = tmp;
+ max = score;
+ }
+ else if (score > max)
+ {
+ stats = tmp;
+ max = score;
}
}
}
@@ -94,8 +102,12 @@ void CderScorer::computeCD(const sent_t& cand, const sent_t& ref,
vector<int>* row = new vector<int>(I);
// Initialization of first row
- (*row)[0] = 0;
- for (int i = 1; i < I; ++i) (*row)[i] = 1;
+ for (int i = 0; i < I; ++i) (*row)[i] = i;
+
+ // For CDER metric, the initialization is different
+ if (m_allowed_long_jumps) {
+ for (int i = 1; i < I; ++i) (*row)[i] = 1;
+ }
// Calculating costs for next row using costs from the previous row.
while (++l < L) {