From cf36f7d66ad19331da109f5a81ea3ea5844deb1c Mon Sep 17 00:00:00 2001 From: redpony Date: Mon, 20 Sep 2010 02:24:26 +0000 Subject: add notifications git-svn-id: https://ws10smt.googlecode.com/svn/trunk@651 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/decoder.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/decoder/decoder.cc b/decoder/decoder.cc index f90e6bc0..2c53ff62 100644 --- a/decoder/decoder.cc +++ b/decoder/decoder.cc @@ -142,6 +142,7 @@ struct DecoderImpl { ~DecoderImpl(); bool Decode(const string& input, DecoderObserver*); void SetWeights(const vector& weights) { + feature_weights = weights; } void forest_stats(Hypergraph &forest,string name,bool show_tree,bool show_features,WeightVector *weights=0,bool show_deriv=false) { @@ -745,6 +746,7 @@ bool DecoderImpl::Decode(const string& input, DecoderObserver* o) { //Add 1-best translation (trans) to psuedo-doc vectors oracle.IncludeLastScore(&cerr); } + o->NotifyTranslationForest(smeta, &forest); // TODO I think this should probably be handled by an Observer if (conf.count("forest_output") && !has_ref) { @@ -824,6 +826,7 @@ bool DecoderImpl::Decode(const string& input, DecoderObserver* o) { const prob_t z = Inside(forest); cerr << " Contst. partition log(Z): " << log(z) << endl; } + o->NotifyAlignmentForest(smeta, &forest); if (conf.count("forest_output")) { ForestWriter writer(str("forest_output",conf), sent_id); if (FileExists(writer.fname_)) { @@ -889,12 +892,14 @@ bool DecoderImpl::Decode(const string& input, DecoderObserver* o) { } if (conf.count("graphviz")) forest.PrintGraphviz(); } else { + o->NotifyAlignmentFailure(smeta); cerr << " REFERENCE UNREACHABLE.\n"; if (write_gradient) { cout << endl << flush; } } } + o->NotifyDecodingComplete(smeta); return true; } -- cgit v1.2.3