Ejemplo n.º 1
0
/* UpdateWeights: use acc values to calc new estimate of mix weights */
void UpdateWeights(HLink hmm)
{
   int i,s,m,M=0,N;
   float x,occi;
   WALink wa;
   StateElem *se;
   StreamElem *ste;
   MLink q;

   q=FindMacroStruct(&hset,'h',hmm);
   N = hmm->numStates;
   se = hmm->svec+2;
   for (i=2; i<N; i++,se++){
      ste = se->info->pdf+1;
      for (s=1;s<=nStreams; s++,ste++){
         wa = (WALink)ste->hook;
         if (wa != NULL) {
            switch(hsKind){
            case TIEDHS:
               M = hset.tmRecs[s].nMix;
               break;
            case DISCRETEHS:
               M = ste->nMix;
               break;
            }
            occi = wa->occ;
            if (occi>0) {
               for (m=1; m<=M; m++){
                  x = wa->c[m]/occi;
                  if (x>1.0){
                     if (x>1.001)
                        HError(-2490,"UpdateWeights: Model [%s]: mix too big in %d.%d.%d",q->id->name,i,s,m);
                     x = 1.0;
                  }
                  switch (hsKind){
                  case TIEDHS:
                     ste->spdf.tpdf[m] = (x>MINMIX) ? x : 0;
                     break;
                  case DISCRETEHS:
                     ste->spdf.dpdf[m] = (x>MINMIX) ? DProb2Short(x) :DLOGZERO;
                     break;
                  }
               }
               if (mixWeightFloor>0.0){
                  switch (hsKind){
                  case DISCRETEHS:
                     FloorDProbs(ste->spdf.dpdf,M,mixWeightFloor);
                     break;
                  case TIEDHS:
                     FloorTMMixes(ste->spdf.tpdf,M,mixWeightFloor);
                     break;
                  }
               }
            }else
               HError(-2427,"UpdateWeights: Model [%s]: no use of mixtures in %d.%d",q->id->name,i,s);
            ste->hook = NULL;
         }
      }
   }
}
Ejemplo n.º 2
0
static void FloorMixtures(HSetKind hskind, StreamInfo *sti, int M, float floor)
{
  switch (hskind){
  case DISCRETEHS:
    FloorDProbs(sti->spdf.dpdf,M,floor);
    break;
  case TIEDHS:
    FloorTMMixes(sti->spdf.tpdf,M,floor);
    break;
  case PLAINHS:
  case SHAREDHS:
    FloorMixes(sti->spdf.cpdf+1,M,floor);
    break;
  }
}
Ejemplo n.º 3
0
      case 'l':

         maxSpUtt = GetChkedInt(0,0100000,s);

         break;

      case 'E':

         if (NextArg()!=STRINGARG)

            HError(2319,"HERest: parent transform directory expected");

	 xfInfo.usePaXForm = TRUE;

         xfInfo.paXFormDir = GetStrArg(); 

         if (NextArg()==STRINGARG)

	   xfInfo.paXFormExt = GetStrArg(); 

	 if (NextArg() != SWITCHARG)

	   HError(2319,"HERest: cannot have -E as the last option");	  

         break;              

      case 'J':

         if (NextArg()!=STRINGARG)

            HError(2319,"HERest: input transform directory expected");

         AddInXFormDir(&hset,GetStrArg());

         if (NextArg()==STRINGARG) {

            if (xfInfo.inXFormExt == NULL)

               xfInfo.inXFormExt = GetStrArg(); 

            else

               HError(2319,"HERest: only one input transform extension may be specified");

         }

	 if (NextArg() != SWITCHARG)

	   HError(2319,"HERest: cannot have -J as the last option");	  

         break;              

      case 'K':

         if (NextArg()!=STRINGARG)

            HError(2319,"HERest: output transform directory expected");

         xfInfo.outXFormDir = GetStrArg(); 

         if (NextArg()==STRINGARG)

	   xfInfo.outXFormExt = GetStrArg(); 

	 if (NextArg() != SWITCHARG)

	   HError(2319,"HERest: cannot have -K as the last option");	  

         break;              

      case 'z':

         if (NextArg() != STRINGARG)

            HError(2319,"HERest: output TMF file expected");