summaryrefslogtreecommitdiff
path: root/decoder
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2012-09-14 06:26:17 -0700
committerKenneth Heafield <github@kheafield.com>2012-09-14 06:26:17 -0700
commit876d2b6cdada8422e8fac40a058ce68bd9c6e631 (patch)
tree689255252a9951b12fbcc1f6ef36b997c9b3f69e /decoder
parent9dd62d50667a6b34198ef6919042f010fd2e5c8e (diff)
Skip top node, just integrate <s> and </s> with the top edges.
Diffstat (limited to 'decoder')
-rw-r--r--decoder/lazy.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/decoder/lazy.cc b/decoder/lazy.cc
index 0f12a1ff..c4138d7b 100644
--- a/decoder/lazy.cc
+++ b/decoder/lazy.cc
@@ -111,18 +111,18 @@ template <class Model> void Lazy<Model>::Search(unsigned int pop_limit, const Hy
search::Config config(weights_, pop_limit);
search::Context<Model> context(config, m_);
- for (unsigned int i = 0; i < hg.nodes_.size(); ++i) {
+ for (unsigned int i = 0; i < hg.nodes_.size() - 1; ++i) {
search::Vertex &out_vertex = out_vertices[i];
const Hypergraph::EdgesVector &down_edges = hg.nodes_[i].in_edges_;
for (unsigned int j = 0; j < down_edges.size(); ++j) {
unsigned int edge_index = down_edges[j];
- ConvertEdge(context, i == hg.nodes_.size() - 1, out_vertices.get(), hg.edges_[edge_index], out_edges[edge_index]);
+ ConvertEdge(context, i == hg.nodes_.size() - 2, out_vertices.get(), hg.edges_[edge_index], out_edges[edge_index]);
out_vertex.Add(out_edges[edge_index]);
}
out_vertex.FinishedAdding();
search::VertexGenerator(context, out_vertex);
}
- search::PartialVertex top = out_vertices[hg.nodes_.size() - 1].RootPartial();
+ search::PartialVertex top = out_vertices[hg.nodes_.size() - 2].RootPartial();
if (top.Empty()) {
std::cout << "NO PATH FOUND";
} else {
@@ -168,6 +168,7 @@ boost::scoped_ptr<LazyBase> AwfulGlobalLazy;
void PassToLazy(const char *model_file, const std::vector<weight_t> &weights, unsigned int pop_limit, const Hypergraph &hg) {
if (!AwfulGlobalLazy.get()) {
+ std::cerr << "Pop limit " << pop_limit << std::endl;
AwfulGlobalLazy.reset(LazyBase::Load(model_file, weights));
}
AwfulGlobalLazy->Search(pop_limit, hg);