static void ps_expand_model_config(ps_decoder_t *ps) { char const *hmmdir, *featparams; /* Disable memory mapping on Blackfin (FIXME: should be uClinux in general). */ #ifdef __ADSPBLACKFIN__ E_INFO("Will not use mmap() on uClinux/Blackfin."); cmd_ln_set_boolean_r(ps->config, "-mmap", FALSE); #endif /* Get acoustic model filenames and add them to the command-line */ if ((hmmdir = cmd_ln_str_r(ps->config, "-hmm")) != NULL) { ps_add_file(ps, "-mdef", hmmdir, "mdef"); ps_add_file(ps, "-mean", hmmdir, "means"); ps_add_file(ps, "-var", hmmdir, "variances"); ps_add_file(ps, "-tmat", hmmdir, "transition_matrices"); ps_add_file(ps, "-mixw", hmmdir, "mixture_weights"); ps_add_file(ps, "-sendump", hmmdir, "sendump"); ps_add_file(ps, "-fdict", hmmdir, "noisedict"); ps_add_file(ps, "-lda", hmmdir, "feature_transform"); ps_add_file(ps, "-featparams", hmmdir, "feat.params"); ps_add_file(ps, "-senmgau", hmmdir, "senmgau"); } /* Look for feat.params in acoustic model dir. */ if ((featparams = cmd_ln_str_r(ps->config, "-featparams"))) { if (NULL != cmd_ln_parse_file_r(ps->config, feat_defn, featparams, FALSE)) E_INFO("Parsed model-specific feature parameters from %s\n", featparams); } /* Print here because acmod_init might load feat.params file */ if (err_get_logfp() != NULL) { cmd_ln_print_values_r(ps->config, err_get_logfp(), ps_args()); } }
static void ps_init_defaults(ps_decoder_t *ps) { /* Disable memory mapping on Blackfin (FIXME: should be uClinux in general). */ #ifdef __ADSPBLACKFIN__ E_INFO("Will not use mmap() on uClinux/Blackfin."); cmd_ln_set_boolean_r(ps->config, "-mmap", FALSE); #endif char const *hmmdir; /* Get acoustic model filenames and add them to the command-line */ if ((hmmdir = cmd_ln_str_r(ps->config, "-hmm")) != NULL) { ps_add_file(ps, "-mdef", hmmdir, "mdef"); ps_add_file(ps, "-mean", hmmdir, "means"); ps_add_file(ps, "-var", hmmdir, "variances"); ps_add_file(ps, "-tmat", hmmdir, "transition_matrices"); ps_add_file(ps, "-mixw", hmmdir, "mixture_weights"); ps_add_file(ps, "-sendump", hmmdir, "sendump"); ps_add_file(ps, "-fdict", hmmdir, "noisedict"); ps_add_file(ps, "-lda", hmmdir, "feature_transform"); ps_add_file(ps, "-featparams", hmmdir, "feat.params"); ps_add_file(ps, "-senmgau", hmmdir, "senmgau"); } }
static void ps_init_defaults(ps_decoder_t *ps) { char const *hmmdir, *lmfile, *dictfile; /* Disable memory mapping on Blackfin (FIXME: should be uClinux in general). */ #ifdef __ADSPBLACKFIN__ E_INFO("Will not use mmap() on uClinux/Blackfin."); cmd_ln_set_boolean_r(ps->config, "-mmap", FALSE); #endif #ifdef MODELDIR /* Set default acoustic and language models. */ hmmdir = cmd_ln_str_r(ps->config, "-hmm"); lmfile = cmd_ln_str_r(ps->config, "-lm"); dictfile = cmd_ln_str_r(ps->config, "-dict"); if (hmmdir == NULL && hmmdir_exists(MODELDIR "/hmm/en_US/hub4wsj_sc_8k")) { hmmdir = MODELDIR "/hmm/en_US/hub4wsj_sc_8k"; cmd_ln_set_str_r(ps->config, "-hmm", hmmdir); } if (lmfile == NULL && !cmd_ln_str_r(ps->config, "-fsg") && !cmd_ln_str_r(ps->config, "-jsgf") && file_exists(MODELDIR "/lm/en_US/hub4.5000.DMP")) { lmfile = MODELDIR "/lm/en_US/hub4.5000.DMP"; cmd_ln_set_str_r(ps->config, "-lm", lmfile); } if (dictfile == NULL && file_exists(MODELDIR "/lm/en_US/cmu07a.dic")) { dictfile = MODELDIR "/lm/en_US/cmu07a.dic"; cmd_ln_set_str_r(ps->config, "-dict", dictfile); } /* Expand acoustic and language model filenames relative to installation path. */ if (hmmdir && !path_is_absolute(hmmdir) && !hmmdir_exists(hmmdir)) { char *tmphmm = string_join(MODELDIR "/hmm/", hmmdir, NULL); cmd_ln_set_str_r(ps->config, "-hmm", tmphmm); ckd_free(tmphmm); } if (lmfile && !path_is_absolute(lmfile) && !file_exists(lmfile)) { char *tmplm = string_join(MODELDIR "/lm/", lmfile, NULL); cmd_ln_set_str_r(ps->config, "-lm", tmplm); ckd_free(tmplm); } if (dictfile && !path_is_absolute(dictfile) && !file_exists(dictfile)) { char *tmpdict = string_join(MODELDIR "/lm/", dictfile, NULL); cmd_ln_set_str_r(ps->config, "-dict", tmpdict); ckd_free(tmpdict); } #endif /* Get acoustic model filenames and add them to the command-line */ if ((hmmdir = cmd_ln_str_r(ps->config, "-hmm")) != NULL) { ps_add_file(ps, "-mdef", hmmdir, "mdef"); ps_add_file(ps, "-mean", hmmdir, "means"); ps_add_file(ps, "-var", hmmdir, "variances"); ps_add_file(ps, "-tmat", hmmdir, "transition_matrices"); ps_add_file(ps, "-mixw", hmmdir, "mixture_weights"); ps_add_file(ps, "-sendump", hmmdir, "sendump"); ps_add_file(ps, "-fdict", hmmdir, "noisedict"); ps_add_file(ps, "-lda", hmmdir, "feature_transform"); ps_add_file(ps, "-featparams", hmmdir, "feat.params"); ps_add_file(ps, "-senmgau", hmmdir, "senmgau"); } }