📄 m_options.c
字号:
jconf->input.use_ds48to16 = TRUE; continue; } else if (strmatch(argv[i],"-version") || strmatch(argv[i], "--version") || strmatch(argv[i], "-setting") || strmatch(argv[i], "--setting")) { /* print version and exit */ j_put_header(stderr); j_put_compile_defs(stderr); fprintf(stderr, "\n"); j_put_library_defs(stderr); return FALSE; } else if (strmatch(argv[i],"-quiet")) { /* minimum output */ debug2_flag = verbose_flag = FALSE; continue; } else if (strmatch(argv[i],"-debug")) { /* debug mode: output huge log */ debug2_flag = verbose_flag = TRUE; continue; } else if (strmatch(argv[i],"-callbackdebug")) { /* output callback debug message */ callback_debug_flag = TRUE; continue; } else if (strmatch(argv[i],"-progout")) { /* enable progressive output */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; jconf->searchnow->output.progout_flag = TRUE; continue; } else if (strmatch(argv[i],"-proginterval")) { /* interval for -progout */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->output.progout_interval = atoi(tmparg); continue; } else if (strmatch(argv[i],"-demo")) { /* quiet + progout */ debug2_flag = verbose_flag = FALSE; jconf->searchnow->output.progout_flag = TRUE; continue; } else if (strmatch(argv[i],"-walign")) { /* do forced alignment by word */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; jconf->searchnow->annotate.align_result_word_flag = TRUE; continue; } else if (strmatch(argv[i],"-palign")) { /* do forced alignment by phoneme */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; jconf->searchnow->annotate.align_result_phoneme_flag = TRUE; continue; } else if (strmatch(argv[i],"-salign")) { /* do forced alignment by state */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; jconf->searchnow->annotate.align_result_state_flag = TRUE; continue; } else if (strmatch(argv[i],"-output")) { /* output up to N candidate */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->output.output_hypo_maxnum = atoi(tmparg); continue; } else if (strmatch(argv[i],"-1pass")) { /* do only 1st pass */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; jconf->searchnow->compute_only_1pass = TRUE; continue; } else if (strmatch(argv[i],"-hlist")) { /* HMM list file */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; FREE_MEMORY(jconf->amnow->mapfilename); GET_TMPARG; jconf->amnow->mapfilename = filepath(tmparg, cwd); continue; } else if (strmatch(argv[i],"-nlr")) { /* word LR n-gram (ARPA) */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; FREE_MEMORY(jconf->lmnow->ngram_filename_lr_arpa); GET_TMPARG; jconf->lmnow->ngram_filename_lr_arpa = filepath(tmparg, cwd); FREE_MEMORY(jconf->lmnow->ngram_filename); continue; } else if (strmatch(argv[i],"-nrl")) { /* word RL n-gram (ARPA) */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; FREE_MEMORY(jconf->lmnow->ngram_filename_rl_arpa); GET_TMPARG; jconf->lmnow->ngram_filename_rl_arpa = filepath(tmparg, cwd); FREE_MEMORY(jconf->lmnow->ngram_filename); continue; } else if (strmatch(argv[i],"-lmp")) { /* LM weight and penalty (pass1) */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->lmp.lm_weight = (LOGPROB)atof(tmparg); GET_TMPARG; jconf->searchnow->lmp.lm_penalty = (LOGPROB)atof(tmparg); jconf->searchnow->lmp.lmp_specified = TRUE; continue; } else if (strmatch(argv[i],"-lmp2")) { /* LM weight and penalty (pass2) */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->lmp.lm_weight2 = (LOGPROB)atof(tmparg); GET_TMPARG; jconf->searchnow->lmp.lm_penalty2 = (LOGPROB)atof(tmparg); jconf->searchnow->lmp.lmp2_specified = TRUE; continue; } else if (strmatch(argv[i],"-transp")) { /* penalty for transparent word */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->lmp.lm_penalty_trans = (LOGPROB)atof(tmparg); continue; } else if (strmatch(argv[i],"-gram")) { /* comma-separatedlist of grammar prefix */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; GET_TMPARG; if (multigram_add_prefix_list(tmparg, cwd, jconf->lmnow, LM_DFA_GRAMMAR) == FALSE) { jlog("ERROR: m_options: failed to read some grammars\n"); return FALSE; } continue; } else if (strmatch(argv[i],"-gramlist")) { /* file of grammar prefix list */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; GET_TMPARG; tmparg = filepath(tmparg, cwd); if (multigram_add_prefix_filelist(tmparg, jconf->lmnow, LM_DFA_GRAMMAR) == FALSE) { jlog("ERROR: m_options: failed to read some grammars\n"); free(tmparg); return FALSE; } free(tmparg); continue; } else if (strmatch(argv[i],"-userlm")) { if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; /* just set lm flags here */ if (jconf->lmnow->lmtype != LM_PROB && jconf->lmnow->lmtype != LM_UNDEF) { jlog("ERROR: m_options: LM type conflicts: multiple LM specified?\n"); return FALSE; } jconf->lmnow->lmtype = LM_PROB; if (jconf->lmnow->lmvar != LM_UNDEF && jconf->lmnow->lmvar != LM_NGRAM_USER) { jlog("ERROR: m_options: statistical model conflict\n"); return FALSE; } jconf->lmnow->lmvar = LM_NGRAM_USER; continue; } else if (strmatch(argv[i],"-nogram")) { /* remove grammar list */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; multigram_remove_gramlist(jconf->lmnow); FREE_MEMORY(jconf->lmnow->dfa_filename); FREE_MEMORY(jconf->lmnow->dictfilename); if (jconf->lmnow->lmtype == LM_UNDEF) { jconf->lmnow->lmtype = LM_DFA; jconf->lmnow->lmvar = LM_DFA_GRAMMAR; } continue; } else if (strmatch(argv[i],"-dfa")) { /* DFA filename */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; FREE_MEMORY(jconf->lmnow->dfa_filename); GET_TMPARG; jconf->lmnow->dfa_filename = filepath(tmparg, cwd); continue; } else if (strmatch(argv[i],"-penalty1")) { /* word insertion penalty (pass1) */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->lmp.penalty1 = (LOGPROB)atof(tmparg); continue; } else if (strmatch(argv[i],"-penalty2")) { /* word insertion penalty (pass2) */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->lmp.penalty2 = (LOGPROB)atof(tmparg); continue; } else if (strmatch(argv[i],"-spmodel") || strmatch(argv[i], "-sp")) { /* name of short pause word */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; FREE_MEMORY(jconf->amnow->spmodel_name); GET_TMPARG; jconf->amnow->spmodel_name = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg); continue; } else if (strmatch(argv[i],"-multipath")) { /* force multipath mode */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; jconf->amnow->force_multipath = TRUE; continue; } else if (strmatch(argv[i],"-iwsp")) { /* enable inter-word short pause handing (for multipath) */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; jconf->lmnow->enable_iwsp = TRUE; continue; } else if (strmatch(argv[i],"-iwsppenalty")) { /* set inter-word short pause transition penalty (for multipath) */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; GET_TMPARG; jconf->amnow->iwsp_penalty = atof(tmparg); continue; } else if (strmatch(argv[i],"-silhead")) { /* head silence word name */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; FREE_MEMORY(jconf->lmnow->head_silname); GET_TMPARG; jconf->lmnow->head_silname = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg); continue; } else if (strmatch(argv[i],"-siltail")) { /* tail silence word name */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; FREE_MEMORY(jconf->lmnow->tail_silname); GET_TMPARG; jconf->lmnow->tail_silname = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg); continue; } else if (strmatch(argv[i],"-mapunk")) { /* unknown word */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; strncpy(jconf->lmnow->unknown_name, tmparg, UNK_WORD_MAXLEN); continue; } else if (strmatch(argv[i],"-iwspword")) { /* add short pause word */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; jconf->lmnow->enable_iwspword = TRUE; continue; } else if (strmatch(argv[i],"-iwspentry")) { /* content of the iwspword */ if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; FREE_MEMORY(jconf->lmnow->iwspentry); GET_TMPARG; jconf->lmnow->iwspentry = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg); continue; } else if (strmatch(argv[i],"-iwcache")) { /* control cross-word LM cache */#ifdef HASH_CACHE_IW if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->pass1.iw_cache_rate = atof(tmparg); if (jconf->searchnow->pass1.iw_cache_rate > 100) jconf->searchnow->pass1.iw_cache_rate = 100; if (jconf->searchnow->pass1.iw_cache_rate < 1) jconf->searchnow->pass1.iw_cache_rate = 1;#else jlog("WARNING: m_options: HASH_CACHE_IW disabled, \"-iwcache\" ignored\n");#endif continue; } else if (strmatch(argv[i],"-sepnum")) { /* N-best frequent word will be separated from tree */#ifdef SEPARATE_BY_UNIGRAM if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE; GET_TMPARG; jconf->lmnow->separate_wnum = atoi(tmparg);#else jlog("WARNING: m_options: SEPARATE_BY_UNIGRAM disabled, \"-sepnum\" ignored\n"); i++;#endif continue;#ifdef USE_NETAUDIO } else if (strmatch(argv[i],"-NA")) { /* netautio device name */ if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE; FREE_MEMORY(jconf->input.netaudio_devname); GET_TMPARG; jconf->input.netaudio_devname = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg); continue;#endif } else if (strmatch(argv[i],"-adport")) { /* adinnet port num */ if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE; GET_TMPARG; jconf->input.adinnet_port = atoi(tmparg); continue; } else if (strmatch(argv[i],"-nostrip")) { /* do not strip zero samples */ if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE; jconf->preprocess.strip_zero_sample = FALSE; continue; } else if (strmatch(argv[i],"-zmean")) { /* enable DC offset by zero mean */ if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE; jconf->preprocess.use_zmean = TRUE; continue; } else if (strmatch(argv[i],"-nozmean")) { /* disable DC offset by zero mean */ if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE; jconf->preprocess.use_zmean = FALSE; continue; } else if (strmatch(argv[i],"-zmeanframe")) { /* enable frame-wise DC offset by zero mean */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; jconf->amnow->analysis.para.zmeanframe = TRUE; continue; } else if (strmatch(argv[i],"-nozmeanframe")) { /* disable frame-wise DC offset by zero mean */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; jconf->amnow->analysis.para.zmeanframe = FALSE; continue; } else if (strmatch(argv[i],"-usepower")) { /* use power instead of magnitude in filterbank analysis */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; jconf->amnow->analysis.para.usepower = TRUE; continue; } else if (strmatch(argv[i],"-nousepower")) { /* use magnitude in fbank analysis (default) */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; jconf->amnow->analysis.para.usepower = FALSE; continue; } else if (strmatch(argv[i],"-spsegment")) { /* enable short-pause segmentation */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; jconf->searchnow->successive.enabled = TRUE; continue; } else if (strmatch(argv[i],"-spdur")) { /* speech down-trigger duration threshold in frame */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->successive.sp_frame_duration = atoi(tmparg); continue;#ifdef SPSEGMENT_NAIST } else if (strmatch(argv[i],"-spmargin")) { /* speech up-trigger backstep margin in frame */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->successive.sp_margin = atoi(tmparg); continue; } else if (strmatch(argv[i],"-spdelay")) { /* speech up-trigger delay frame */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->successive.sp_delay = atoi(tmparg); continue;#endif } else if (strmatch(argv[i],"-pausemodels")) { /* short-pause duration threshold */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; FREE_MEMORY(jconf->searchnow->successive.pausemodelname); GET_TMPARG; jconf->searchnow->successive.pausemodelname = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg); continue; } else if (strmatch(argv[i],"-gprune")) { /* select Gaussian pruning method */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; GET_TMPARG; if (strmatch(tmparg,"safe")) { /* safest, slowest */ jconf->amnow->gprune_method = GPRUNE_SEL_SAFE; } else if (strmatch(tmparg,"heuristic")) { jconf->amnow->gprune_method = GPRUNE_SEL_HEURISTIC; } else if (strmatch(tmparg,"beam")) { /* fastest */ jconf->amnow->gprune_method = GPRUNE_SEL_BEAM; } else if (strmatch(tmparg,"none")) { /* no prune: compute all Gaussian */ jconf->amnow->gprune_method = GPRUNE_SEL_NONE; } else if (strmatch(tmparg,"default")) { jconf->amnow->gprune_method = GPRUNE_SEL_UNDEF;#ifdef ENABLE_PLUGIN } else if ((sid = plugin_find_optname("calcmix_get_optname", tmparg)) != -1) { /* mixture calculation plugin */ jconf->amnow->gprune_method = GPRUNE_SEL_USER; jconf->amnow->gprune_plugin_source = sid;#endif } else { jlog("ERROR: m_options: no such pruning method \"%s\"\n", argv[0], tmparg); return FALSE; } continue;/* * } else if (strmatch(argv[i],"-reorder")) { * result_reorder_flag = TRUE; * continue; */ } else if (strmatch(argv[i],"-no_ccd")) { /* force triphone handling = OFF */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; jconf->searchnow->ccd_handling = FALSE; jconf->searchnow->force_ccd_handling = TRUE; continue; } else if (strmatch(argv[i],"-force_ccd")) { /* force triphone handling = ON */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; jconf->searchnow->ccd_handling = TRUE; jconf->searchnow->force_ccd_handling = TRUE; continue; } else if (strmatch(argv[i],"-iwcd1")) { /* select cross-word triphone computation method */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; GET_TMPARG; if (strmatch(tmparg, "max")) { /* use maximum score in triphone variants */ jconf->amnow->iwcdmethod = IWCD_MAX; } else if (strmatch(tmparg, "avg")) { /* use average in variants */ jconf->amnow->iwcdmethod = IWCD_AVG; } else if (strmatch(tmparg, "best")) { /* use average in variants */ jconf->amnow->iwcdmethod = IWCD_NBEST; GET_TMPARG; jconf->amnow->iwcdmaxn = atoi(tmparg); } else { jlog("ERROR: m_options: -iwcd1: wrong argument (max|avg|best N): %s\n", argv[0], tmparg); return FALSE; } continue; } else if (strmatch(argv[i],"-tmix")) { /* num of mixture to select */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; if (i + 1 < argc && isdigit(argv[i+1][0])) { jconf->amnow->mixnum_thres = atoi(argv[++i]); } continue; } else if (strmatch(argv[i],"-b2") || strmatch(argv[i],"-bw") || strmatch(argv[i],"-wb")) { /* word beam width in 2nd pass */ if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE; GET_TMPARG; jconf->searchnow->pass2.enveloped_bestfirst_width = atoi(tmparg); continue; } else if (strmatch(argv[i],"-hgs")) { /* Gaussian selection model file */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; FREE_MEMORY(jconf->amnow->hmm_gs_filename); GET_TMPARG; jconf->amnow->hmm_gs_filename = filepath(tmparg, cwd); continue; } else if (strmatch(argv[i],"-booknum")) { /* num of state to select in GS */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -