diff options
author | Chris Dyer <redpony@gmail.com> | 2009-12-26 13:24:36 -0600 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2009-12-26 13:24:36 -0600 |
commit | 9620eba30344f9f50f3a836cb3a736a9268e76f8 (patch) | |
tree | d213203f9b970f5ed456a419731c98fa81a0d00d /decoder | |
parent | 3f01c8ed777aec011181dc515d9d28aa81e8530b (diff) |
minor fix for fast intersection code
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/hg_intersect.cc | 5 |
1 files changed, 4 insertions, 1 deletions
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<bool> prune(hg->edges_.size(), false); set<int> 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_); } } } |