diff options
author | Rico Sennrich <rico.sennrich@gmx.ch> | 2012-09-11 16:33:30 +0400 |
---|---|---|
committer | Rico Sennrich <rico.sennrich@gmx.ch> | 2012-09-11 16:33:30 +0400 |
commit | 0f3de7493491bb5a3c5e7311a4d4ebcc9ac4d2e7 (patch) | |
tree | f324c376a93ffc8a2e186e306eb75c07ba16395a /contrib | |
parent | 968ab98f0cfc5890ec8c2d4cfff364263e0ac326 (diff) |
possible fix for tmcombine for models without alignment info
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/tmcombine/tmcombine.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/tmcombine/tmcombine.py b/contrib/tmcombine/tmcombine.py index 24343b4bf..6560ad23b 100755 --- a/contrib/tmcombine/tmcombine.py +++ b/contrib/tmcombine/tmcombine.py @@ -362,6 +362,11 @@ class Moses(): # information specific to Moses model: alignment info and comment section with target and source counts alignment,comments = self.phrase_pairs[src][target][1] + if alignment: + extra_space = b' ' + else: + extra_space = b'' + if mode == 'counts': i_e2f = flags['i_e2f'] i_f2e = flags['i_f2e'] @@ -376,8 +381,7 @@ class Moses(): origin_features = b' '.join([b'%.4f' %(f) for f in origin_features]) + ' ' else: origin_features = b'' - - line = b"%s ||| %s ||| %s 2.718 %s||| %s ||| %s\n" %(src,target,features,origin_features,alignment,comments) + line = b"%s ||| %s ||| %s 2.718 %s||| %s%s||| %s\n" %(src,target,features,origin_features,alignment,extra_space,comments) return line |