diff options
author | redpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-09-20 02:24:26 +0000 |
---|---|---|
committer | redpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-09-20 02:24:26 +0000 |
commit | cf36f7d66ad19331da109f5a81ea3ea5844deb1c (patch) | |
tree | c1741255227fcfd17122ae5b079d3f0224ec1fe3 | |
parent | a86de27dbab3dc803ac31ff46e1d3b2aaf40dc1a (diff) |
add notifications
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@651 ec762483-ff6d-05da-a07a-a48fb63a330f
-rw-r--r-- | decoder/decoder.cc | 5 |
1 files changed, 5 insertions, 0 deletions
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<double>& 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<prob_t, EdgeProb>(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; } |