Merge branch 'master' of github.com:moses-smt/mosesdecoder

This commit is contained in:
Hieu Hoang 2013-06-04 15:02:31 +01:00
commit 9a7ad99104
3 changed files with 17 additions and 5 deletions

@ -1 +1 @@
Subproject commit 4e51345cd6b405551ba327d91a7d905e204587b1 Subproject commit fe569f6ad720306e0f354922494eb0203befb165

View File

@ -68,8 +68,16 @@ void CderScorer::prepareStatsVector(size_t sid, const string& text, vector<int>&
const sent_t& ref = m_ref_sentences[rid][sid]; const sent_t& ref = m_ref_sentences[rid][sid];
tmp.clear(); tmp.clear();
computeCD(cand, ref, tmp); computeCD(cand, ref, tmp);
if (calculateScore(tmp) > max) { int score = calculateScore(tmp);
if (rid == 0)
{
stats = tmp; 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); vector<int>* row = new vector<int>(I);
// Initialization of first row // Initialization of first row
(*row)[0] = 0; for (int i = 0; i < I; ++i) (*row)[i] = i;
for (int i = 1; i < I; ++i) (*row)[i] = 1;
// 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. // Calculating costs for next row using costs from the previous row.
while (++l < L) { while (++l < L) {

2
scripts/training/create_count_tables.py Normal file → Executable file
View File

@ -71,7 +71,7 @@ def create_count_lines(fobj, countobj, countobj_target, prune=0):
i = 0 i = 0
original_pos = 0 original_pos = 0
source = "" source = b""
store_lines = set() store_lines = set()
for line in fobj: for line in fobj: