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

📄 word_align.c

📁 julius version 4.12.about sound recognition.
💻 C
📖 第 1 页 / 共 2 页
字号:
    align->w = (WORD_ID *)mymalloc(sizeof(WORD_ID) * rlen);    for(i=0;i<rlen;i++) {      align->w[i] = words[id_seq[i]];    }    break;  case PER_PHONEME:    align->ph = (HMM_Logical **)mymalloc(sizeof(HMM_Logical *) * rlen);    for(i=0;i<rlen;i++) {      align->ph[i] = phones[id_seq[i]];    }    break;  case PER_STATE:    align->ph = (HMM_Logical **)mymalloc(sizeof(HMM_Logical *) * rlen);    align->loc = (short *)mymalloc(sizeof(short) * rlen);    if (hmminfo->multipath) align->is_iwsp = (boolean *)mymalloc(sizeof(boolean) * rlen);    for(i=0;i<rlen;i++) {      align->ph[i]  = phones[phloc[id_seq[i]]];      if (hmminfo->multipath) {	if (enable_iwsp && stloc[id_seq[i]] > end_num) {	  align->loc[i] = stloc[id_seq[i]] - end_num;	  align->is_iwsp[i] = TRUE;	} else {	  align->loc[i] = stloc[id_seq[i]];	  align->is_iwsp[i] = FALSE;	}      } else {	align->loc[i] = stloc[id_seq[i]];      }    }    break;  }  align->allscore = allscore;  free_hmm(shmm);  free(id_seq);  free(phones);  if (has_sp) free(has_sp);  free(end_score);  free(end_frame);  free(end_state);  switch(per_what) {  case PER_WORD:    free(phloc);    break;  case PER_PHONEME:    break;  case PER_STATE:    free(phloc);    free(stloc);  }  }/**  * <JA> * 帽胳ごとの forced alignment を乖う.  *  * @param words [in] 帽胳误 * @param wnum [in] @a words の帽胳眶 * @param param [in] 掐蜗泼魔ベクトル误 * @param align [out] アラインメント冯蔡を呈羌するSentence菇陇挛 * @param r [i/o] 千急借妄インスタンス * </JA> * <EN> * Do forced alignment per word for the given word sequence. *  * @param words [in] word sequence * @param wnum [in] length of @a words * @param param [in] input parameter vectors * @param align [out] Sentence data area to store the alignment result * @param r [i/o] recognition process instance * </EN> * @callgraph * @callergraph */voidword_align(WORD_ID *words, short wnum, HTK_Param *param, SentenceAlign *align, RecogProcess *r){  do_align(words, wnum, param, PER_WORD, align, r);}/**  * <JA> * 帽胳ごとの forced alignment を乖う∈帽胳が嫡界で涂えられる眷圭∷ *  * @param revwords [in] 帽胳误∈嫡界∷ * @param wnum [in] @a revwords の帽胳眶 * @param param [in] 掐蜗泼魔ベクトル误 * @param align [out] アラインメント冯蔡を呈羌するSentence菇陇挛 * @param r [i/o] 千急借妄インスタンス * </JA> * <EN> * Do forced alignment per word for the given word sequence (reversed order). *  * @param revwords [in] word sequence in reversed direction * @param wnum [in] length of @a revwords * @param param [in] input parameter vectors * @param align [out] Sentence data area to store the alignment result * @param r [i/o] recognition process instance * </EN> * @callgraph * @callergraph */voidword_rev_align(WORD_ID *revwords, short wnum, HTK_Param *param, SentenceAlign *align, RecogProcess *r){  WORD_ID *words;		/* word sequence (true order) */  int w;  words = (WORD_ID *)mymalloc(sizeof(WORD_ID) * wnum);  for (w=0;w<wnum;w++) words[w] = revwords[wnum-w-1];  do_align(words, wnum, param, PER_WORD, align, r);  free(words);}/**  * <JA> * 不燎ごとの forced alignment を乖う.  *  * @param words [in] 帽胳误 * @param num [in] @a words の帽胳眶 * @param param [in] 掐蜗泼魔ベクトル误 * @param align [out] アラインメント冯蔡を呈羌するSentence菇陇挛 * @param r [i/o] 千急借妄インスタンス * </JA> * <EN> * Do forced alignment per phoneme for the given word sequence. *  * @param words [in] word sequence * @param num [in] length of @a words * @param param [in] input parameter vectors * @param align [out] Sentence data area to store the alignment result * @param r [i/o] recognition process instance * </EN> * @callgraph * @callergraph */voidphoneme_align(WORD_ID *words, short num, HTK_Param *param, SentenceAlign *align, RecogProcess *r){  do_align(words, num, param, PER_PHONEME, align, r);}/**  * <JA> * 不燎ごとの forced alignment を乖う∈帽胳が嫡界で涂えられる眷圭∷ *  * @param revwords [in] 帽胳误∈嫡界∷ * @param num [in] @a revwords の帽胳眶 * @param param [in] 掐蜗泼魔ベクトル误 * @param align [out] アラインメント冯蔡を呈羌するSentence菇陇挛 * @param r [i/o] 千急借妄インスタンス * </JA> * <EN> * Do forced alignment per phoneme for the given word sequence (reversed order). *  * @param revwords [in] word sequence in reversed direction * @param num [in] length of @a revwords * @param param [in] input parameter vectors * @param align [out] Sentence data area to store the alignment result * @param r [i/o] recognition process instance * </EN> * @callgraph * @callergraph */voidphoneme_rev_align(WORD_ID *revwords, short num, HTK_Param *param, SentenceAlign *align, RecogProcess *r){  WORD_ID *words;		/* word sequence (true order) */  int p;  words = (WORD_ID *)mymalloc(sizeof(WORD_ID) * num);  for (p=0;p<num;p++) words[p] = revwords[num-p-1];  do_align(words, num, param, PER_PHONEME, align, r);  free(words);}/**  * <JA> * HMM觉轮ごとの forced alignment を乖う.  *  * @param words [in] 帽胳误 * @param num [in] @a words の帽胳眶 * @param param [in] 掐蜗泼魔ベクトル误 * @param align [out] アラインメント冯蔡を呈羌するSentence菇陇挛 * @param r [i/o] 千急借妄インスタンス * </JA> * <EN> * Do forced alignment per HMM state for the given word sequence. *  * @param words [in] word sequence * @param num [in] length of @a words * @param param [in] input parameter vectors * @param align [out] Sentence data area to store the alignment result * @param r [i/o] recognition process instance * </EN> * @callgraph * @callergraph */voidstate_align(WORD_ID *words, short num, HTK_Param *param, SentenceAlign *align, RecogProcess *r){  do_align(words, num, param, PER_STATE, align, r);}/**  * <JA> * HMM觉轮ごとの forced alignment を乖う∈帽胳が嫡界で涂えられる眷圭∷ *  * @param revwords [in] 帽胳误∈嫡界∷ * @param num [in] @a revwords の帽胳眶 * @param param [in] 掐蜗泼魔ベクトル误 * @param align [out] アラインメント冯蔡を呈羌するSentence菇陇挛 * @param r [i/o] 千急借妄インスタンス * </JA> * <EN> * Do forced alignment per state for the given word sequence (reversed order). *  * @param revwords [in] word sequence in reversed direction * @param num [in] length of @a revwords * @param param [in] input parameter vectors * @param align [out] Sentence data area to store the alignment result * @param r [i/o] recognition process instance * </EN> * @callgraph * @callergraph */voidstate_rev_align(WORD_ID *revwords, short num, HTK_Param *param, SentenceAlign *align, RecogProcess *r){  WORD_ID *words;		/* word sequence (true order) */  int p;  words = (WORD_ID *)mymalloc(sizeof(WORD_ID) * num);  for (p=0;p<num;p++) words[p] = revwords[num-p-1];  do_align(words, num, param, PER_STATE, align, r);  free(words);}/**  * <JA> * 千急冯蔡に滦して涩妥なアラインメントを链て悸乖するˉ *  * @param r [i/o] 千急借妄インスタンス * @param param [in] 掐蜗泼魔ベクトル误 * </JA> * <EN> * Do required forced alignment for the recognition results *  * @param r [i/o] recognition process instance * @param param [in] input parameter vectors * </EN> * @callgraph * @callergraph */voiddo_alignment_all(RecogProcess *r, HTK_Param *param){  int n;  Sentence *s;  SentenceAlign *now, *prev;  for(n = 0; n < r->result.sentnum; n++) {    s = &(r->result.sent[n]);    /* do forced alignment if needed */    if (r->config->annotate.align_result_word_flag) {      now = result_align_new();      word_align(s->word, s->word_num, param, now, r);      if (s->align == NULL) s->align = now;      else prev->next = now;      prev = now;    }    if (r->config->annotate.align_result_phoneme_flag) {      now = result_align_new();      phoneme_align(s->word, s->word_num, param, now, r);      if (s->align == NULL) s->align = now;      else prev->next = now;      prev = now;    }    if (r->config->annotate.align_result_state_flag) {      now = result_align_new();      state_align(s->word, s->word_num, param, now, r);      if (s->align == NULL) s->align = now;      else prev->next = now;      prev = now;    }  }} /* end of file */

⌨️ 快捷键说明

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