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 <fishandfrolick@gmail.com>2012-07-12 19:45:43 +0400
committerHieu Hoang <fishandfrolick@gmail.com>2012-07-12 19:45:43 +0400
commit15b95cd042f22e43212b1293d10cede9d5ff84e9 (patch)
treeb546b4e8ffacd9ff58c120e1d6604c494710dd59 /phrase-extract
parentbed4bc08ad3d0c223647ae91c7ddf4d640487068 (diff)
use consistent alignment info for lexical probabilities for both forward and inverse scoring
Diffstat (limited to 'phrase-extract')
-rw-r--r--phrase-extract/score.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/phrase-extract/score.cpp b/phrase-extract/score.cpp
index bfc95de09..eac762de7 100644
--- a/phrase-extract/score.cpp
+++ b/phrase-extract/score.cpp
@@ -331,12 +331,21 @@ PhraseAlignment* findBestAlignment(const PhraseAlignmentCollection &phrasePair )
PhraseAlignment* bestAlignment;
for(size_t i=0; i<phrasePair.size(); i++) {
- if (phrasePair[i]->count > bestAlignmentCount) {
- bestAlignmentCount = phrasePair[i]->count;
- bestAlignment = phrasePair[i];
+ size_t alignInd;
+ if (inverseFlag)
+ { // count backwards, so that alignments for ties will be the same for both normal & inverse scores
+ alignInd = phrasePair.size() - i - 1;
}
- }
-
+ else {
+ alignInd = i;
+ }
+
+ if (phrasePair[alignInd]->count > bestAlignmentCount) {
+ bestAlignmentCount = phrasePair[alignInd]->count;
+ bestAlignment = phrasePair[alignInd];
+ }
+ }
+
return bestAlignment;
}