summaryrefslogtreecommitdiff
path: root/decoder/bottom_up_parser.cc
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2014-04-07 22:56:34 -0400
committerChris Dyer <redpony@gmail.com>2014-04-07 22:56:34 -0400
commit5a8b0aa3245f14a3c049f6f8d34c3a6f37cf070c (patch)
tree2117a9eca8065e9eed33251a4ac12ebc875fae9f /decoder/bottom_up_parser.cc
parent8c77c634836e56c7b9b3400afeac21277f168238 (diff)
track node state for smarter union
Diffstat (limited to 'decoder/bottom_up_parser.cc')
-rw-r--r--decoder/bottom_up_parser.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/decoder/bottom_up_parser.cc b/decoder/bottom_up_parser.cc
index ff4c7a90..b30f1ec6 100644
--- a/decoder/bottom_up_parser.cc
+++ b/decoder/bottom_up_parser.cc
@@ -7,6 +7,8 @@
#include <iostream>
#include <map>
+#include "node_state_hash.h"
+#include "nt_span.h"
#include "hg.h"
#include "array2d.h"
#include "tdict.h"
@@ -356,5 +358,13 @@ bool ExhaustiveBottomUpParser::Parse(const Lattice& input,
kEPS = TD::Convert("*EPS*");
PassiveChart chart(goal_sym_, grammars_, input, forest);
const bool result = chart.Parse();
+
+ if (result) {
+ for (auto& node : forest->nodes_) {
+ Span prev;
+ const Span s = forest->NodeSpan(node.id_, &prev);
+ node.node_hash = cdec::HashNode(node.cat_, s.l, s.r, prev.l, prev.r);
+ }
+ }
return result;
}