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:
authorBarry Haddow <barry.haddow@gmail.com>2013-10-25 00:12:47 +0400
committerBarry Haddow <barry.haddow@gmail.com>2013-10-25 00:12:47 +0400
commit31aa9f2a63be7c0defa41f5907902165719d7757 (patch)
tree9e7fa77853be0978c138062e341d955281576120 /contrib/tmcombine
parent19cc9346b6220cdec88b2d95d051093932b39cd1 (diff)
Do not output phrase penalty by default
Diffstat (limited to 'contrib/tmcombine')
-rwxr-xr-xcontrib/tmcombine/tmcombine.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/contrib/tmcombine/tmcombine.py b/contrib/tmcombine/tmcombine.py
index 5b65cc590..57fd109fe 100755
--- a/contrib/tmcombine/tmcombine.py
+++ b/contrib/tmcombine/tmcombine.py
@@ -393,7 +393,11 @@ 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||| %s\n" %(src,target,features,origin_features,alignment,extra_space,comments)
+ if flags['write_phrase_penalty']:
+ phrase_penalty = b' 2.718'
+ else:
+ phrase_penalty = b''
+ line = b"%s ||| %s ||| %s%s %s||| %s%s||| %s\n" %(src,target,features,origin_features,phrase_penalty,alignment,extra_space,comments)
return line
@@ -1307,6 +1311,7 @@ class Combine_TMs():
'normalize_s_given_t':None,
'normalize-lexical_weights':True,
'add_origin_features':False,
+ 'write_phrase_penalty':False,
'lowmem': False,
'i_e2f':0,
'i_e2f_lex':1,
@@ -1916,6 +1921,9 @@ def parse_command_line():
group2.add_argument('--normalized', action="store_true",
help=('for each phrase pair x,y: ignore models with p(y)=0, and distribute probability mass among models with p(y)>0. (default: missing entries (x,y) are always interpreted as p(x|y)=0). Only relevant in mode "interpolate".'))
+
+ group2.add_argument('--write-phrase-penalty', action="store_true",
+ help=("Include phrase penalty in phrase table"))
group2.add_argument('--recompute_lexweights', action="store_true",
help=('don\'t directly interpolate lexical weights, but interpolate word translation probabilities instead and recompute the lexical weights. Only relevant in mode "interpolate".'))
@@ -1947,7 +1955,8 @@ if __name__ == "__main__":
i_e2f=args.i_e2f,
i_e2f_lex=args.i_e2f_lex,
i_f2e=args.i_f2e,
- i_f2e_lex=args.i_f2e_lex)
+ i_f2e_lex=args.i_f2e_lex,
+ write_phrase_penalty=args.write_phrase_penalty)
# execute right method
f_string = "combiner."+args.action+'()'
exec(f_string)