summaryrefslogtreecommitdiff
path: root/decoder/cfg.cc
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-11 03:24:52 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-11 03:24:52 +0000
commitc606dc576425cd065ff99154603e529b27fe324a (patch)
tree2607850c9df9bff3617f641c02be60803f2e5db5 /decoder/cfg.cc
parentd67c46f72046af3d2a06e5e6c3737a30b21452a1 (diff)
prettier --nt-span=1 binarized labels
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@522 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cfg.cc')
-rwxr-xr-xdecoder/cfg.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/decoder/cfg.cc b/decoder/cfg.cc
index 3ee3a94b..81a17355 100755
--- a/decoder/cfg.cc
+++ b/decoder/cfg.cc
@@ -13,9 +13,16 @@ namespace {
CFG::BinRhs nullrhs(std::numeric_limits<int>::min(),std::numeric_limits<int>::min());
}
+
WordID CFG::BinName(BinRhs const& b)
{
- return TD::Convert(lexical_cast<string>(b.first)+"+"+lexical_cast<string>(b.second));
+ ostringstream o;
+#define BinNameOWORD(w) do { int n=w; if (n>0) o << TD::Convert(n); else { o << 'V' << -n; } } while(0)
+ BinNameOWORD(b.first);
+ o<<'+';
+ BinNameOWORD(b.second);
+#undef BinNameOWORD
+ return TD::Convert(o.str());
}
void CFG::Binarize(CFGBinarize const& b) {