summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-09-20 02:24:26 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-09-20 02:24:26 +0000
commit9392ebeb48efca4d9a8279eea62c0ffcb8fbbed4 (patch)
treeda03060da144b0cf7490657b3cac73e6fa128876
parent43cddf3ade9f7f18f72324e244ef23385d3166af (diff)
add notifications
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@651 ec762483-ff6d-05da-a07a-a48fb63a330f
-rw-r--r--decoder/decoder.cc5
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;
}