diff options
author | Chris Dyer <redpony@gmail.com> | 2014-04-16 00:36:30 -0400 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2014-04-16 00:36:30 -0400 |
commit | 649b5ffc7c81182ba39d338b11bfe2e9a05544b5 (patch) | |
tree | be5e7cdb36672886fd36d3e8e690ef8adc3907b1 /decoder/t2s_test.cc | |
parent | b09d05952ae0dd7713582ee0d7e46af551c28e61 (diff) |
fix for bug due to using wrong tree traversal
Diffstat (limited to 'decoder/t2s_test.cc')
-rw-r--r-- | decoder/t2s_test.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/decoder/t2s_test.cc b/decoder/t2s_test.cc index 3c46ea89..5ebb2662 100644 --- a/decoder/t2s_test.cc +++ b/decoder/t2s_test.cc @@ -15,8 +15,11 @@ BOOST_AUTO_TEST_CASE(TestTreeFragments) { vector<WordID> aw, bw; cerr << "TREE1: " << tree << endl; cerr << "TREE2: " << tree2 << endl; - for (auto& sym : tree) + for (auto& sym : tree) { + if (cdec::IsLHS(sym)) cerr << "("; + cerr << TD::Convert(sym & cdec::ALL_MASK) << endl; if (cdec::IsTerminal(sym)) aw.push_back(sym); else a.push_back(sym); + } for (auto& sym : tree2) if (cdec::IsTerminal(sym)) bw.push_back(sym); else b.push_back(sym); BOOST_CHECK_EQUAL(a.size(), b.size()); @@ -38,11 +41,12 @@ BOOST_AUTO_TEST_CASE(TestTreeFragments) { if (cdec::IsFrontier(*it)) nts += "*"; } } + cerr << "Truncated: " << nts << endl; BOOST_CHECK_EQUAL(nts, "(S NP* VP*"); nts.clear(); int ntc = 0; - for (cdec::TreeFragment::iterator it = tree.begin(); it != tree.end(); ++it) { + for (auto it = tree.bfs_begin(); it != tree.bfs_end(); ++it) { if (cdec::IsNT(*it)) { if (cdec::IsRHS(*it)) { ++ntc; |