summaryrefslogtreecommitdiff
path: root/decoder/hg.cc
diff options
context:
space:
mode:
Diffstat (limited to 'decoder/hg.cc')
-rw-r--r--decoder/hg.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/decoder/hg.cc b/decoder/hg.cc
index f0238fe3..47924d99 100644
--- a/decoder/hg.cc
+++ b/decoder/hg.cc
@@ -147,10 +147,21 @@ struct vpusher : public vector<TropicalValue> {
};
}
-void Hypergraph::PushViterbiWeightsToGoal(int fid) {
+prob_t Hypergraph::ComputeNodeViterbi(NodeProbs *np) const
+{
+ return Inside(*this,
+ reinterpret_cast<std::vector<TropicalValue> *>(np),
+ ViterbiWeightFunction()).v_;
+}
+
+
+// save pushed weight ot some fid if we want. 0 = don't care
+prob_t Hypergraph::PushViterbiWeightsToGoal(int fid) {
vpusher vi(fid);
- Inside(*this,&vi,ViterbiWeightFunction());
+ NodeProbs np;
+ prob_t r=ComputeNodeViterbi(&np);
visit_edges(vi);
+ return r;
}