From fcdad555eff58aec43107056393e707c473eb0a4 Mon Sep 17 00:00:00 2001 From: graehl Date: Sun, 25 Jul 2010 07:37:59 +0000 Subject: more comprehensible (but untested) edge/node filtering, awesome per-edge debugging streams git-svn-id: https://ws10smt.googlecode.com/svn/trunk@407 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/aligner.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'decoder/aligner.cc') diff --git a/decoder/aligner.cc b/decoder/aligner.cc index d498c22c..b089f52e 100644 --- a/decoder/aligner.cc +++ b/decoder/aligner.cc @@ -231,6 +231,7 @@ void AlignerTools::WriteAlignment(const Lattice& src_lattice, const vector* edges) { bool fix_up_src_spans = false; const Hypergraph* g = &in_g; + HypergraphP new_hg; if (!src_lattice.IsSentence() || !trg_lattice.IsSentence()) { if (map_instead_of_viterbi) { @@ -240,10 +241,10 @@ void AlignerTools::WriteAlignment(const Lattice& src_lattice, fix_up_src_spans = !src_lattice.IsSentence(); } if (!map_instead_of_viterbi || edges) { - Hypergraph* new_hg = in_g.CreateViterbiHypergraph(edges); + new_hg = in_g.CreateViterbiHypergraph(edges); for (int i = 0; i < new_hg->edges_.size(); ++i) new_hg->edges_[i].edge_prob_ = prob_t::One(); - g = new_hg; + g = new_hg.get(); } vector edge_posteriors(g->edges_.size(), prob_t::Zero()); @@ -293,7 +294,8 @@ void AlignerTools::WriteAlignment(const Lattice& src_lattice, } } } - if (g != &in_g) { delete g; g = NULL; } + new_hg.reset(); + //if (g != &in_g) { g.reset(); } prob_t threshold(0.9); const bool use_soft_threshold = true; // TODO configure -- cgit v1.2.3