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 <machacekmatous@gmail.com>2012-05-03 00:03:58 +0400
committerMatous Machacek <machacekmatous@gmail.com>2012-05-03 00:03:58 +0400
commit933f25b3b201da907b2749264ff824a0913fdf2f (patch)
tree05904ec381b80bbadc76f44d18c8e3a210bf884d /mert/CderScorer.cpp
parent0021ef661e5751551cd620440a222d8a298ffcc5 (diff)
CderScorer compute both CDER and WER metric
Diffstat (limited to 'mert/CderScorer.cpp')
-rw-r--r--mert/CderScorer.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/mert/CderScorer.cpp b/mert/CderScorer.cpp
index 9ad71fc55..124c78627 100644
--- a/mert/CderScorer.cpp
+++ b/mert/CderScorer.cpp
@@ -12,8 +12,9 @@ inline int CalcDistance(int word1, int word2) {
} // namespace
-CderScorer::CderScorer(const string& config)
- : StatisticsBasedScorer("CDER",config) {}
+CderScorer::CderScorer(const string& config, bool longJumps)
+ : StatisticsBasedScorer("CDER",config),
+ longJumpsAllowed(longJumps) {}
CderScorer::~CderScorer() {}
@@ -102,11 +103,13 @@ void CderScorer::computeCD(const sent_t& cand, const sent_t& ref,
(*nextRow)[i] = *min_element(possibleCosts.begin(), possibleCosts.end());
}
- // Cost of LongJumps is the same for all in the row
- int LJ = 1 + *min_element(nextRow->begin(), nextRow->end());
-
- for (int i = 0; i < I; ++i) {
- (*nextRow)[i] = min((*nextRow)[i], LJ); // LongJumps
+ if (longJumpsAllowed) {
+ // Cost of LongJumps is the same for all in the row
+ int LJ = 1 + *min_element(nextRow->begin(), nextRow->end());
+
+ for (int i = 0; i < I; ++i) {
+ (*nextRow)[i] = min((*nextRow)[i], LJ); // LongJumps
+ }
}
delete row;