void readHeadInfoCh(ECString& path) { ECString headStrg(path); headStrg += L"headInfo.txt"; ifstream headStrm(headStrg.c_str()); assert(headStrm); ECString term,line,head; list<ECString> listofheads; int listlen; while(getline(headStrm,line)){ istringstream oss(line); oss>>term; oss>>listlen; //wcerr<<term<<listlen<<endl; assert(Term::get(term)); list<list<ECString> > termlist; for (int i=0;i<listlen;i++){ getline(headStrm,line); istringstream osl(line); list<ECString> listofheads; while(osl>>head){ listofheads.push_back(head); } termlist.push_back(listofheads); } hmap[term]=termlist; //wcerr<<term<<endl; //wcerr<<termlist<<endl; } //printHeadInfo(); }
void readHeadInfo(ECString& path) { ECString headStrg(path); headStrg += "headInfo.txt"; ifstream headStrm(headStrg.c_str()); assert(headStrm); ECString next, next2; headStrm >> next; assert(next == "1"); int whichHeads = 1; while(headStrm) { headStrm >> next; if(!headStrm) break; // wul: 这段代码似乎有bug,应该放到insert那段后面 // wul: 否则在格式切换时,喽掉一个数据 if(next == "2") { whichHeads = 2; continue; } headStrm >> next2; if(!headStrm) error("Bad format for headInfo.txt"); next += next2; if(whichHeads == 1) head1s.insert(next); else head2s.insert(next); } }
void readHeadInfoEn(ECString& path) { ECString headStrg(path); headStrg += "headInfo.txt"; ifstream headStrm(headStrg.c_str()); assert(headStrm); ECString next, next2; headStrm >> next; assert(next == "1"); int whichHeads = 1; while(headStrm) { headStrm >> next; if(!headStrm) break; if(next == "2") { whichHeads = 2; continue; } headStrm >> next2; //cerr << "NN " << next << " " << next2 << endl; if(!headStrm) error("Bad format for headInfo.txt"); next += next2; if(whichHeads == 1) head1s.insert(next); else head2s.insert(next); } }