From 083e28a2694df51a4631d81347c45f57a5182560 Mon Sep 17 00:00:00 2001 From: redpony Date: Wed, 1 Dec 2010 04:49:31 +0000 Subject: justify git-svn-id: https://ws10smt.googlecode.com/svn/trunk@738 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/aligner.cc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'decoder/aligner.cc') diff --git a/decoder/aligner.cc b/decoder/aligner.cc index 3f0c7347..43d4e0ce 100644 --- a/decoder/aligner.cc +++ b/decoder/aligner.cc @@ -1,12 +1,14 @@ #include "aligner.h" +#include +#include + #include "array2d.h" #include "hg.h" #include "sentence_metadata.h" #include "inside_outside.h" #include "viterbi.h" #include "alignment_pharaoh.h" -#include using namespace std; @@ -152,6 +154,22 @@ struct TransitionEventWeightFunction { } }; +inline void WriteProbGrid(const Array2D& m, ostream* pos) { + ostream& os = *pos; + char b[1024]; + for (int i=0; i(m(i,j))); + os << '\t' << b; + } + } + os << '\n'; + } +} + // this code is rather complicated since it must deal with generating alignments // when lattices are specified as input as well as with models that do not generate // full sentence pairs (like lexical alignment models) @@ -245,7 +263,7 @@ void AlignerTools::WriteAlignment(const Lattice& src_lattice, } if (out == &cout) { // TODO need to do some sort of verbose flag - cerr << align << endl; + WriteProbGrid(align, &cerr); cerr << grid << endl; } (*out) << TD::GetString(src_sent) << " ||| " << TD::GetString(trg_sent) << " ||| "; -- cgit v1.2.3