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:
authorHieu Hoang <hieu@hoang.co.uk>2013-05-29 21:16:15 +0400
committerHieu Hoang <hieu@hoang.co.uk>2013-05-29 21:16:15 +0400
commit6249432407af8730c10bccc7894c0725fcaf5e47 (patch)
tree3ac1f094b9fdc199b04bc5ef209ce00e3596e37d /mert/CderScorer.cpp
parent59bd7deb4b6b9c4f7b3b7dbb055783528fbc31ca (diff)
beautify
Diffstat (limited to 'mert/CderScorer.cpp')
-rw-r--r--mert/CderScorer.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/mert/CderScorer.cpp b/mert/CderScorer.cpp
index cece29034..21a80ad52 100644
--- a/mert/CderScorer.cpp
+++ b/mert/CderScorer.cpp
@@ -6,9 +6,11 @@
using namespace std;
-namespace {
+namespace
+{
-inline int CalcDistance(int word1, int word2) {
+inline int CalcDistance(int word1, int word2)
+{
return word1 == word2 ? 0 : 1;
}
@@ -16,11 +18,11 @@ inline int CalcDistance(int word1, int word2) {
namespace MosesTuning
{
-
+
CderScorer::CderScorer(const string& config, bool allowed_long_jumps)
- : StatisticsBasedScorer(allowed_long_jumps ? "CDER" : "WER", config),
- m_allowed_long_jumps(allowed_long_jumps) {}
+ : StatisticsBasedScorer(allowed_long_jumps ? "CDER" : "WER", config),
+ m_allowed_long_jumps(allowed_long_jumps) {}
CderScorer::~CderScorer() {}
@@ -82,7 +84,8 @@ float CderScorer::calculateScore(const vector<int>& comps) const
}
void CderScorer::computeCD(const sent_t& cand, const sent_t& ref,
- vector<int>& stats) const {
+ vector<int>& stats) const
+{
int I = cand.size() + 1; // Number of inter-words positions in candidate sentence
int L = ref.size() + 1; // Number of inter-words positions in reference sentence
@@ -95,11 +98,9 @@ void CderScorer::computeCD(const sent_t& cand, const sent_t& ref,
for (int i = 1; i < I; ++i) (*row)[i] = 1;
// Calculating costs for next row using costs from the previous row.
- while (++l < L)
- {
+ while (++l < L) {
vector<int>* nextRow = new vector<int>(I);
- for (int i = 0; i < I; ++i)
- {
+ for (int i = 0; i < I; ++i) {
vector<int> possibleCosts;
if (i > 0) {
possibleCosts.push_back((*nextRow)[i-1] + 1); // Deletion