src/Generic/names/IdFDecoder.cpp
/**
 * Decodes from file, prints to file; NOT USED IN SERIF (used in stand-alone decoder). 
 */
Decodes from file, prints to file; NOT USED IN SERIF (used in stand-alone decoder).
Decodes from file prints to file ; NOT USED IN SERIF ( used in stand - alone decoder ) .
void IdFDecoder::decode(const char *input_file, const char *output_file) {
	bool DEBUG = false;
	UTF8OutputStream debugStream;
	if (DEBUG) debugStream.open("debug.idf");
	UTF8OutputStream outStream;
	outStream.open(output_file);	
	boost::scoped_ptr<UTF8InputStream> decodeStream_scoped_ptr(UTF8InputStream::build());
	UTF8InputStream& decodeStream(*decodeStream_scoped_ptr);
	decodeStream.open(input_file);
	UTF8OutputStream sgmlStream;
	sgmlStream.open("bracketed.out");
	IdFSentenceTokens* sentenceTokens = new IdFSentenceTokens();	
	IdFSentenceTheory* sentenceTheory = new IdFSentenceTheory();
	outStream << L"<DOC>\n<DOCID>0</DOCID>\n";
	while (sentenceTokens->readDecodeSentence(decodeStream)) {
		decodeSentence(sentenceTokens, sentenceTheory);
		if (DEBUG)  {
			if (!_model->useLists())
				printTrellis(sentenceTokens, debugStream);
			debugStream << _nameClassTags->to_string(sentenceTokens, sentenceTheory);
			debugStream << L"\n";
			debugStream << _nameClassTags->to_enamex_sgml_string(sentenceTokens, sentenceTheory);
			debugStream << L"\n\n";
		}
		outStream << _nameClassTags->to_enamex_sgml_string(sentenceTokens, sentenceTheory);
		outStream << L"\n\n";
		sgmlStream << _nameClassTags->to_string(sentenceTokens, sentenceTheory);
		sgmlStream << L"\n";
	}
	outStream << L"</DOC>\n";
	decodeStream.close();
	outStream.close();
	sgmlStream.close();
	if (DEBUG) debugStream.close();
}
void IdFDecoder :: decode ( const char * input_file , const char * output_file ) { bool DEBUG = false ; UTF8OutputStream debugStream ; if ( DEBUG ) debugStream . open ( " " ) ; UTF8OutputStream outStream ; outStream . open ( output_file ) ; boost :: scoped_ptr < UTF8InputStream > decodeStream_scoped_ptr ( UTF8InputStream :: build ( ) ) ; UTF8InputStream & decodeStream ( * decodeStream_scoped_ptr ) ; decodeStream . open ( input_file ) ; UTF8OutputStream sgmlStream ; sgmlStream . open ( " " ) ; IdFSentenceTokens * sentenceTokens = new IdFSentenceTokens ( ) ; IdFSentenceTheory * sentenceTheory = new IdFSentenceTheory ( ) ; outStream << L" \n \n " ; while ( sentenceTokens -> readDecodeSentence ( decodeStream ) ) { decodeSentence ( sentenceTokens , sentenceTheory ) ; if ( DEBUG ) { if ( ! _model -> useLists ( ) ) printTrellis ( sentenceTokens , debugStream ) ; debugStream << _nameClassTags -> to_string ( sentenceTokens , sentenceTheory ) ; debugStream << L" \n " ; debugStream << _nameClassTags -> to_enamex_sgml_string ( sentenceTokens , sentenceTheory ) ; debugStream << L" \n \n " ; } outStream << _nameClassTags -> to_enamex_sgml_string ( sentenceTokens , sentenceTheory ) ; outStream << L" \n \n " ; sgmlStream << _nameClassTags -> to_string ( sentenceTokens , sentenceTheory ) ; sgmlStream << L" \n " ; } outStream << L" \n " ; decodeStream . close ( ) ; outStream . close ( ) ; sgmlStream . close ( ) ; if ( DEBUG ) debugStream . close ( ) ; }
Decodes from file, prints to file; NOT USED IN SERIF (used in stand-alone decoder).
Decodes from file prints to file ; NOT USED IN SERIF ( used in stand - alone decoder ) .
// makes my life easier, since I currently only run this
 // stand-alone decoder for MUC decoding. Remove if it annoys you.
 // if you want to debug with lists, you'll need to do it somewhere where
 //   you have access to the translated sentenceTokens array that was actually
 //   decoded. for now, I didn't bother.
 // see above
