Skip to content

Commit

Permalink
Merge pull request #17 from christianbuck/master
Browse files Browse the repository at this point in the history
Fix writing of alignment score in multithreading
  • Loading branch information
phikoehn committed May 31, 2016
2 parents d4a1e82 + 5c0ed1c commit 7c2bbca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/fast_align.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ void UpdateFromPairs(const vector<string>& lines, const int lc, const int iter,
ostringstream oss; // collect output in last iteration
vector<double> probs(src.size() + 1);
bool first_al = true; // used when printing alignments
double local_likelihood = 0.0;
for (unsigned j = 0; j < trg.size(); ++j) {
const unsigned& f_j = trg[j];
double sum = 0;
Expand Down Expand Up @@ -202,12 +203,13 @@ void UpdateFromPairs(const vector<string>& lines, const int lc, const int iter,
emp_feat_ += DiagonalAlignment::Feature(j, i, trg.size(), src.size()) * p;
}
}
likelihood_ += log(sum);
local_likelihood += log(sum);
}
likelihood_ += local_likelihood;
if (final_iteration) {
if (print_scores) {
double log_prob = Md::log_poisson(trg.size(), 0.05 + src.size() * mean_srclen_multiplier);
log_prob += likelihood_;
log_prob += local_likelihood;
oss << " ||| " << log_prob;
}
oss << endl;
Expand Down

0 comments on commit 7c2bbca

Please sign in to comment.