summaryrefslogtreecommitdiff
path: root/decoder/hg.cc
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-01 23:08:34 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-01 23:08:34 +0000
commitf6994142f7b6a874e8fb62fa279816d8d6e9eab1 (patch)
tree5f0b3d115b66dc610aaa5cba2cef1d0944c49e37 /decoder/hg.cc
parentc909f7c76d07886a67f511a11baa510fd3c5fb3f (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/hg.cc')
-rw-r--r--decoder/hg.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/decoder/hg.cc b/decoder/hg.cc
index 025feb7c..4da0beb3 100644
--- a/decoder/hg.cc
+++ b/decoder/hg.cc
@@ -6,6 +6,7 @@
#include <set>
#include <map>
#include <iostream>
+#include <sstream>
#include "viterbi.h"
#include "inside_outside.h"
@@ -13,6 +14,15 @@
using namespace std;
+std::string Hypergraph::stats(std::string const& name) const
+{
+ ostringstream o;
+ o<<name<<" (nodes/edges): "<<nodes_.size()<<'/'<<edges_.size()<<endl;
+ o<<name<<" (paths): "<<NumberOfPaths()<<endl;
+ return o.str();
+}
+
+
double Hypergraph::NumberOfPaths() const {
return Inside<double, TransitionCountWeightFunction>(*this);
}