diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-08 16:44:20 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-08 16:44:20 +0000 |
commit | 337b647baac15609a0a493902d58c473d25d2ed8 (patch) | |
tree | 3827f59a180164878ee217f27f445c259c9e5bab /decoder/hg.cc | |
parent | 7386574a2c70c7ed6e937eb94e3add8023cd7327 (diff) |
--show_features
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@184 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/hg.cc')
-rw-r--r-- | decoder/hg.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/decoder/hg.cc b/decoder/hg.cc index 70831d3d..41b954df 100644 --- a/decoder/hg.cc +++ b/decoder/hg.cc @@ -16,6 +16,17 @@ using namespace std; +Hypergraph::Edge const* Hypergraph::ViterbiGoalEdge() const +{ + Edge const* r=0; + for (unsigned i=0,e=edges_.size();i<e;++i) { + Edge const& e=edges_[i]; + if (e.rule_ && e.rule_->IsGoal() && (!r || e.edge_prob_ > r->edge_prob_)) + r=&e; + } + return r; +} + std::string Hypergraph::stats(std::string const& name) const { ostringstream o; @@ -568,12 +579,13 @@ void Hypergraph::SortInEdgesByEdgeWeights() { } Hypergraph* Hypergraph::CreateViterbiHypergraph(const vector<bool>* edges) const { - vector<const Edge*> vit_edges; + typedef ViterbiPathTraversal::Result VE; + VE vit_edges; if (edges) { assert(edges->size() == edges_.size()); - Viterbi<vector<const Edge*>, ViterbiPathTraversal, prob_t, EdgeSelectEdgeWeightFunction>(*this, &vit_edges, ViterbiPathTraversal(), EdgeSelectEdgeWeightFunction(*edges)); + Viterbi(*this, &vit_edges, ViterbiPathTraversal(), EdgeSelectEdgeWeightFunction(*edges)); } else { - Viterbi<vector<const Edge*>, ViterbiPathTraversal, prob_t, EdgeProb>(*this, &vit_edges); + Viterbi(*this, &vit_edges, ViterbiPathTraversal() ,EdgeProb()); } map<int, int> old2new_node; int num_new_nodes = 0; |