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

📄 outprob_style.c

📁 julius version 4.12.about sound recognition.
💻 C
📖 第 1 页 / 共 2 页
字号:
/** * @file   outprob_style.c *  * <JA> * @brief  觉轮の叫蜗澄唯纷换∈妈1パス∷ * * 妈1パスで·腾菇陇步辑今惧のノ〖ドの·掐蜗ベクトルに滦する HMM の * 叫蜗滦眶澄唯を纷换する.  * * トライフォン蝗脱箕は·帽胳柒の不燎茨董巴赂については辑今粕み哈み箕に * 雇胃されて滦炳するトライフォンがすでに充り碰てられているので·ここで * 泼侍な借妄は乖われない. 帽胳黎片および琐萨の不燎は·腾菇陇步辑今惧では * pseudo triphone が充り碰たっており·これらについては·笆布のように * 帽胳粗を不燎茨董巴赂拉を雇胃した纷换が乖われる.  *  -# 帽胳柒不燎: 奶撅奶り纷换する.  *  -# 帽胳の黎片不燎: 木涟帽胳の攫鼠から·pseudo triphone を赖しい *     トライフォンに瓢弄に磊り仑えて纷换.  *  -# 帽胳の琐萨不燎: その pseudo triphone に崔まれる∈票じ焊コンテキストを *     积つトライフォンの∷觉轮礁圭面のすべての觉轮について锑刨を纷换し· *      - "-iwcd1 max" 回年箕は呵络猛 *      - "-iwcd1 avg" 回年箕は士堆猛(default) *      - "-iwcd1 best N" 回年箕は惧疤N改の士堆猛 *     をその觉轮の锑刨として何脱する. (これは outprob_cd() 柒で极瓢弄に联买 *     され纷换される.  *  -# 1不燎からなる帽胳の眷圭: 惧淡を尉数とも雇胃する.  * * 惧淡の借妄を乖うには·腾菇陇步辑今の觉轮ごとに·それぞれが帽胳柒でどの * 疤弥の不燎に掳する觉轮であるかの攫鼠が涩妥である. 腾菇陇步辑今では· * 觉轮ごとに惧淡のどの借妄を乖えば紊いかを AS_Style であらかじめ瘦积している.  * * また·惧淡の 2 と 4 の觉轮では·コンテキストに燃うtriphone恃步を· * 木涟帽胳ID とともに觉轮ごとにフレ〖ム帽疤でキャッシュしている. これにより * 纷换翁の笼络を松ぐ.  * </JA> *  * <EN> * @brief  Compute output probability of a state (1st pass) * * These functions compute the output probability of an input vector * from a state on the lexicon tree. * * When using triphone acoustic model, the cross-word triphone handling is * done here.  The head and tail phoneme of every words has corresponding * pseudo phone set on the tree lexicon, so the actual likelihood computation * will be done as the following: *   -# word-internal: compute as normal. *   -# Word head phone: the correct triphone phone, according to the last *      word information on the passing token, will be dynamically assigned *      to compute the cross-word dependency. *   -# Word tail phone: all the states in the pseudo phone set (they are *      states of triphones that has the same left context as the word end) *      will be computed, and use *       - maximum value if "-iwcd1 max" specified, or *       - average value if "-iwcd1 avg" specified, or *       - average of best N states if "-iwcd1 best N" specified (default: 3) *      the actual pseudo phoneset computation will be done in outprob_cd(). *   -# word with only one state: both of above should be considered. * *  To denote which operation to do for a state, AS_Style ID is assigned *  to each state. * *  The triphone transformation, that will be performed on the state *  of 2 and 4 above, will be cached on the tree lxicon by each state *  per frame, to suppress computation overhead. *    * </EN> *  * @author Akinobu Lee * @date   Mon Aug 22 17:14:26 2005 * * $Revision: 1.4 $ *  *//* * Copyright (c) 1991-2007 Kawahara Lab., Kyoto University * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology * Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology * All rights reserved */#include <julius/julius.h>#ifdef PASS1_IWCD/**  * <JA> * 胳片トライフォン恃步脱キャッシュの介袋步 *  * @param wchmm [i/o] 腾菇陇步辑今 * </JA> * <EN> * Initialize cache for triphone changing on every word head. *  * @param wchmm [i/o] tree lexicon * </EN> * @callgraph * @callergraph */voidoutprob_style_cache_init(WCHMM_INFO *wchmm){  int n;  for(n=0;n<wchmm->n;n++) {    if (wchmm->state[n].out.state == NULL) continue;    if (wchmm->outstyle[n] == AS_RSET) {      (wchmm->state[n].out.rset)->cache.state = NULL;    } else if (wchmm->outstyle[n] == AS_LRSET) {      (wchmm->state[n].out.lrset)->cache.state = NULL;    }  }}/**********************************************************************//**  * <JA> * @brief  帽胳琐萨のトライフォンセット (pseudo phone set) を浮瑚する.  * * 矢恕千急では·称カテゴリごとに迫惟した pseudo phone set を脱いる.  * ここでは帽胳琐脱カテゴリ烧き pseudo phone set を浮瑚する.  *  * @param wchmm [in] 腾菇陇步辑今 * @param hmm [in] 帽胳の琐萨の HMM * @param category [in] 帽胳の掳するカテゴリ *  * @return 澈碰 set が斧つかればそこへのポインタ·あるいは斧つからなければ * NULL を手す.  * </JA> * <EN> * Lookup a word-end triphone set (aka pseudo phone set) with * category id for grammar recognition. *  * @param wchmm [in] word lexicon tree * @param hmm [in] logical HMM of word end phone * @param category [in] belonging category id of the word *  * @return pointer to the corresponding phone set if found, or NULL if * not found. * </EN> * @callgraph * @callergraph */CD_Set *lcdset_lookup_with_category(WCHMM_INFO *wchmm, HMM_Logical *hmm, WORD_ID category){  CD_Set *cd;  leftcenter_name(hmm->name, wchmm->lccbuf);  sprintf(wchmm->lccbuf2, "%s::%04d", wchmm->lccbuf, category);  if (wchmm->lcdset_category_root != NULL) {    cd = aptree_search_data(wchmm->lccbuf2, wchmm->lcdset_category_root);    if (cd == NULL) return NULL;    if (strmatch(wchmm->lccbuf2, cd->name)) {      return cd;    }  }  return NULL;}/**  * <JA> * @brief  帽胳琐脱カテゴリ烧き pseudo phone set を栏喇する.  * * Julian では·ある帽胳に稿鲁材墙な帽胳礁圭は矢恕によって扩嘎される. よって· * 帽胳琐萨から肌に稿鲁しうる帽胳黎片不燎の硷梧も矢恕によって嘎年 * される. そこで·涂えられた辑今惧で·帽胳のカテゴリごとに·稿鲁しうる黎片不燎 * をカテゴリ滦攫鼠から侯喇し·それらをカテゴリ烧き pseudo phone set として * 年盗して帽胳姜眉に脱いることで·Julian における帽胳粗トライフォンの * 夺击疙汗を井さくすることができる.  *  * この phone set の叹涟は奶撅の "a-k" などと佰なり "a-k::38" となる * (眶机はカテゴリID). ここでは·辑今を浮瑚して材墙なすべてのカテゴリ烧き * pseudo phone set を·栏喇する. これは奶撅の pseudo phone set とは侍に * 瘦积され·帽胳琐眉のみで蝗脱される.  *  * @param wchmm [i/o] 腾菇陇步辑今 * @param hmm [in] これから判峡する帽胳の姜眉の侠妄HMM * @param category [in] これから判峡する帽胳の矢恕カテゴリID *  * </JA> * <EN> * @brief  Make a category-indexed context-dependent (pseudo) state set * for word ends. * * In Julian, the word-end pseudo triphone set can be shrinked by using the * category-pair constraint, since the number of possible right-context * phones on the word end will be smaller than all phone.  This shrinking not * only saves computation time but also improves recognition since the * approximated value will be closer to the actual value. *  * For example, if a word belongs to category ID 38 and has a phone "a-k" * at word end, CD_Set "a-k::38" is generated and assigned to the * phone instead of normal CD_Set "a-k".  The "a-k::38" set consists * of triphones whose right context are the beginning phones within * possibly fllowing categories.  These will be separated from the normal * pseudo phone set. *  * @param wchmm [i/o] tree lexicon * @param hmm [in] logical HMM at the end of a word, of which the * category-indexed pseudo state set will be generated. * @param category [in] category ID of the word. *  * </EN> */static voidlcdset_register_with_category(WCHMM_INFO *wchmm, HMM_Logical *hmm, WORD_ID category){  WORD_ID c2, i, w;  HMM_Logical *ltmp;  int cnt_c, cnt_w, cnt_p;  if (lcdset_lookup_with_category(wchmm, hmm, category) == NULL) {    leftcenter_name(hmm->name, wchmm->lccbuf);    sprintf(wchmm->lccbuf2, "%s::%04d", wchmm->lccbuf, category);    if (debug2_flag) {      jlog("DEBUG: category-aware lcdset {%s}...", wchmm->lccbuf2);    }    cnt_c = cnt_w = cnt_p = 0;    /* search for category that can connect after this category */    for(c2=0;c2<wchmm->dfa->term_num;c2++) {      if (! dfa_cp(wchmm->dfa, category, c2)) continue;      /* for each word in the category, register triphone whose right context	 is the beginning phones  */      for(i=0;i<wchmm->dfa->term.wnum[c2];i++) {	w = wchmm->dfa->term.tw[c2][i];	ltmp = get_right_context_HMM(hmm, wchmm->winfo->wseq[w][0]->name, wchmm->hmminfo);	if (ltmp == NULL) {	  ltmp = hmm;	  if (ltmp->is_pseudo) {	    error_missing_right_triphone(hmm, wchmm->winfo->wseq[w][0]->name);	  }	}	if (! ltmp->is_pseudo) {	  if (regist_cdset(&(wchmm->lcdset_category_root), ltmp->body.defined, wchmm->lccbuf2, &(wchmm->lcdset_mroot))) {	    cnt_p++;	  }	}      }      cnt_c++;      cnt_w += wchmm->dfa->term.wnum[c2];    }    if (debug2_flag) {      jlog("%d categories (%d words) can follow, %d HMMs registered\n", cnt_c, cnt_w, cnt_p);    }  }}/**  * <JA> * 链ての帽胳琐脱カテゴリ烧き pseudo phone set を栏喇する.  * 辑今惧のすべての帽胳について·その琐萨に判眷しうるカテゴリ烧き pseudo phone * set を栏喇する∈矢恕千急脱∷.  *  * @param wchmm [i/o] 腾菇陇步辑今攫鼠 * </JA> * <EN> * Generate all possible category-indexed pseudo phone sets for * grammar recognition. *  * @param wchmm [i/o] tree lexicon * </EN> * @callgraph * @callergraph */voidlcdset_register_with_category_all(WCHMM_INFO *wchmm){  WORD_INFO *winfo;  WORD_ID c1, w, w_prev;  int i;  HMM_Logical *ltmp;  winfo = wchmm->winfo;  /* (1) 帽胳姜眉の不燎について */  /*     word end phone */  for(w=0;w<winfo->num;w++) {    ltmp = winfo->wseq[w][winfo->wlen[w]-1];    lcdset_register_with_category(wchmm, ltmp, winfo->wton[w]);  }

⌨️ 快捷键说明

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