summaryrefslogtreecommitdiff
path: root/decoder/aligner.cc
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-25 07:37:59 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-25 07:37:59 +0000
commit410cc38baef914cdc0841a2e8d5a84098e48be49 (patch)
tree5421cec674a71614544ce2705a37e3badc243d70 /decoder/aligner.cc
parentf234fd50ce8a6f8a006b0f770cca5170a55232f9 (diff)
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
Diffstat (limited to 'decoder/aligner.cc')
-rw-r--r--decoder/aligner.cc8
1 files changed, 5 insertions, 3 deletions
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<bool>* 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<prob_t> 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