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

📄 mkcpair.c

📁 about sound recognition.i want to downlod
💻 C
字号:
/** * @file   mkcpair.c * @author Akinobu LEE * @date   Tue Feb 15 14:35:33 2005 *  * <JA> * @brief  矢恕からカテゴリ滦扩腆を藐叫する * * DFA矢恕から·千急借妄の妈1パスで脱いるカテゴリ粗の儡鲁扩腆を藐叫しますˉ * 藐叫したカテゴリ滦攫鼠は矢恕デ〖タ柒に呈羌されますˉ * * ショ〖トポ〖ズ帽胳が矢恕惧で回年されている眷圭·儡鲁扩腆はこの * ショ〖トポ〖ズ帽胳のスキップを雇胃して藐叫されますˉ *  * なお·ここでは借妄惧の扩嘎から·このスキップ材墙なショ〖トポ〖ズ帽胳が * 矢片およぶ矢琐に叫附することは钓されていませんˉ * 掐蜗倡幌ˇ姜眉の痰不婶尸にあたる帽胳は·silB, silE など * このスキップ材墙なショ〖トポ〖ズ笆嘲の帽胳を充り碰てるようにしてください * </JA> *  * <EN> * @brief  Extract category-pair constraint from DFA grammar * * These functions extract whether the each grammar category can be connected * or not in the given DFA grammar, and store the extracted data to the DFA * grammar information.  This category-pair constraint will be used at the * first pass of recognition as a degenerated linguistic constraint. * * If a short pause word is defined in the grammar, the connection constraint * will be extracted considering the skipping of this pause model, since the * pause word may not appear on the specified location in the actual utterance. * * Please note that a grammar rule that allows such skippable short-pause word * to appear at the beginning and end of sentence is prohibited.  Instead, * you should use another (non-skippable) silence word like "sil" as the * beginning and ending of sentence to match the head and tail silence. *  * </EN> *  * $Revision: 1.3 $ *  *//* * Copyright (c) 1991-2006 Kawahara Lab., Kyoto University * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology * Copyright (c) 2005-2006 Julius project team, Nagoya Institute of Technology * All rights reserved */#include <sent/stddefs.h>#include <sent/dfa.h>/**  * Extract category-pair constraint from DFA grammar and newly set the category * pair matrix of the give DFA. *  * @param dinfo [i/o] DFA grammar, in which the category-pair matrix will be created. */voidextract_cpair(DFA_INFO *dinfo){  int i;  DFA_ARC *arc_l, *arc_r, *arc_r2;  int left, right;  /* initialize */  malloc_dfa_cp(dinfo, dinfo->term_num);  /* extract cpair info */  for (i=0;i<dinfo->state_num;i++) {    if ((dinfo->st[i].status & INITIAL_S) != 0) { /* arc from initial state */      for (arc_r = dinfo->st[i].arc; arc_r; arc_r = arc_r->next) {	if (dinfo->is_sp[arc_r->label]) {	  j_error("Error: skippable sp should not appear at end of sentence\n");	}	set_dfa_cp_end(dinfo, arc_r->label, TRUE);      }    }    for(arc_l = dinfo->st[i].arc; arc_l; arc_l = arc_l->next) {      left = arc_l->label;      if ((dinfo->st[arc_l->to_state].status & ACCEPT_S) != 0) {/* arc to accept state */	if (dinfo->is_sp[left]) {	  j_error("Error: skippable sp should not appear at beginning of sentence\n");	}	set_dfa_cp_begin(dinfo, left, TRUE);      }      /* others */      for (arc_r = dinfo->st[arc_l->to_state].arc; arc_r; arc_r = arc_r->next) {	right = arc_r->label;	set_dfa_cp(dinfo, right, left, TRUE);	if (dinfo->is_sp[right]) {	  for (arc_r2 = dinfo->st[arc_r->to_state].arc; arc_r2; arc_r2 = arc_r2->next) {	    if (dinfo->is_sp[arc_r2->label]) { /* sp model continues twice */	      j_error("Error: skippable sp should not repeat\n");	    }	    set_dfa_cp(dinfo, arc_r2->label, left, TRUE);	  }	}      }    }  }}/**  * Append the category pair matrix at the last. *  * @param dst [i/o] DFA grammar * @param src [in] DFA grammar to be appended to @a dst * @param coffset [in] category id in @a dst where the new data should be stored */voidcpair_append(DFA_INFO *dst, DFA_INFO *src, int coffset){  int i,j;  /* dst info must be already appended */  /* [coffset..dst->term_num-1] is the new categories */  if (dst->term_num - coffset != src->term_num) {    j_error("InternalError: append term num not match!: %d, %d, %d\n",	    dst->term_num, src->term_num, coffset);  }  /* allocate appended area */  realloc_dfa_cp(dst, coffset, dst->term_num);    /* append cp */  for(i=coffset;i<dst->term_num;i++) {    for(j=coffset;j<dst->term_num;j++) {      set_dfa_cp(dst, i, j, dfa_cp(src, i-coffset, j-coffset));    }    set_dfa_cp_begin(dst, i, dfa_cp_begin(src, i-coffset));    set_dfa_cp_end(dst, i, dfa_cp_end(src, i-coffset));  }}

⌨️ 快捷键说明

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