src/UntypedCoref/CorefReader.cpp
/* write the contents of corefs out in c_flat format */
write the contents of corefs out in c_flat format
write the contents of corefs out in c_flat format
void CorefReader::writeAllCorefs(const char *file_name, const GrowableArray <Parse *> & parses, UTCoref & corefs) {
   std::ofstream outf;
   outf.open(file_name);
   if (!outf.is_open()) {
	  throw UnexpectedInputException("CorefReader.cpp::writeAllCorefs",
                                     "coref file won't open");
   }
   const GrowableArray< GrowableArray<const SynNode*> * >* entities = corefs.getEntities();
   const GrowableArray< const SynNode* > *entity;
   for (int i = 0 ; i < entities->length() ; i++) {
	  entity = (*entities)[i];
	  for (int j = 0 ; j < entity->length() ; j++) {
		 if (j != 0) {
			outf << " ";
		 }
		 outf << LinkAllMentions::lookupParseNumber(*(*entity)[j], parses) << ":";
		 outf << LinkAllMentions::lookupNodeNumber(*(*entity)[j]);
	  }
	  outf << std::endl;
   }
}
void CorefReader :: writeAllCorefs ( const char * file_name , const GrowableArray < Parse * > & parses , UTCoref & corefs ) { std :: ofstream outf ; outf . open ( file_name ) ; if ( ! outf . is_open ( ) ) { throw UnexpectedInputException ( " " , " " ) ; } const GrowableArray < GrowableArray < const SynNode * > * > * entities = corefs . getEntities ( ) ; const GrowableArray < const SynNode * > * entity ; for ( int i = 0 ; i < entities -> length ( ) ; i ++ ) { entity = ( * entities ) [ i ] ; for ( int j = 0 ; j < entity -> length ( ) ; j ++ ) { if ( j != 0 ) { outf << " " ; } outf << LinkAllMentions :: lookupParseNumber ( * ( * entity ) [ j ] , parses ) << " " ; outf << LinkAllMentions :: lookupNodeNumber ( * ( * entity ) [ j ] ) ; } outf << std :: endl ; } }
write the contents of corefs out in c_flat format
write the contents of corefs out in c_flat format
/* calculate which node in that parse it is */