From 192aa50db953cf4adc4cca34ed1cdfa45511aeeb Mon Sep 17 00:00:00 2001 From: graehl Date: Wed, 11 Aug 2010 03:24:52 +0000 Subject: prettier --nt-span=1 binarized labels git-svn-id: https://ws10smt.googlecode.com/svn/trunk@522 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/cfg.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'decoder') 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::min(),std::numeric_limits::min()); } + WordID CFG::BinName(BinRhs const& b) { - return TD::Convert(lexical_cast(b.first)+"+"+lexical_cast(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) { -- cgit v1.2.3