diff options
author | Patrick Simianer <p@simianer.de> | 2015-01-20 18:04:32 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2015-01-20 18:04:32 +0100 |
commit | 7b8cbb7f43c34c9e068f041ffe9e6fdeebc0c901 (patch) | |
tree | 174f98ff32acae26c76105b9c01141ab33f8434f | |
parent | 0673fb55c6af8bc94c9f3e577c514160faf736d3 (diff) |
word-aligner: init_ttable
-rw-r--r-- | word-aligner/fast_align.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/word-aligner/fast_align.cc b/word-aligner/fast_align.cc index 73b72399..d320fb52 100644 --- a/word-aligner/fast_align.cc +++ b/word-aligner/fast_align.cc @@ -43,7 +43,8 @@ bool InitCommandLine(int argc, char** argv, po::variables_map* conf) { ("testset,x", po::value<string>(), "After training completes, compute the log likelihood of this set of sentence pairs under the learned model") ("no_add_viterbi,V","When writing model parameters, do not add Viterbi alignment points (may generate a grammar where some training sentence pairs are unreachable)") ("force_align,f",po::value<string>(), "Load previously written parameters to 'force align' input. Set --diagonal_tension and --mean_srclen_multiplier as estimated during training.") - ("mean_srclen_multiplier,m",po::value<double>()->default_value(1), "When --force_align, use this source length multiplier"); + ("mean_srclen_multiplier,m",po::value<double>()->default_value(1), "When --force_align, use this source length multiplier") + ("init_ttable,J",po::value<string>()->default_value(""), "Initialize ttable with this file (output of -p). Also give --diagonal_tension."); po::options_description clo("Command line options"); clo.add_options() ("config", po::value<string>(), "Configuration file") @@ -109,6 +110,11 @@ int main(int argc, char** argv) { s2t.DeserializeLogProbsFromText(s2t_f.stream()); mean_srclen_multiplier = conf["mean_srclen_multiplier"].as<double>(); } + + if (conf.count("init_ttable")) { + ReadFile s2t_f(conf["force_align"].as<string>()); + s2t.DeserializeLogProbsFromText(s2t_f.stream()); + } for (int iter = 0; iter < ITERATIONS; ++iter) { const bool final_iteration = (iter == (ITERATIONS - 1)); |