From 9620eba30344f9f50f3a836cb3a736a9268e76f8 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sat, 26 Dec 2009 13:24:36 -0600 Subject: minor fix for fast intersection code --- decoder/hg_intersect.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/decoder/hg_intersect.cc b/decoder/hg_intersect.cc index e414fc19..e0e70856 100644 --- a/decoder/hg_intersect.cc +++ b/decoder/hg_intersect.cc @@ -50,10 +50,11 @@ struct RuleFilter { }; static bool FastLinearIntersect(const Lattice& target, Hypergraph* hg) { + cerr << " Fast linear-chain intersection...\n"; vector prune(hg->edges_.size(), false); set cov; for (int i = 0; i < prune.size(); ++i) { - const Hypergraph::Edge& edge = hg->edges_[i]; + Hypergraph::Edge& edge = hg->edges_[i]; if (edge.Arity() == 0) { const int trg_index = edge.prev_i_; const WordID trg = target[trg_index][0].label; @@ -61,6 +62,8 @@ static bool FastLinearIntersect(const Lattice& target, Hypergraph* hg) { prune[i] = (edge.rule_->e_[0] != trg); if (!prune[i]) { cov.insert(trg_index); + swap(edge.prev_i_, edge.i_); + swap(edge.prev_j_, edge.j_); } } } -- cgit v1.2.3