--- htk_3.4.1/HTKTools/HERest.c 2009-11-22 12:12:24.339000000 +0000 +++ htk_3.4.2/HTKTools/HERest.c 2009-11-28 13:32:10.353000000 +0000 @@ -100,7 +100,6 @@ static char * mmfFn = NULL; /* output MMF file, if any */ static int trace = 0; /* Trace level */ static Boolean saveBinary = FALSE; /* save output in binary */ -static Boolean ldBinary = TRUE; /* load/dump in binary */ static FileFormat dff=UNDEFF; /* data file format */ static FileFormat lff=UNDEFF; /* label file format */ static int updateMode = UPMODE_UPDATE; /* dump summed accs, update models or do both? */ @@ -158,7 +157,6 @@ if (GetConfInt(cParm,nParm,"TRACE",&i)) trace = i; if (GetConfFlt(cParm,nParm,"VARFLOORPERCENTILE",&f)) varFloorPercent = f; if (GetConfBool(cParm,nParm,"SAVEBINARY",&b)) saveBinary = b; - if (GetConfBool(cParm,nParm,"BINARYACCFORMAT",&b)) ldBinary = b; /* 2-model reestimation alignment model set */ if (GetConfStr(cParm,nParm,"ALIGNMODELMMF",buf)) { strcpy(al_hmmMMF,buf); al_hmmUsed = TRUE; @@ -308,6 +305,7 @@ float tmpFlt; int tmpInt; int numUtt,spUtt=0; + Boolean ldBinary=TRUE;/*replaces global in <= V3.4.1 HEREST variable; default value is the same as in HTRAIN*/ void Initialise(FBInfo *fbInfo, MemHeap *x, HMMSet *hset, char *hmmListFn); void DoForwardBackward(FBInfo *fbInfo, UttInfo *utt, char *datafn, char *datafn2); @@ -322,7 +320,7 @@ InitLabel(); InitModel(); if(InitParm()avg correctness) */ - ReadInt(&src,&i,1,TRUE); /* i the number of timeperiods (MPE->num correct words).*/ + ReadFloat(&src,&x,1,ldBinary); /*x is the average log prob (MPE->avg correctness) */ + ReadInt(&src,&i,1,ldBinary); /* i the number of timeperiods (MPE->num correct words).*/ CloseSource( &src ); if(!MPE){ totalPr1 += x*i; totalT += i; } @@ -639,8 +640,8 @@ if(!strstr(accfn,".acc.2")) HError(-1, "Expecting a *.acc.2 file, got %s", accfn); src=LoadAccsParallel(&hset, accfn, uFlagsAccs, 1); - ReadFloat(&src,&x,1,TRUE); /*!x must be the average log prob*/ - ReadInt(&src,&i,1,TRUE); /*!and i the number of timeperiods.*/ + ReadFloat(&src,&x,1,ldBinary); /*!x must be the average log prob*/ + ReadInt(&src,&i,1,ldBinary); /*!and i the number of timeperiods.*/ CloseSource( &src ); /*pr2 contains the MMI stats.*/ @@ -654,8 +655,8 @@ if(!strstr(accfn, ".3")) HError(1, "Error, expecting a HDR?.acc.3 file, got %s", accfn); src=LoadAccsParallel(&hset, accfn, uFlagsAccs, 2/*third position(1st==0) of hset*/); /*src is the still-open file.*/ - ReadFloat(&src,&x,1,TRUE); /*!x must be the average log prob*/ - ReadInt(&src,&i,1,TRUE); /*!and i the number of timeperiods.*/ + ReadFloat(&src,&x,1,ldBinary); /*!x must be the average log prob*/ + ReadInt(&src,&i,1,ldBinary); /*!and i the number of timeperiods.*/ CloseSource( &src ); totalPr1 += x*i; totalT += i; @@ -668,8 +669,8 @@ if(!strstr(accfn, ".4")) HError(1, "Error, expecting a HDR?.acc.4 file, got %s", accfn); src=LoadAccsParallel(&hset, accfn, uFlagsAccs, 3/*fourth position(1st==0) of hset*/); /*src is the still-open file.*/ - ReadFloat(&src,&x,1,TRUE); /*!x must be the average log prob*/ - ReadInt(&src,&i,1,TRUE); /*!and i the number of timeperiods.*/ + ReadFloat(&src,&x,1,ldBinary); /*!x must be the average log prob*/ + ReadInt(&src,&i,1,ldBinary); /*!and i the number of timeperiods.*/ CloseSource( &src ); /*pr3 contains the MMI stats.*/ @@ -832,12 +833,12 @@ f=DumpAccsParallel(&hset,newFn,parMode, uFlagsAccs, 0); if(MPE){ /* .1 acc contains the MPE crit at the end. */ x = TotalCorr/TotalNWords; - WriteFloat(f, &x, 1, TRUE); - WriteInt(f, &TotalNWords, 1, TRUE); + WriteFloat(f, &x, 1, ldBinary); + WriteInt(f, &TotalNWords, 1, ldBinary); } else { x = totalPr1/totalT; - WriteFloat(f,&x,1,TRUE); - WriteInt(f,&totalT,1,TRUE); + WriteFloat(f,&x,1,ldBinary); + WriteInt(f,&totalT,1,ldBinary); } fclose( f ); @@ -845,8 +846,8 @@ MakeFN("HDR$.acc.2",newDir,NULL,newFn); f=DumpAccsParallel(&hset,newFn,parMode, uFlagsAccs, 1); x = totalPr2/totalT; /*MMI den prob in either MMI or MPE case.*/ - WriteFloat(f,&x,1,TRUE); - WriteInt(f,&totalT,1,TRUE); + WriteFloat(f,&x,1,ldBinary); + WriteInt(f,&totalT,1,ldBinary); fclose( f ); } @@ -855,8 +856,8 @@ f=DumpAccsParallel(&hset,newFn,parMode, uFlagsAccs,2/*3rd position (numbered 2) on hset1(during alignment);*/); x = totalPr1/totalT; /* This is where the MLE prob is stored. */ - WriteFloat(f, &x, 1, TRUE); - WriteInt(f, &totalT, 1, TRUE); + WriteFloat(f, &x, 1, ldBinary); + WriteInt(f, &totalT, 1, ldBinary); fclose( f ); } @@ -865,8 +866,8 @@ f=DumpAccsParallel(&hset,newFn,parMode, uFlagsAccs, 3/*4th position (numbered 3) on hset1(during alignment);*/); x = totalPr3/totalT; /* This is where the MMI den prob is stored. */ - WriteFloat(f, &x, 1, TRUE); - WriteInt(f, &totalT, 1, TRUE); + WriteFloat(f, &x, 1, ldBinary); + WriteInt(f, &totalT, 1, ldBinary); fclose( f ); }