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 | 34a148b9882cc983c8292978503849b114fc2983 (patch) | |
tree | 49990cbd520fe1ce1f7493c956ae80207050d519 /decoder/t2s_test.cc | |
parent | 4ceb79cba10ea1162ad5e3582673d4b94a3250ad (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; |