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

📄 jfunc.c

📁 julius version 4.12.about sound recognition.
💻 C
📖 第 1 页 / 共 3 页
字号:
    jconf->search_root = s;  }  return jconf;}/**  * <EN> * Initialize and setup A/D-in device specified by the configuration * for recognition.  When threading is enabled for the device, * A/D-in thread will start inside this function. * </EN> * <JA> * 肋年で联买された A/D-in デバイスを介袋步し千急の洁洒を乖う.  * そのデバイスに滦して threading が回年されている眷圭は· * A/D-in 脱スレッドがここで倡幌される.  * </JA> *  * @param recog [in] engine instance *  * @return TRUE on success, FALSE on failure. *  * @callgraph * @callergraph * @ingroup engine */booleanj_adin_init(Recog *recog){  boolean ret;  if (recog->jconf->input.type == INPUT_VECTOR) {    /* feature vector input */    if (recog->jconf->input.speech_input == SP_MFCMODULE) {      if (mfc_module_init(recog->mfcclist, recog) == FALSE) {	return FALSE;      }      ret = mfc_module_standby(recog->mfcclist);    } else {      ret = TRUE;    }    return ret;  }    /* initialize A/D-in device */  ret = adin_initialize(recog);  return(ret);}/**  * <EN> * Return current input speech file name. * Invalid when MFCC input. * </EN> * <JA> * 附哼の掐蜗ファイル叹を手す. * MFCC掐蜗箕は蝗えない.  * </JA> *  * @return the file name. *  * @callgraph * @callergraph * @ingroup engine */char *j_get_current_filename(){#ifdef HAVE_LIBSNDFILE  return(adin_sndfile_get_current_filename());#else  return(adin_file_get_current_filename());#endif}/**  * <EN> * Output all configurations and system informations into log. * </EN> * <JA> * エンジンの链肋年と链システム攫鼠をログに叫蜗する.  * </JA> *  * @param recog [in] engine instance *  * @callgraph * @callergraph * @ingroup engine */voidj_recog_info(Recog *recog){  /* print out system information */  print_engine_info(recog);}/**  * <EN> * @brief  Instanciate / generate a new engine instance according * to the given global configuration instance. * * It inspects all parameters in the global configuration instance, load * all models into memory, build tree lexicons, allocate work area and * caches.  It does all setup to start recognition except A/D-in * initialization. * </EN> * * <JA> * @brief  涂えられた肋年インスタンス柒の攫鼠に骄って·糠たな * エンジンインスタンスを 弹瓢ˇ栏喇する.  *  * 肋年インスタンス柒のパラメ〖タのチェック稿·モデルを粕み哈み·腾菇 * 陇步辑今の栏喇·ワ〖クエリアおよびキャッシュの澄瘦などを乖う.  * A/D-in の介袋步笆嘲で千急を倡幌するのに涩妥な借妄をすべて乖う.  * </JA> *  * @param jconf [in] gloabl configuration instance *  * @return the newly created engine instance. *  * @callgraph * @callergraph * @ingroup instance */Recog *j_create_instance_from_jconf(Jconf *jconf){  Recog *recog;  /* check option values and set parameters needed for model loading */  if (j_jconf_finalize(jconf) == FALSE) {    return NULL;  }  /* create a recognition instance */  recog = j_recog_new();  /* assign configuration to the instance */  recog->jconf = jconf;  /* load all files according to the configurations */  if (j_load_all(recog, jconf) == FALSE) {    jlog("ERROR: j_create_instance_from_jconf: error in loading model\n");    /* j_model_free(model); */    return NULL;  }  /* checkout for recognition: build lexicon tree, allocate cache */  if (j_final_fusion(recog) == FALSE) {    jlog("ERROR: j_create_instance_from_jconf: error while setup for recognition\n");    j_recog_free(recog);    return NULL;  }  return recog;}/**  * <EN> * Assign user-defined language scoring functions into a LM processing * instance.  This should be called after engine instance creation and * before j_final_fusion() is called.  Remember that you should also * specify "-userlm" option at jconf to use user-define language scoring. * </EN> * <JA> * 咐胳モデル借妄インスタンスにユ〖ザ年盗の咐胳スコア烧涂簇眶を判峡する.  * この簇眶はエンジンインスタンス栏喇稿から j_final_fusion() が钙ばれる * までの粗に钙ぶ涩妥がある. 庙罢¨ユ〖ザ年盗の咐胳スコア簇眶を蝗う眷圭は * 悸乖箕オプション "-userlm" も回年する涩妥があることに庙罢せよ.  * </JA> *  * @param lm [i/o] LM processing instance * @param unifunc [in] pointer to the user-defined unigram function * @param bifunc [in] pointer to the user-defined bi-igram function * @param probfunc [in] pointer to the user-defined N-gram function *  * @return TRUE on success, FALSE on failure. *  * @callgraph * @callergraph * @ingroup userfunc */booleanj_regist_user_lm_func(PROCESS_LM *lm, 	  LOGPROB (*unifunc)(WORD_INFO *winfo, WORD_ID w, LOGPROB ngram_prob), 	  LOGPROB (*bifunc)(WORD_INFO *winfo, WORD_ID context, WORD_ID w, LOGPROB ngram_prob),	  LOGPROB (*probfunc)(WORD_INFO *winfo, WORD_ID *contexts, int context_len, WORD_ID w, LOGPROB ngram_prob)){  lm->lmfunc.uniprob = unifunc;  lm->lmfunc.biprob = bifunc;  lm->lmfunc.lmprob = probfunc;  return TRUE;}/**  * <EN> * Assign a user-defined parameter extraction function to engine instance. * </EN> * <JA> * ユ〖ザ年盗の泼魔翁纷换簇眶を蝗うようエンジンに判峡する.  * </JA> *  * @param recog [i/o] engine instance * @param user_calc_vector [in] pointer to function of parameter extraction *  * @return TRUE on success, FALSE on error. *  * @callgraph * @callergraph * @ingroup userfunc */booleanj_regist_user_param_func(Recog *recog, boolean (*user_calc_vector)(MFCCCalc *, SP16 *, int)){  recog->calc_vector = user_calc_vector;  return TRUE;}/**  * <EN> * Get AM configuration structure in jconf by its name. * </EN> * <JA> * jconf柒の AM モジュ〖ル肋年菇陇挛を叹涟で浮瑚する.  * </JA> *  * @param jconf [in] global configuration * @param name [in] AM module name *  * @return the specified AM configuration, or NULL if not found. *  * @callgraph * @callergraph * @ingroup jconf */JCONF_AM *j_get_amconf_by_name(Jconf *jconf, char *name){  JCONF_AM *amconf;  for(amconf=jconf->am_root;amconf;amconf=amconf->next) {    if (strmatch(amconf->name, name)) {      break;    }  }  if (!amconf) {		/* error */    jlog("ERROR: j_get_amconf_by_name: [AM \"%s\"] not found\n", name);    return NULL;  }  return amconf;}/**  * <EN> * Get AM configuration structure in jconf by its id. * </EN> * <JA> * jconf柒の AM モジュ〖ル肋年菇陇挛を ID で浮瑚する.  * </JA> *  * @param jconf [in] global configuration * @param id [in] AM module ID *  * @return the specified AM configuration, or NULL if not found. *  * @callgraph * @callergraph * @ingroup jconf */JCONF_AM *j_get_amconf_by_id(Jconf *jconf, int id){  JCONF_AM *amconf;  for(amconf=jconf->am_root;amconf;amconf=amconf->next) {    if (amconf->id == id) {      break;    }  }  if (!amconf) {		/* error */    jlog("ERROR: j_get_amconf_by_id: [AM%02d] not found\n", id);    return NULL;  }  return amconf;}/**  * <EN> * Return default AM configuration. * * If multiple AM configuration exists, return the latest one. * </EN> * <JA> * デフォルトの AM 肋年を手す.  * * AMが剩眶肋年されている眷圭·呵も呵夺のものを手す.  * </JA> *  * @param jconf [in] global configuration *  * @return the specified AM configuration, or NULL if not found. *  * @callgraph * @callergraph * @ingroup jconf */JCONF_AM *j_get_amconf_default(Jconf *jconf){  JCONF_AM *amconf;  if (jconf->am_root == NULL) return NULL;  for(amconf=jconf->am_root;amconf->next;amconf=amconf->next);  return(amconf);}/**  * <EN> * Get LM configuration structure in jconf by its name. * </EN> * <JA> * jconf柒の LM モジュ〖ル肋年菇陇挛を叹涟で浮瑚する.  * </JA> *  * @param jconf [in] global configuration * @param name [in] LM module name *  * @return the specified LM configuration, or NULL if not found. *  * @callgraph * @callergraph * @ingroup jconf */JCONF_LM *j_get_lmconf_by_name(Jconf *jconf, char *name){  JCONF_LM *lmconf;  for(lmconf=jconf->lm_root;lmconf;lmconf=lmconf->next) {    if (strmatch(lmconf->name, name)) {      break;    }  }  if (!lmconf) {		/* error */    jlog("ERROR: j_get_lmconf_by_name: [LM \"%s\"] not found\n", name);    return NULL;  }  return lmconf;}/**  * <EN> * Get LM configuration structure in jconf by its id. * </EN> * <JA> * jconf柒の LM モジュ〖ル肋年菇陇挛を ID で浮瑚する.  * </JA> *  * @param jconf [in] global configuration * @param id [in] LM module ID *  * @return the specified LM configuration, or NULL if not found. *  * @callgraph * @callergraph * @ingroup jconf */JCONF_LM *j_get_lmconf_by_id(Jconf *jconf, int id){  JCONF_LM *lmconf;  for(lmconf=jconf->lm_root;lmconf;lmconf=lmconf->next) {    if (lmconf->id == id) {      break;    }  }  if (!lmconf) {		/* error */    jlog("ERROR: j_get_lmconf_by_id: [LM%02d] not found\n", id);    return NULL;  }  return lmconf;}/**  * <EN> * Get SEARCH configuration structure in jconf by its name. * </EN> * <JA> * jconf柒の SESARCH モジュ〖ル肋年菇陇挛を叹涟で浮瑚する.  * </JA> *  * @param jconf [in] global configuration * @param name [in] SEARCH module name *  * @return the found SEARCH configuration, or NULL if not found. *  * @callgraph * @callergraph * @ingroup jconf */JCONF_SEARCH *j_get_searchconf_by_name(Jconf *jconf, char *name){  JCONF_SEARCH *sconf;  for(sconf=jconf->search_root;sconf;sconf=sconf->next) {    if (strmatch(sconf->name, name)) {      break;    }  }  if (!sconf) {		/* error */    jlog("ERROR: j_get_searchconf_by_name: [SR \"%s\"] not found\n", name);    return NULL;  }  return sconf;}/**  * <EN> * Get SEARCH configuration structure in jconf by its id. * </EN> * <JA> * jconf柒の SEARCH モジュ〖ル肋年菇陇挛を ID で浮瑚する.  * </JA> *  * @param jconf [in] global configuration * @param id [in] SEARCH module ID *  * @return the found SEARCH configuration, or NULL if not found. *  * @callgraph * @callergraph * @ingroup jconf */JCONF_SEARCH *j_get_searchconf_by_id(Jconf *jconf, int id){  JCONF_SEARCH *sconf;  for(sconf=jconf->search_root;sconf;sconf=sconf->next) {    if (sconf->id == id) {      break;    }  }  if (!sconf) {		/* error */    jlog("ERROR: j_get_searchconf_by_id: [SR%02d] not found\n", id);    return NULL;  }  return sconf;}/**  * <EN> * De-activate a recognition process instance designated by its name. * The process will actually pauses at the next recognition interval. * </EN> * <JA> * 回年された叹涟の千急借妄インスタンスの瓢侯を办箕匿贿させる.  * 悸狠に匿贿するのは肌の不兰千急の圭粗である.  * </JA> *  * @param recog [i/o] engine instance * @param name [in] SR name to deactivate *  * @return TRUE on success, or FALSE on failure. * * @callgraph * @callergraph * @ingroup jfunc_process *  */booleanj_process_deactivate(Recog *recog, char *name){  RecogProcess *r;  for(r=recog->process_list;r;r=r->next) {    if (strmatch(r->config->name, name)) {      /* book to be inactive at next interval */      r->active = -1;      break;    }  }  if (!r) {			/* not found */    jlog("ERROR: j_process_deactivate: no SR instance named \"%s\", cannot deactivate\n", name);    return FALSE;  }  /* tell engine to update */  recog->process_want_reload = TRUE;  return TRUE;}/**  * <EN> * De-activate a recognition process instance designated by its ID. * The process will actually pauses at the next recognition interval. * </EN> * <JA> * 回年された千急借妄インスタンスの瓢侯を办箕匿贿させる.  * 滦据インスタンスを ID 戎规で回年する眷圭はこちらを蝗う.  * 悸狠に匿贿するのは肌の不兰千急の圭粗である.  * </JA> *  * @param recog [i/o] engine instance * @param id [in] SR ID to deactivate *  * @return TRUE on success, or FALSE on failure.

⌨️ 快捷键说明

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