⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 outprob_style.c

📁 julius version 4.12.about sound recognition.
💻 C
📖 第 1 页 / 共 2 页
字号:
  /* (2)1不燎帽胳の眷圭, 黎乖しうる帽胳の姜眉不燎を雇胃 */  /*    for one-phoneme word, possible left context should be also considered */  for(w=0;w<winfo->num;w++) {    if (winfo->wlen[w] > 1) continue;    for(c1=0;c1<wchmm->dfa->term_num;c1++) {      if (! dfa_cp(wchmm->dfa, c1, winfo->wton[w])) continue;      for(i=0;i<wchmm->dfa->term.wnum[c1];i++) {	w_prev = wchmm->dfa->term.tw[c1][i];	ltmp = get_left_context_HMM(winfo->wseq[w][0], winfo->wseq[w_prev][winfo->wlen[w_prev]-1]->name, wchmm->hmminfo);	if (ltmp == NULL) continue; /* 1不燎极咳のlcd_setは(1)で侯喇貉 */	if (ltmp->is_pseudo) continue; /* pseudo phone ならlcd_setはいらない */	lcdset_register_with_category(wchmm, ltmp, winfo->wton[w]);      }    }  }}/**  * <JA> * カテゴリ烧き pseudo phone set をすべて久殿する. この簇眶は Julian で矢恕が * 恃构された狠に·カテゴリ烧き pseudo phone set を浩菇蜜するのに脱いられる.  *  * @param wchmm [i/o] 腾菇陇步辑今 * </JA> * <EN> * Remove all the registered category-indexed pseudo state sets. * This function will be called when a grammar is changed to re-build the * state sets. *  * @param wchmm [i/o] lexicon tree information * </EN> * @callgraph * @callergraph */voidlcdset_remove_with_category_all(WCHMM_INFO *wchmm){  free_cdset(&(wchmm->lcdset_category_root), &(wchmm->lcdset_mroot));}#endif /* PASS1_IWCD *//**  * <JA> * 腾菇陇步辑今惧の觉轮の叫蜗澄唯を纷换する.  *  * @param wchmm [in] 腾菇陇步辑今攫鼠 * @param node [in] ノ〖ド戎规 * @param last_wid [in] 木涟帽胳∈帽胳黎片のトライフォン纷换に脱いる∷ * @param t [in] 箕粗フレ〖ム * @param param [in] 泼魔翁パラメ〖タ菇陇挛 (@a t 戎誊のベクトルについて纷换する) *  * @return 叫蜗澄唯の滦眶猛を手す.  * </JA> * <EN> * Calculate output probability on a tree lexion node.  This function * calculates log output probability of an input vector on time frame @a t * in input paramter @a param at a node on tree lexicon. *  * @param wchmm [in] tree lexicon structure * @param node [in] node ID to compute the output probability * @param last_wid [in] word ID of last word hypothesis (used when the node is * within the word beginning phone and triphone is used. * @param t [in] time frame of input vector in @a param to compute. * @param param [in] input parameter structure *  * @return the computed log probability. * </EN> * @callgraph * @callergraph */LOGPROBoutprob_style(WCHMM_INFO *wchmm, int node, int last_wid, int t, HTK_Param *param){  char rbuf[MAX_HMMNAME_LEN]; ///< Local workarea for HMM name conversion#ifndef PASS1_IWCD    /* if cross-word triphone handling is disabled, we simply compute the     output prob of the state */  return(outprob_state(wchmm->hmmwrk, t, wchmm->state[node].out, param));  #else  /* PASS1_IWCD */  /* state type and context cache is considered */  HMM_Logical *ohmm, *rhmm;  RC_INFO *rset;  LRC_INFO *lrset;  CD_Set *lcd;  WORD_INFO *winfo = wchmm->winfo;  HTK_HMM_INFO *hmminfo = wchmm->hmminfo;  /* the actual computation is different according to their context dependency     handling */  switch(wchmm->outstyle[node]) {  case AS_STATE:    /* normal state (word-internal or context-independent )*/    /* compute as usual */    return(outprob_state(wchmm->hmmwrk, t, wchmm->state[node].out.state, param));  case AS_LSET:    /* node in word end phone */    /* compute approximated value using the state set in pseudo phone */    return(outprob_cd(wchmm->hmmwrk, t, wchmm->state[node].out.lset, param));  case AS_RSET:    /* note in the beginning phone of word */    /* depends on the last word hypothesis to compute the actual triphone */    rset = wchmm->state[node].out.rset;    /* consult cache */    if (rset->cache.state == NULL || rset->lastwid_cache != last_wid) {      /* cache miss...calculate */      /* rset contains either defined biphone or pseudo biphone */      if (last_wid != WORD_INVALID) {	/* lookup triphone with left-context (= last phoneme) */	if ((ohmm = get_left_context_HMM(rset->hmm, (winfo->wseq[last_wid][winfo->wlen[last_wid]-1])->name, hmminfo)) != NULL) {	  rhmm = ohmm;	} else {	  /* if triphone not found, try to use the bi-phone itself */	  rhmm = rset->hmm;	  /* If the bi-phone is explicitly specified in hmmdefs/HMMList,	     use it.  if both triphone and biphone not found in user-given	     hmmdefs/HMMList, use "pseudo" phone, as same as the end of word */	  if (debug2_flag) {	    if (rhmm->is_pseudo) {	    error_missing_left_triphone(rset->hmm, (winfo->wseq[last_wid][winfo->wlen[last_wid]-1])->name);	    }	  }	}      } else {	/* if last word is WORD_INVALID try to use the bi-phone itself */	rhmm = rset->hmm;	/* If the bi-phone is explicitly specified in hmmdefs/HMMList,	   use it.  if not, use "pseudo" phone, as same as the end of word */	if (debug2_flag) {	  if (rhmm->is_pseudo) {	    error_missing_left_triphone(rset->hmm, (winfo->wseq[last_wid][winfo->wlen[last_wid]-1])->name);	  }	}      }      /* rhmm may be a pseudo phone */      /* store to cache */      if (rhmm->is_pseudo) {	rset->last_is_lset  = TRUE;	rset->cache.lset    = &(rhmm->body.pseudo->stateset[rset->state_loc]);      } else {	rset->last_is_lset  = FALSE;	rset->cache.state   = rhmm->body.defined->s[rset->state_loc];      }      rset->lastwid_cache = last_wid;    }    /* calculate outprob and return */    if (rset->last_is_lset) {      return(outprob_cd(wchmm->hmmwrk, t, rset->cache.lset, param));    } else {      return(outprob_state(wchmm->hmmwrk, t, rset->cache.state, param));    }  case AS_LRSET:    /* node in word with only one phoneme --- both beginning and end */    lrset = wchmm->state[node].out.lrset;    if (lrset->cache.state == NULL || lrset->lastwid_cache != last_wid) {      /* cache miss...calculate */      rhmm = lrset->hmm;      /* lookup cdset for given left context (= last phoneme) */      strcpy(rbuf, rhmm->name);      if (last_wid != WORD_INVALID) {	add_left_context(rbuf, (winfo->wseq[last_wid][winfo->wlen[last_wid]-1])->name);      }      if (wchmm->category_tree) {#ifdef USE_OLD_IWCD	lcd = lcdset_lookup_by_hmmname(hmminfo, rbuf);#else	/* use category-indexed cdset */	if (last_wid != WORD_INVALID &&	    (ohmm = get_left_context_HMM(rhmm, (winfo->wseq[last_wid][winfo->wlen[last_wid]-1])->name, hmminfo)) != NULL) {	  lcd = lcdset_lookup_with_category(wchmm, ohmm, lrset->category);	} else {	  lcd = lcdset_lookup_with_category(wchmm, rhmm, lrset->category);	}#endif      } else {	lcd = lcdset_lookup_by_hmmname(hmminfo, rbuf);      }      if (lcd != NULL) {	/* found, set to cache */	lrset->last_is_lset  = TRUE;        lrset->cache.lset    = &(lcd->stateset[lrset->state_loc]);        lrset->lastwid_cache = last_wid;      } else {	/* no relating lcdset found, falling to normal state */	if (rhmm->is_pseudo) {	  lrset->last_is_lset  = TRUE;	  lrset->cache.lset    = &(rhmm->body.pseudo->stateset[lrset->state_loc]);	  lrset->lastwid_cache = last_wid;	} else {	  lrset->last_is_lset  = FALSE;	  lrset->cache.state   = rhmm->body.defined->s[lrset->state_loc];	  lrset->lastwid_cache = last_wid;	}      }      /*printf("[%s->%s]\n", lrset->hmm->name, rhmm->name);*/    }    /* calculate outprob and return */    if (lrset->last_is_lset) {      return(outprob_cd(wchmm->hmmwrk, t, lrset->cache.lset, param));    } else {      return(outprob_state(wchmm->hmmwrk, t, lrset->cache.state, param));    }  default:    /* should not happen */    j_internal_error("outprob_style: no outprob style??\n");    return(LOG_ZERO);  }#endif  /* PASS1_IWCD */}/**  * <JA> * @brief  トライフォンエラ〖メッセ〖ジ¨宝コンテキスト脱 *  * 回年した宝コンテキストを积つトライフォンが * 斧つからなかった眷圭にエラ〖メッセ〖ジを叫蜗する簇眶.  *  * @param base [in] ベ〖スのトライフォン * @param rc_name [in] 宝コンテキストの不燎叹 * </JA> * <EN> * @brief  Triphone error message for right context. *  * Output error message when a triphone with the specified right context is * not defined. *  * @param base [in] base triphone * @param rc_name [in] name of right context phone  * </EN> * @callgraph * @callergraph */voiderror_missing_right_triphone(HMM_Logical *base, char *rc_name){  char rbuf[MAX_HMMNAME_LEN]; ///< Local workarea for HMM name conversion  /* only output message */  strcpy(rbuf, base->name);  add_right_context(rbuf, rc_name);  jlog("WARNING: IW-triphone for word end \"%s\" not found, fallback to pseudo {%s}\n", rbuf, base->name);}/**  * <JA> * @brief  トライフォンエラ〖メッセ〖ジ¨焊コンテキスト脱 *  * 回年した焊コンテキストを积つトライフォンが * 斧つからなかった眷圭にエラ〖メッセ〖ジを叫蜗する簇眶.  *  * @param base [in] ベ〖スのトライフォン * @param lc_name [in] 焊コンテキストの不燎叹 * </JA> * <EN> * @brief  Triphone error message for left context. *  * Output error message when a triphone with the specified right context is * not defined. *  * @param base [in] base triphone * @param lc_name [in] name of left context phone  * </EN> * @callgraph * @callergraph */voiderror_missing_left_triphone(HMM_Logical *base, char *lc_name){  char rbuf[MAX_HMMNAME_LEN]; ///< Local workarea for HMM name conversion  /* only output message */  strcpy(rbuf, base->name);  add_left_context(rbuf, lc_name);  jlog("WARNING: IW-triphone for word head \"%s\" not found, fallback to pseudo {%s}\n", rbuf, base->name);}/* end of file */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -