src/Generic/names/IdFDecoder.cpp
/**
 * FOR DEBUGGING -- prints trellis of alpha probs and back pointers to stream
 */
FOR DEBUGGING -- prints trellis of alpha probs and back pointers to stream
FOR DEBUGGING -- prints trellis of alpha probs and back pointers to stream
void IdFDecoder::printTrellis(IdFSentenceTokens* sentenceTokens, UTF8OutputStream &stream) {
	wchar_t buffer[100];
	stream << L"                    ";
	for (int sent_index = 0; sent_index < sentenceTokens->getLength(); sent_index++) {
		swprintf(buffer, 100, L"\t(%52ls) ", sentenceTokens->getWord(sent_index).to_string());
		stream << buffer;
	}
	stream << L"\n";
	stream << L"                    ";
	for (int s_index = 0; s_index < sentenceTokens->getLength(); s_index++) {
		stream <<"\t";
		Symbol this_word = sentenceTokens->getWord(s_index);
		if (!_model->wordIsInVocab(this_word))
			swprintf(buffer, 100, L"%30ls ", this_word.to_string());
		else 
			swprintf(buffer, 100, L"%30ls ", L"***");
		stream << buffer;
	}
	stream << L"\n";
	for (int tag = 0; tag < _nameClassTags->getNumRegularTags(); tag++) {
		swprintf(buffer, 100, L"%10.20ls ", _nameClassTags->getTagSymbol(tag).to_string());
		stream << buffer;
		for (int sent_index = 0; sent_index < sentenceTokens->getLength(); sent_index++) {
			stream <<"\t";
			swprintf(buffer, 100, L"%0.5g = w%0.5g + t%0.5g (%2d) ", 
				_alphaProbs[tag][sent_index], 
				_backPointers[tag][sent_index]);
			stream << buffer;
		}
		stream << L"\n";
	}
	stream << L"\n";
}
void IdFDecoder :: printTrellis ( IdFSentenceTokens * sentenceTokens , UTF8OutputStream & stream ) { wchar_t buffer [ 100 ] ; stream << L" " ; for ( int sent_index = 0 ; sent_index < sentenceTokens -> getLength ( ) ; sent_index ++ ) { swprintf ( buffer , 100 , L" \t " , sentenceTokens -> getWord ( sent_index ) . to_string ( ) ) ; stream << buffer ; } stream << L" \n " ; stream << L" " ; for ( int s_index = 0 ; s_index < sentenceTokens -> getLength ( ) ; s_index ++ ) { stream << " \t " ; Symbol this_word = sentenceTokens -> getWord ( s_index ) ; if ( ! _model -> wordIsInVocab ( this_word ) ) swprintf ( buffer , 100 , L" " , this_word . to_string ( ) ) ; else swprintf ( buffer , 100 , L" " , L" " ) ; stream << buffer ; } stream << L" \n " ; for ( int tag = 0 ; tag < _nameClassTags -> getNumRegularTags ( ) ; tag ++ ) { swprintf ( buffer , 100 , L" " , _nameClassTags -> getTagSymbol ( tag ) . to_string ( ) ) ; stream << buffer ; for ( int sent_index = 0 ; sent_index < sentenceTokens -> getLength ( ) ; sent_index ++ ) { stream << " \t " ; swprintf ( buffer , 100 , L" " , _alphaProbs [ tag ] [ sent_index ] , _backPointers [ tag ] [ sent_index ] ) ; stream << buffer ; } stream << L" \n " ; } stream << L" \n " ; }
FOR DEBUGGING -- prints trellis of alpha probs and back pointers to stream
FOR DEBUGGING -- prints trellis of alpha probs and back pointers to stream
//Fill the debugging matrix
 /*
				_breakdownMatrix[tag][sent_index].wordProb,
				_breakdownMatrix[tag][sent_index].tagProb,
				*/