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
commit70114f58324ff60de3d77a42d299e3bcf2c37450 (patch)
tree919088efabf013229c7acb5bd4de4f8045aa89b7 /decoder/hg.cc
parente3aebfc755f7f1ceefe1eafcfff23bee9d08d2f3 (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);
}