From a80c69d266886d9911eb91833811d7f8393ac64d Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Tue, 7 Dec 2010 22:01:41 -0500 Subject: add support for viterbi alignment --- decoder/decoder.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/decoder/decoder.cc b/decoder/decoder.cc index f47b7385..fb219663 100644 --- a/decoder/decoder.cc +++ b/decoder/decoder.cc @@ -340,6 +340,7 @@ DecoderImpl::DecoderImpl(po::variables_map& conf, int argc, char** argv, istream ("k_best,k",po::value(),"Extract the k best derivations") ("unique_k_best,r", "Unique k-best translation list") ("aligner,a", "Run as a word/phrase aligner (src & ref required)") + ("aligner_use_viterbi", "If run in alignment mode, compute the Viterbi (rather than MAP) alignment") ("intersection_strategy,I",po::value()->default_value("cube_pruning"), "Intersection strategy for incorporating finite-state features; values include Cube_pruning, Full") ("cubepruning_pop_limit,K",po::value()->default_value(200), "Max number of pops from the candidate heap at each node") ("goal",po::value()->default_value("S"),"Goal symbol (SCFG & FST)") @@ -869,7 +870,7 @@ bool DecoderImpl::Decode(const string& input, DecoderObserver* o) { } } if (aligner_mode && !output_training_vector) - AlignerTools::WriteAlignment(smeta.GetSourceLattice(), smeta.GetReference(), forest, &cout); + AlignerTools::WriteAlignment(smeta.GetSourceLattice(), smeta.GetReference(), forest, &cout, 0 == conf.count("aligner_use_viterbi")); if (write_gradient) { const prob_t ref_z = InsideOutside, EdgeFeaturesAndProbWeightFunction>(forest, &ref_exp); ref_exp /= ref_z; -- cgit v1.2.3