summaryrefslogtreecommitdiff
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
commit903fb23675b894f6d3cb2786c134f03313c5d474 (patch)
tree60d997acd0f4416a766431a10aad76a0cc296d77
parentc32c03c1e0bb1e0407c90032cd3bf41f8bd61251 (diff)
Skip top node, just integrate <s> and </s> with the top edges.
-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);