diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-01 23:08:34 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-01 23:08:34 +0000 |
commit | f6994142f7b6a874e8fb62fa279816d8d6e9eab1 (patch) | |
tree | 5f0b3d115b66dc610aaa5cba2cef1d0944c49e37 /decoder/viterbi.cc | |
parent | c909f7c76d07886a67f511a11baa510fd3c5fb3f (diff) |
factor forest stats (show size post pruning, and portion kept) and cdec --scale_prune_srclen
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@96 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/viterbi.cc')
-rw-r--r-- | decoder/viterbi.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/decoder/viterbi.cc b/decoder/viterbi.cc index 582dc5b2..7f52d08c 100644 --- a/decoder/viterbi.cc +++ b/decoder/viterbi.cc @@ -6,6 +6,23 @@ using namespace std; +std::string viterbi_stats(Hypergraph const& hg, std::string const& name, bool estring, bool etree) +{ + ostringstream o; + o << hg.stats(name); + if (estring) { + vector<WordID> trans; + const prob_t vs = ViterbiESentence(hg, &trans); + o<<name<<" Viterbi: "<<log(vs)<<endl; + o<<name<<" Viterbi: "<<TD::GetString(trans)<<endl; + } + if (etree) { + o<<name<<" tree: "<<ViterbiETree(hg)<<endl; + } + return o.str(); +} + + string ViterbiETree(const Hypergraph& hg) { vector<WordID> tmp; const prob_t p = Viterbi<vector<WordID>, ETreeTraversal, prob_t, EdgeProb>(hg, &tmp); |