/** * <JA> * エンジンインスタンスの全情報をログに出力する. * </JA> * <EN> * Output all informations of an engine instance to log. * </EN> * * @param recog [in] engine instance * * @callgraph * @callergraph */ void print_engine_info(Recog *recog) { FILE *fp; Jconf *jconf; MFCCCalc *mfcc; PROCESS_AM *am; PROCESS_LM *lm; RecogProcess *r; jconf = recog->jconf; /* set output file pointer to fp */ fp = jlog_get_fp(); if (fp == NULL) return; jlog("----------------------- System Information begin ---------------------\n"); j_put_header(fp); j_put_compile_defs(fp); jlog("\n"); /* print current argument setting to log */ print_jconf_overview(jconf); if (jconf->input.type == INPUT_WAVEFORM) { /* acoustic parameter conditions for this model */ jlog("------------------------------------------------------------\n"); jlog("Speech Analysis Module(s)\n\n"); for(mfcc=recog->mfcclist;mfcc;mfcc=mfcc->next) { jlog("[MFCC%02d] for", mfcc->id); for(am=recog->amlist;am;am=am->next) { if (am->mfcc == mfcc) { jlog(" [AM%02d %s]", am->config->id, am->config->name); } } if (recog->gmm != NULL) { if (recog->gmmmfcc == mfcc) { jlog(" [GMM]"); } } jlog("\n\n"); put_para(fp, mfcc->para); if (jconf->input.type == INPUT_WAVEFORM) { jlog(" spectral subtraction = "); if (mfcc->frontend.ssload_filename || mfcc->frontend.sscalc) { if (mfcc->frontend.sscalc) { jlog("use head silence of each input\n"); jlog("\t head sil length = %d msec\n", mfcc->frontend.sscalc_len); } else { /* ssload_filename != NULL */ jlog("use a constant value from file\n"); jlog(" noise spectrum file = \"%s\"\n", mfcc->frontend.ssload_filename); } jlog("\t alpha coef. = %f\n", mfcc->frontend.ss_alpha); jlog("\t spectral floor = %f\n", mfcc->frontend.ss_floor); } else { jlog("off\n"); } } jlog(" cepstral normalization = "); if (mfcc->para->cmn || mfcc->para->cvn) { if (jconf->decodeopt.realtime_flag) { jlog("real-time MAP-"); } else { jlog("sentence "); } if (mfcc->para->cmn) { jlog("CMN"); } if (mfcc->para->cmn && mfcc->para->cvn) { jlog("+"); } if (mfcc->para->cvn) { jlog("CVN"); } jlog("\n"); } else { jlog("no\n"); } jlog("\t base setup from ="); if (mfcc->htk_loaded == 1 || mfcc->hmm_loaded == 1) { if (mfcc->hmm_loaded == 1) { jlog(" binhmm-embedded"); if (mfcc->htk_loaded == 1) { jlog(", then overridden by HTK Config and defaults"); } } else { if (mfcc->htk_loaded == 1) { jlog(" HTK Config (and HTK defaults)"); } } } else { jlog(" Julius defaults"); } jlog("\n"); jlog("\n"); if (jconf->decodeopt.realtime_flag && (mfcc->para->cmn || mfcc->para->cvn)) { jlog(" MAP-"); if (mfcc->para->cmn) jlog("CMN"); if (mfcc->para->cmn && mfcc->para->cvn) jlog("+"); if (mfcc->para->cvn) jlog("CVN"); jlog(":\n"); jlog(" initial cep. data = "); if (mfcc->cmn.load_filename) { jlog("load from \"%s\"\n", mfcc->cmn.load_filename); } else { jlog("none\n"); } jlog(" beginning data weight = %6.2f\n", mfcc->cmn.map_weight); if (mfcc->cmn.update) { jlog(" beginning data update = yes, from last inputs at each input\n"); } else { jlog(" beginning data update = no, use default as initial at each input\n"); } if (mfcc->cmn.save_filename) { jlog(" save cep. data to = file \"%s\" at end of each input\n", mfcc->cmn.save_filename); } jlog("\n"); } } } if (recog->gmm != NULL) { jlog("------------------------------------------------------------\n"); jlog("GMM\n"); jlog("\n"); jlog(" GMM definition file = %s\n", jconf->reject.gmm_filename); jlog(" GMM gprune num = %d\n", jconf->reject.gmm_gprune_num); if (jconf->reject.gmm_reject_cmn_string != NULL) { jlog(" GMM names to reject = %s\n", jconf->reject.gmm_reject_cmn_string); } #ifdef GMM_VAD jlog("\n GMM-based VAD\n\n"); jlog(" backstep on trigger = %d frames\n", jconf->detect.gmm_margin); jlog(" up-trigger thres score = %.1f\n", jconf->detect.gmm_uptrigger_thres); jlog(" down-trigger thres score = %.1f\n", jconf->detect.gmm_downtrigger_thres); #endif jlog("\n GMM"); print_hmmdef_info(fp, recog->gmm); jlog("\n"); } jlog("------------------------------------------------------------\n"); jlog("Acoustic Model(s)\n"); jlog("\n"); for(am = recog->amlist; am; am = am->next) { if (am->config->name[0] != '\0') { jlog("[AM%02d \"%s\"]\n\n", am->config->id, am->config->name); } else { jlog("[AM%02d]\n\n", am->config->id); } print_hmmdef_info(fp, am->hmminfo); jlog("\n"); if (am->config->hmm_gs_filename != NULL) { jlog("GS "); print_hmmdef_info(fp, am->hmm_gs); jlog("\n"); } jlog(" AM Parameters:\n"); jlog(" Gaussian pruning = "); switch(am->config->gprune_method){ case GPRUNE_SEL_NONE: jlog("none (full computation)"); break; case GPRUNE_SEL_BEAM: jlog("beam"); break; case GPRUNE_SEL_HEURISTIC: jlog("heuristic"); break; case GPRUNE_SEL_SAFE: jlog("safe"); break; case GPRUNE_SEL_USER: jlog("(use plugin function)"); break; } jlog(" (-gprune)\n"); if (am->config->gprune_method != GPRUNE_SEL_NONE && am->config->gprune_method != GPRUNE_SEL_USER) { jlog(" top N mixtures to calc = %d / %d (-tmix)\n", am->config->mixnum_thres, am->hmminfo->maxcodebooksize); } if (am->config->hmm_gs_filename != NULL) { jlog(" GS state num thres = %d / %d selected (-gsnum)\n", am->config->gs_statenum, am->hmm_gs->totalstatenum); } jlog(" short pause HMM name = \"%s\" specified", am->config->spmodel_name); if (am->hmminfo->sp != NULL) { jlog(", \"%s\" applied", am->hmminfo->sp->name); if (am->hmminfo->sp->is_pseudo) { jlog(" (pseudo)"); } else { jlog(" (physical)"); } } else { jlog(" but not assigned"); } jlog(" (-sp)\n"); jlog(" cross-word CD on pass1 = "); #ifdef PASS1_IWCD jlog("handle by approx. "); switch(am->hmminfo->cdset_method) { case IWCD_AVG: jlog("(use average prob. of same LC)\n"); break; case IWCD_MAX: jlog("(use max. prob. of same LC)\n"); break; case IWCD_NBEST: jlog("(use %d-best of same LC)\n", am->hmminfo->cdmax_num); break; } #else jlog("disabled\n"); #endif if (am->hmminfo->multipath) { jlog(" sp transition penalty = %+2.1f\n", am->config->iwsp_penalty); } jlog("\n"); } jlog("------------------------------------------------------------\n"); jlog("Language Model(s)\n"); for(lm = recog->lmlist; lm; lm = lm->next) { jlog("\n"); if (lm->config->name[0] != '\0') { jlog("[LM%02d \"%s\"]", lm->config->id, lm->config->name); } else { jlog("[LM%02d]", lm->config->id); } if (lm->lmtype == LM_PROB) { if (lm->lmvar == LM_NGRAM) { jlog(" type=n-gram\n\n"); if (lm->ngram) { print_ngram_info(fp, lm->ngram); jlog("\n"); } } else if (lm->lmvar == LM_NGRAM_USER) { if (lm->ngram) { jlog(" type=n-gram + user\n\n"); print_ngram_info(fp, lm->ngram); jlog("\n"); } else { jlog(" type=user\n\n"); } } else { jlog(" type=UNKNOWN??\n\n"); } } else if (lm->lmtype == LM_DFA) { if (lm->lmvar == LM_DFA_GRAMMAR) { jlog(" type=grammar\n\n"); if (lm->dfa) { print_dfa_info(fp, lm->dfa); jlog("\n"); if (debug2_flag) { print_dfa_cp(fp, lm->dfa); jlog("\n"); } } } else if (lm->lmvar == LM_DFA_WORD) { jlog(" type=word\n\n"); } else { jlog(" type=UNKNOWN??\n\n"); } } else { jlog(" type=UNKNOWN??\n\n"); } if (lm->winfo != NULL) { print_voca_info(fp, lm->winfo); jlog("\n"); } jlog(" Parameters:\n"); if (lm->lmtype == LM_DFA && lm->lmvar == LM_DFA_GRAMMAR) { if (lm->dfa != NULL) { int i; jlog(" found sp category IDs ="); for(i=0;i<lm->dfa->term_num;i++) { if (lm->dfa->is_sp[i]) { jlog(" %d", i); } } jlog("\n"); } } if (lm->lmtype == LM_PROB) { if (lm->config->enable_iwspword) { jlog("\tIW-sp word added to dict= \"%s\"\n", lm->config->iwspentry); } if (lm->config->additional_dict_files) { JCONF_LM_NAMELIST *nl; jlog("\tadditional dictionaries:\n"); for(nl=lm->config->additional_dict_files;nl;nl=nl->next) { jlog("\t\t\t%s\n", nl->name); } jlog("\n"); } if (lm->config->additional_dict_entries) { JCONF_LM_NAMELIST *nl; int n = 0; jlog("\tadditional dict entries:\n"); for(nl=lm->config->additional_dict_entries;nl;nl=nl->next) { jlog("\t\t\t%s\n", nl->name); n++; } jlog("--- total %d entries\n", n); } } if (lm->lmtype == LM_PROB) { jlog("\t(-silhead)head sil word = "); put_voca(fp, lm->winfo, lm->winfo->head_silwid); jlog("\t(-siltail)tail sil word = "); put_voca(fp, lm->winfo, lm->winfo->tail_silwid); } if (lm->lmvar == LM_DFA_WORD) { jlog(" silence model names to add at word head / tail: (-wsil)\n"); jlog("\tword head = \"%s\"\n", lm->config->wordrecog_head_silence_model_name); jlog("\tword tail = \"%s\"\n", lm->config->wordrecog_tail_silence_model_name); jlog("\ttheir context name = \"%s\"\n", (lm->config->wordrecog_silence_context_name[0] == '\0') ? "NULL (blank)" : lm->config->wordrecog_silence_context_name); } } jlog("\n"); jlog("------------------------------------------------------------\n"); jlog("Recognizer(s)\n\n"); for(r = recog->process_list; r; r = r->next) { jlog("[SR%02d", r->config->id); if (r->config->name[0] != '\0') { jlog(" \"%s\"", r->config->name); } jlog("] "); if (r->am->config->name[0] != '\0') { jlog("AM%02d \"%s\"", r->am->config->id, r->am->config->name); } else { jlog("AM%02d", r->am->config->id); } jlog(" + "); if (r->lm->config->name[0] != '\0') { jlog("LM%02d \"%s\"", r->lm->config->id, r->lm->config->name); } else { jlog("LM%02d", r->lm->config->id); } jlog("\n\n"); if (r->wchmm != NULL) { print_wchmm_info(r->wchmm); jlog("\n"); } if (r->lmtype == LM_PROB) { jlog(" Inter-word N-gram cache: \n"); { int num, len; #ifdef UNIGRAM_FACTORING len = r->wchmm->isolatenum; jlog("\troot node to be cached = %d / %d (isolated only)\n", len, r->wchmm->startnum); #else len = r->wchmm->startnum; jlog("\troot node to be cached = %d (all)\n", len); #endif #ifdef HASH_CACHE_IW num = (r->config->pass1.iw_cache_rate * r->lm->ngram->max_word_num) / 100; jlog("\tword ends to be cached = %d / %d\n", num, r->lm->ngram->max_word_num); #else num = r->lm->ngram->max_word_num; jlog("\tword ends to be cached = %d (all)\n", num); #endif jlog("\t max. allocation size = %dMB\n", num * len / 1000 * sizeof(LOGPROB) / 1000); } } if (r->lmtype == LM_PROB) { jlog("\t(-lmp) pass1 LM weight = %2.1f ins. penalty = %+2.1f\n", r->config->lmp.lm_weight, r->config->lmp.lm_penalty); jlog("\t(-lmp2) pass2 LM weight = %2.1f ins. penalty = %+2.1f\n", r->config->lmp.lm_weight2, r->config->lmp.lm_penalty2); jlog("\t(-transp)trans. penalty = %+2.1f per word\n", r->config->lmp.lm_penalty_trans); } else if (r->lmtype == LM_DFA && r->lmvar == LM_DFA_GRAMMAR) { jlog("\t(-penalty1) IW penalty1 = %+2.1f\n", r->config->lmp.penalty1); jlog("\t(-penalty2) IW penalty2 = %+2.1f\n", r->config->lmp.penalty2); } #ifdef CONFIDENCE_MEASURE #ifdef CM_MULTIPLE_ALPHA jlog("\t(-cmalpha)CM alpha coef = from %f to %f by step of %f (%d outputs)\n", r->config->annotate.cm_alpha_bgn, r->config->annotate.cm_alpha_end, r->config->annotate.cm_alpha_step, r->config->annotate.cm_alpha_num); #else jlog("\t(-cmalpha)CM alpha coef = %f\n", r->config->annotate.cm_alpha); #endif #ifdef CM_SEARCH_LIMIT jlog("\t(-cmthres) CM cut thres = %f for hypo generation\n", r->config->annotate.cm_cut_thres); #endif #ifdef CM_SEARCH_LIMIT_POP jlog("\t(-cmthres2)CM cut thres = %f for popped hypo\n", r->config->annotate.cm_cut_thres_pop); #endif #endif /* CONFIDENCE_MEASURE */ jlog("\n"); if (r->am->hmminfo->multipath) { if (r->lm->config->enable_iwsp) { jlog("\t inter-word short pause = on (append \"%s\" for each word tail)\n", r->am->hmminfo->sp->name); jlog("\t sp transition penalty = %+2.1f\n", r->am->config->iwsp_penalty); } } if (r->lmvar == LM_DFA_WORD) { #ifdef DETERMINE jlog(" early word determination: (-wed)\n"); jlog("\tscore threshold = %f\n", r->config->pass1.determine_score_thres); jlog("\tframe dur. thres = %d\n", r->config->pass1.determine_duration_thres); #endif } jlog(" Search parameters: \n"); jlog("\t multi-path handling = "); if (r->am->hmminfo->multipath) { jlog("yes, multi-path mode enabled\n"); } else { jlog("no\n"); } jlog("\t(-b) trellis beam width = %d", r->trellis_beam_width); if (r->config->pass1.specified_trellis_beam_width == -1) { jlog(" (-1 or not specified - guessed)\n"); } else if (r->config->pass1.specified_trellis_beam_width == 0) { jlog(" (0 - full)\n"); } else { jlog("\n"); } #ifdef SCORE_PRUNING if (r->config->pass1.score_pruning_width < 0.0) { jlog("\t(-bs)score pruning thres= disabled\n"); } else { jlog("\t(-bs)score pruning thres= %f\n", r->config->pass1.score_pruning_width); } #endif jlog("\t(-n)search candidate num= %d\n", r->config->pass2.nbest); jlog("\t(-s) search stack size = %d\n", r->config->pass2.stack_size); jlog("\t(-m) search overflow = after %d hypothesis poped\n", r->config->pass2.hypo_overflow); jlog("\t 2nd pass method = "); if (r->config->graph.enabled) { #ifdef GRAPHOUT_DYNAMIC #ifdef GRAPHOUT_SEARCH jlog("searching graph, generating dynamic graph\n"); #else jlog("searching sentence, generating dynamic graph\n"); #endif /* GRAPHOUT_SEARCH */ #else /* ~GRAPHOUT_DYNAMIC */ jlog("searching sentence, generating static graph from N-best\n"); #endif } else { jlog("searching sentence, generating N-best\n"); } if (r->config->pass2.enveloped_bestfirst_width >= 0) { jlog("\t(-b2) pass2 beam width = %d\n", r->config->pass2.enveloped_bestfirst_width); } jlog("\t(-lookuprange)lookup range= %d (tm-%d <= t <tm+%d)\n",r->config->pass2.lookup_range,r->config->pass2.lookup_range,r->config->pass2.lookup_range); #ifdef SCAN_BEAM jlog("\t(-sb)2nd scan beamthres = %.1f (in logscore)\n", r->config->pass2.scan_beam_thres); #endif jlog("\t(-n) search till = %d candidates found\n", r->config->pass2.nbest); jlog("\t(-output) and output = %d candidates out of above\n", r->config->output.output_hypo_maxnum); if (r->ccd_flag) { jlog("\t IWCD handling:\n"); #ifdef PASS1_IWCD jlog("\t 1st pass: approximation "); switch(r->am->hmminfo->cdset_method) { case IWCD_AVG: jlog("(use average prob. of same LC)\n"); break; case IWCD_MAX: jlog("(use max. prob. of same LC)\n"); break; case IWCD_NBEST: jlog("(use %d-best of same LC)\n", r->am->hmminfo->cdmax_num); break; } #else jlog("\t 1st pass: ignored\n"); #endif #ifdef PASS2_STRICT_IWCD jlog("\t 2nd pass: strict (apply when expanding hypo. )\n"); #else jlog("\t 2nd pass: loose (apply when hypo. is popped and scanned)\n"); #endif } if (r->lmtype == LM_PROB) { jlog("\t factoring score: "); #ifdef UNIGRAM_FACTORING jlog("1-gram prob. (statically assigned beforehand)\n"); #else jlog("2-gram prob. (dynamically computed while search)\n"); #endif } if (r->config->annotate.align_result_word_flag) { jlog("\t output word alignments\n"); } if (r->config->annotate.align_result_phoneme_flag) { jlog("\t output phoneme alignments\n"); } if (r->config->annotate.align_result_state_flag) { jlog("\t output state alignments\n"); } if (r->lmtype == LM_DFA && r->lmvar == LM_DFA_GRAMMAR) { if (r->config->pass2.looktrellis_flag) { jlog("\t only words in backtrellis will be expanded in 2nd pass\n"); } else { jlog("\t all possible words will be expanded in 2nd pass\n"); } } if (r->wchmm != NULL) { if (r->wchmm->category_tree) { if (r->config->pass1.old_tree_function_flag) { jlog("\t build_wchmm() used\n"); } else { jlog("\t build_wchmm2() used\n"); } #ifdef PASS1_IWCD #ifdef USE_OLD_IWCD jlog("\t full lcdset used\n"); #else jlog("\t lcdset limited by word-pair constraint\n"); #endif #endif /* PASS1_IWCD */ } } if (r->config->output.progout_flag) { jlog("\tprogressive output on 1st pass\n"); } if (r->config->compute_only_1pass) { jlog("\tCompute only 1-pass\n"); } if (r->config->graph.enabled) { jlog("\n"); jlog("Graph-based output with graph-oriented search:\n"); jlog("\t(-lattice) word lattice = %s\n", r->config->graph.lattice ? "yes" : "no"); jlog("\t(-confnet) confusion network = %s\n", r->config->graph.confnet ? "yes" : "no"); if (r->config->graph.lattice == TRUE) { jlog("\t(-graphrange) margin = %d frames", r->config->graph.graph_merge_neighbor_range); if (r->config->graph.graph_merge_neighbor_range < 0) { jlog(" (all post-marging disabled)\n"); } else if (r->config->graph.graph_merge_neighbor_range == 0) { jlog(" (merge same word with the same boundary)\n"); } else { jlog(" (merge same words around this margin)\n"); } } #ifdef GRAPHOUT_DEPTHCUT jlog("\t(-graphcut)cutoff depth = "); if (r->config->graph.graphout_cut_depth < 0) { jlog("disabled (-1)\n"); } else { jlog("%d words\n",r->config->graph.graphout_cut_depth); } #endif #ifdef GRAPHOUT_LIMIT_BOUNDARY_LOOP jlog("\t(-graphboundloop)loopmax = %d for boundary adjustment\n",r->config->graph.graphout_limit_boundary_loop_num); #endif #ifdef GRAPHOUT_SEARCH_DELAY_TERMINATION jlog("\tInhibit graph search termination before 1st sentence found = "); if (r->config->graph.graphout_search_delay) { jlog("enabled\n"); } else { jlog("disabled\n"); } #endif } if (r->config->successive.enabled) { jlog("\tshort pause segmentation = on\n"); jlog("\t sp duration length = %d frames\n", r->config->successive.sp_frame_duration); #ifdef SPSEGMENT_NAIST jlog(" backstep margin on trigger = %d frames\n", r->config->successive.sp_margin); jlog("\t delay on trigger = %d frames\n", r->config->successive.sp_delay); #endif if (r->config->successive.pausemodelname) { jlog("\t pause models for seg. = %s\n", r->config->successive.pausemodelname); } } else { jlog("\tshort pause segmentation = off\n"); } if (r->config->output.progout_flag) { jlog("\t progout interval = %d msec\n", r->config->output.progout_interval); } jlog("\tfall back on search fail = "); if (r->config->sw.fallback_pass1_flag) { jlog("on, adopt 1st pass result as final\n"); } else { jlog("off, returns search failure\n"); } jlog("\n"); } jlog("------------------------------------------------------------\n"); jlog("Decoding algorithm:\n\n"); jlog("\t1st pass input processing = "); if (jconf->decodeopt.force_realtime_flag) jlog("(forced) "); if (jconf->decodeopt.realtime_flag) { jlog("real time, on-the-fly\n"); } else { jlog("buffered, batch\n"); } jlog("\t1st pass method = "); #ifdef WPAIR # ifdef WPAIR_KEEP_NLIMIT jlog("word-pair approx., keeping only N tokens "); # else jlog("word-pair approx. "); # endif #else jlog("1-best approx. "); #endif #ifdef WORD_GRAPH jlog("generating word_graph\n"); #else jlog("generating indexed trellis\n"); #endif #ifdef CONFIDENCE_MEASURE jlog("\toutput word confidence measure "); #ifdef CM_NBEST jlog("based on N-best candidates\n"); #endif #ifdef CM_SEARCH jlog("based on search-time scores\n"); #endif #endif /* CONFIDENCE_MEASURE */ jlog("\n"); jlog("------------------------------------------------------------\n"); jlog("FrontEnd:\n\n"); jlog(" Input stream:\n"); jlog("\t input type = "); switch(jconf->input.type) { case INPUT_WAVEFORM: jlog("waveform\n"); break; case INPUT_VECTOR: jlog("feature vector sequence\n"); break; } jlog("\t input source = "); if (jconf->input.plugin_source != -1) { jlog("plugin\n"); } else if (jconf->input.speech_input == SP_RAWFILE) { jlog("waveform file\n"); jlog("\t input filelist = "); if (jconf->input.inputlist_filename == NULL) { jlog("(none, get file name from stdin)\n"); } else { jlog("%s\n", jconf->input.inputlist_filename); } } else if (jconf->input.speech_input == SP_MFCFILE) { jlog("feature vector file (HTK format)\n"); jlog("\t filelist = "); if (jconf->input.inputlist_filename == NULL) { jlog("(none, get file name from stdin)\n"); } else { jlog("%s\n", jconf->input.inputlist_filename); } } else if (jconf->input.speech_input == SP_STDIN) { jlog("standard input\n"); } else if (jconf->input.speech_input == SP_ADINNET) { jlog("adinnet client\n"); #ifdef USE_NETAUDIO } else if (jconf->input.speech_input == SP_NETAUDIO) { char *p; jlog("NetAudio server on "); if (jconf->input.netaudio_devname != NULL) { jlog("%s\n", jconf->input.netaudio_devname); } else if ((p = getenv("AUDIO_DEVICE")) != NULL) { jlog("%s\n", p); } else { jlog("local port\n"); } #endif } else if (jconf->input.speech_input == SP_MIC) { jlog("microphone\n"); jlog("\t device API = "); switch(jconf->input.device) { case SP_INPUT_DEFAULT: jlog("default\n"); break; case SP_INPUT_ALSA: jlog("alsa\n"); break; case SP_INPUT_OSS: jlog("oss\n"); break; case SP_INPUT_ESD: jlog("esd\n"); break; case SP_INPUT_PULSEAUDIO: jlog("pulseaudio\n"); break; } } if (jconf->input.type == INPUT_WAVEFORM) { if (jconf->input.speech_input == SP_RAWFILE || jconf->input.speech_input == SP_STDIN || jconf->input.speech_input == SP_ADINNET) { if (jconf->input.use_ds48to16) { jlog("\t sampling freq. = assume 48000Hz, then down to %dHz\n", jconf->input.sfreq); } else { jlog("\t sampling freq. = %d Hz required\n", jconf->input.sfreq); } } else { if (jconf->input.use_ds48to16) { jlog("\t sampling freq. = 48000Hz, then down to %d Hz\n", jconf->input.sfreq); } else { jlog("\t sampling freq. = %d Hz\n", jconf->input.sfreq); } } } if (jconf->input.type == INPUT_WAVEFORM) { jlog("\t threaded A/D-in = "); #ifdef HAVE_PTHREAD if (recog->adin->enable_thread) { jlog("supported, on\n"); } else { jlog("supported, off\n"); } #else jlog("not supported (live input may be dropped)\n"); #endif } if (jconf->preprocess.strip_zero_sample) { jlog("\t zero frames stripping = on\n"); } else { jlog("\t zero frames stripping = off\n"); } if (jconf->input.type == INPUT_WAVEFORM) { if (recog->adin->adin_cut_on) { jlog("\t silence cutting = on\n"); jlog("\t level thres = %d / 32767\n", jconf->detect.level_thres); jlog("\t zerocross thres = %d / sec.\n", jconf->detect.zero_cross_num); jlog("\t head margin = %d msec.\n", jconf->detect.head_margin_msec); jlog("\t tail margin = %d msec.\n", jconf->detect.tail_margin_msec); jlog("\t chunk size = %d samples\n", jconf->detect.chunk_size); } else { jlog("\t silence cutting = off\n"); } if (jconf->preprocess.use_zmean) { jlog("\t long-term DC removal = on"); if (jconf->input.speech_input == SP_RAWFILE) { jlog(" (will compute for each file)\n"); } else { jlog(" (will compute from first %.1f sec)\n", (float)ZMEANSAMPLES / (float)jconf->input.sfreq); } } else { jlog("\t long-term DC removal = off\n"); } } jlog("\t reject short input = "); if (jconf->reject.rejectshortlen > 0) { jlog("< %d msec\n", jconf->reject.rejectshortlen); } else { jlog("off\n"); } #ifdef POWER_REJECT jlog("\t power rejection thres = %f", jconf->reject.powerthres); #endif jlog("\n"); jlog("----------------------- System Information end -----------------------\n"); #ifdef USE_MIC if (jconf->decodeopt.realtime_flag) { boolean flag; flag = FALSE; for(mfcc=recog->mfcclist; mfcc; mfcc=mfcc->next) { if (mfcc->para->cmn && mfcc->cmn.loaded) { flag = TRUE; break; } } if (flag) { jlog("\n"); jlog("initial CMN parameter loaded from file\nfor"); for(mfcc=recog->mfcclist; mfcc; mfcc=mfcc->next) { if (mfcc->para->cmn && mfcc->cmn.loaded) { jlog(" MFCC%02d", mfcc->id); } } jlog("\n"); } flag = FALSE; for(mfcc=recog->mfcclist; mfcc; mfcc=mfcc->next) { if (mfcc->para->cmn && !mfcc->cmn.loaded) { flag = TRUE; break; } } if (flag) { jlog("\n"); jlog("\t*************************************************************\n"); jlog("\t* NOTICE: The first input may not be recognized, since *\n"); jlog("\t* no initial CMN parameter is available on startup. *\n"); jlog("\t* for"); for(mfcc=recog->mfcclist; mfcc; mfcc=mfcc->next) { if (mfcc->para->cmn && !mfcc->cmn.loaded) { jlog(" MFCC%02d", mfcc->id); } } jlog("*\n"); jlog("\t*************************************************************\n"); } flag = FALSE; for(mfcc=recog->mfcclist; mfcc; mfcc=mfcc->next) { if (mfcc->para->energy && mfcc->para->enormal) { flag = TRUE; break; } } if (flag) { jlog("\t*************************************************************\n"); jlog("\t* NOTICE: Energy normalization is activated on live input: *\n"); jlog("\t* maximum energy of LAST INPUT will be used for it. *\n"); jlog("\t* So, the first input will not be recognized. *\n"); jlog("\t* for"); for(mfcc=recog->mfcclist; mfcc; mfcc=mfcc->next) { if (mfcc->para->energy && mfcc->para->enormal) { jlog(" MFCC%02d", mfcc->id); } } jlog("*\n"); jlog("\t*************************************************************\n"); } } #endif }
/** * <JA> * @brief jconf設定パラメータを最終的に決定する * * この関数は,jconf ファイルやコマンドオプションによって与えられた * jconf 内のパラメータについて精査を行う. 具体的には,値の範囲のチェッ * クや,競合のチェック,設定から算出される各種パラメータの計算,使用 * するモデルに対する指定の有効性などをチェックする. * * この関数は,アプリケーションによって jconf の各値の指定が終了した直後, * エンジンインスタンスの作成やモデルのロードが行われる前に呼び出される * べきである. * * </JA> * <EN> * @brief Check and finalize jconf parameters. * * This functions parse through the global jconf configuration parameters. * This function checks for value range of variables, file existence, * competing specifications among variables or between variables and models, * calculate some parameters from the given values, etc. * * This function should be called just after all values are set by * jconf, command argument or by user application, and before creating * engine instance and loading models. * * </EN> * * @param jconf [i/o] global jconf configuration structure * * @return TRUE when all check has been passed, or FALSE if not passed. * * @callgraph * @callergraph * @ingroup jconf */ boolean j_jconf_finalize(Jconf *jconf) { boolean ok_p; JCONF_LM *lm; JCONF_AM *am; JCONF_SEARCH *s, *hs; ok_p = TRUE; /* update and tailor configuration */ /* if a search config has progout_flag enabled, set it to all config */ hs = NULL; for(s=jconf->search_root;s;s=s->next) { if (s->output.progout_flag) { hs = s; break; } } if (hs != NULL) { for(s=jconf->search_root;s;s=s->next) { s->output.progout_flag = hs->output.progout_flag; s->output.progout_interval = hs->output.progout_interval; } } /* if an instance has short-pause segmentation enabled, set it to global opt for parameter handling (only a recognizer with this option will decide the segmentation, but the segmentation should be synchronized for all the recognizer) */ for(s=jconf->search_root;s;s=s->next) { if (s->successive.enabled) { jconf->decodeopt.segment = TRUE; break; } } #ifdef GMM_VAD /* if GMM VAD enabled, set it to global */ if (jconf->reject.gmm_filename) { jconf->decodeopt.segment = TRUE; } #endif for(lm = jconf->lm_root; lm; lm = lm->next) { if (lm->lmtype == LM_UNDEF) { /* determine LM type from the specified LM files */ if (lm->ngram_filename_lr_arpa || lm->ngram_filename_rl_arpa || lm->ngram_filename) { /* n-gram specified */ lm->lmtype = LM_PROB; lm->lmvar = LM_NGRAM; } if (lm->gramlist_root) { /* DFA grammar specified */ if (lm->lmtype != LM_UNDEF) { jlog("ERROR: m_chkparam: LM conflicts: several LM of different type specified?\n"); return FALSE; } lm->lmtype = LM_DFA; lm->lmvar = LM_DFA_GRAMMAR; } if (lm->dfa_filename) { /* DFA grammar specified by "-dfa" */ if (lm->lmtype != LM_UNDEF && lm->lmvar != LM_DFA_GRAMMAR) { jlog("ERROR: m_chkparam: LM conflicts: several LM of different type specified?\n"); return FALSE; } lm->lmtype = LM_DFA; lm->lmvar = LM_DFA_GRAMMAR; } if (lm->wordlist_root) { /* word list specified */ if (lm->lmtype != LM_UNDEF) { jlog("ERROR: m_chkparam: LM conflicts: several LM of different type specified?\n"); return FALSE; } lm->lmtype = LM_DFA; lm->lmvar = LM_DFA_WORD; } } if (lm->lmtype == LM_UNDEF) { /* an LM is not specified */ jlog("ERROR: m_chkparam: you should specify at least one LM to run Julius!\n"); return FALSE; } if (lm->lmtype == LM_PROB) { if (lm->dictfilename == NULL) { jlog("ERROR: m_chkparam: needs dictionary file (-v dict_file)\n"); ok_p = FALSE; } } /* file existence check */ if (lm->dictfilename != NULL) if (!checkpath(lm->dictfilename)) ok_p = FALSE; if (lm->ngram_filename != NULL) if (!checkpath(lm->ngram_filename)) ok_p = FALSE; if (lm->ngram_filename_lr_arpa != NULL) if (!checkpath(lm->ngram_filename_lr_arpa)) ok_p = FALSE; if (lm->ngram_filename_rl_arpa != NULL) if (!checkpath(lm->ngram_filename_rl_arpa)) ok_p = FALSE; if (lm->dfa_filename != NULL) if (!checkpath(lm->dfa_filename)) ok_p = FALSE; } for(am = jconf->am_root; am; am = am->next) { /* check if needed files are specified */ if (am->hmmfilename == NULL) { jlog("ERROR: m_chkparam: needs HMM definition file (-h hmmdef_file)\n"); ok_p = FALSE; } /* file existence check */ if (am->hmmfilename != NULL) if (!checkpath(am->hmmfilename)) ok_p = FALSE; if (am->mapfilename != NULL) if (!checkpath(am->mapfilename)) ok_p = FALSE; if (am->hmm_gs_filename != NULL) if (!checkpath(am->hmm_gs_filename)) ok_p = FALSE; /* cmn{save,load}_filename allows missing file (skipped if missing) */ if (am->frontend.ssload_filename != NULL) if (!checkpath(am->frontend.ssload_filename)) ok_p = FALSE; } if (jconf->reject.gmm_filename != NULL) if (!checkpath(jconf->reject.gmm_filename)) ok_p = FALSE; if (jconf->input.inputlist_filename != NULL) { if (jconf->input.speech_input != SP_RAWFILE && jconf->input.speech_input != SP_MFCFILE && jconf->input.speech_input != SP_OUTPROBFILE) { jlog("WARNING: m_chkparam: not file input, \"-filelist %s\" ignored\n", jconf->input.inputlist_filename); } else { if (!checkpath(jconf->input.inputlist_filename)) ok_p = FALSE; } } /* set default realtime flag according to input mode */ if (jconf->decodeopt.force_realtime_flag) { if (jconf->input.type == INPUT_VECTOR) { jlog("WARNING: m_chkparam: real-time concurrent processing is not needed on feature vector input\n"); jlog("WARNING: m_chkparam: real-time flag has turned off\n"); jconf->decodeopt.realtime_flag = FALSE; } else { jconf->decodeopt.realtime_flag = jconf->decodeopt.forced_realtime; } } /* check for cmn */ if (jconf->decodeopt.realtime_flag) { for(am = jconf->am_root; am; am = am->next) { if (am->analysis.cmn_update == FALSE && am->analysis.cmnload_filename == NULL) { jlog("ERROR: m_chkparam: when \"-cmnnoupdate\", initial cepstral normalisation data should be given by \"-cmnload\"\n"); ok_p = FALSE; } } } /* set values for search config */ for(s=jconf->search_root;s;s=s->next) { lm = s->lmconf; am = s->amconf; /* force context dependency handling flag for word-recognition mode */ if (lm->lmtype == LM_DFA && lm->lmvar == LM_DFA_WORD) { /* disable inter-word context dependent handling ("-no_ccd") */ s->ccd_handling = FALSE; s->force_ccd_handling = TRUE; /* force 1pass ("-1pass") */ s->compute_only_1pass = TRUE; } /* set default iwcd1 method from lm */ /* WARNING: THIS WILL BEHAVE WRONG IF MULTIPLE LM TYPE SPECIFIED */ /* RECOMMEND USING EXPLICIT OPTION */ if (am->iwcdmethod == IWCD_UNDEF) { switch(lm->lmtype) { case LM_PROB: am->iwcdmethod = IWCD_NBEST; break; case LM_DFA: am->iwcdmethod = IWCD_AVG; break; } } } /* check option validity with the current lm type */ /* just a warning message for user */ for(s=jconf->search_root;s;s=s->next) { lm = s->lmconf; am = s->amconf; if (lm->lmtype != LM_PROB) { /* in case not a probabilistic model */ if (s->lmp.lmp_specified) { jlog("WARNING: m_chkparam: \"-lmp\" only for N-gram, ignored\n"); } if (s->lmp.lmp2_specified) { jlog("WARNING: m_chkparam: \"-lmp2\" only for N-gram, ignored\n"); } if (s->lmp.lm_penalty_trans != 0.0) { jlog("WARNING: m_chkparam: \"-transp\" only for N-gram, ignored\n"); } if (lm->head_silname && !strmatch(lm->head_silname, BEGIN_WORD_DEFAULT)) { jlog("WARNING: m_chkparam: \"-silhead\" only for N-gram, ignored\n"); } if (lm->tail_silname && !strmatch(lm->tail_silname, END_WORD_DEFAULT)) { jlog("WARNING: m_chkparam: \"-siltail\" only for N-gram, ignored\n"); } if (lm->enable_iwspword) { jlog("WARNING: m_chkparam: \"-iwspword\" only for N-gram, ignored\n"); } if (lm->iwspentry && !strmatch(lm->iwspentry, IWSPENTRY_DEFAULT)) { jlog("WARNING: m_chkparam: \"-iwspentry\" only for N-gram, ignored\n"); } #ifdef HASH_CACHE_IW if (s->pass1.iw_cache_rate != 10) { jlog("WARNING: m_chkparam: \"-iwcache\" only for N-gram, ignored\n"); } #endif #ifdef SEPARATE_BY_UNIGRAM if (lm->separate_wnum != 150) { jlog("WARNING: m_chkparam: \"-sepnum\" only for N-gram, ignored\n"); } #endif } if (lm->lmtype != LM_DFA) { /* in case not a deterministic model */ if (s->pass2.looktrellis_flag) { jlog("WARNING: m_chkparam: \"-looktrellis\" only for grammar, ignored\n"); } if (s->output.multigramout_flag) { jlog("WARNING: m_chkparam: \"-multigramout\" only for grammar, ignored\n"); } if (s->lmp.penalty1 != 0.0) { jlog("WARNING: m_chkparam: \"-penalty1\" only for grammar, ignored\n"); } if (s->lmp.penalty2 != 0.0) { jlog("WARNING: m_chkparam: \"-penalty2\" only for grammar, ignored\n"); } } } if (!ok_p) { jlog("ERROR: m_chkparam: could not pass parameter check\n"); } else { jlog("STAT: jconf successfully finalized\n"); } if (debug2_flag) { print_jconf_overview(jconf); } return ok_p; }