/** * <EN> * Fill in system default values to an AM parameter structure. * @param j [in] AM configuration parameter structure * </EN> * <JA> * AMパラメータ構造体に初期値を代入する. * * @param j [in] AMパラメータ構造体 * </JA> * * * @callgraph * @callergraph * */ void jconf_set_default_values_am(JCONF_AM *j) { j->name[0] = '\0'; j->hmmfilename = NULL; j->mapfilename = NULL; j->gprune_method = GPRUNE_SEL_UNDEF; j->mixnum_thres = 2; j->spmodel_name = NULL; j->hmm_gs_filename = NULL; j->gs_statenum = 24; j->iwcdmethod = IWCD_UNDEF; j->iwcdmaxn = 3; j->iwsp_penalty = -1.0; j->force_multipath = FALSE; undef_para(&(j->analysis.para)); undef_para(&(j->analysis.para_hmm)); undef_para(&(j->analysis.para_default)); undef_para(&(j->analysis.para_htk)); make_default_para(&(j->analysis.para_default)); make_default_para_htk(&(j->analysis.para_htk)); j->analysis.cmnload_filename = NULL; j->analysis.cmn_update = TRUE; j->analysis.cmnsave_filename = NULL; j->analysis.cmn_map_weight = 100.0; j->frontend.ss_alpha = DEF_SSALPHA; j->frontend.ss_floor = DEF_SSFLOOR; j->frontend.sscalc = FALSE; j->frontend.sscalc_len = 300; j->frontend.ssload_filename = NULL; }
/** * <EN> * Fill in system default values to an AM parameter structure. * @param j [in] AM configuration parameter structure * </EN> * <JA> * AMパラメータ構造体に初期値を代入する. * * @param j [in] AMパラメータ構造体 * </JA> * * * @callgraph * @callergraph * */ void jconf_set_default_values_am(JCONF_AM *j) { j->name[0] = '\0'; j->hmmfilename = NULL; j->mapfilename = NULL; j->gprune_method = GPRUNE_SEL_UNDEF; j->mixnum_thres = 2; j->spmodel_name = NULL; j->hmm_gs_filename = NULL; j->gs_statenum = 24; j->iwcdmethod = IWCD_UNDEF; j->iwcdmaxn = 3; j->iwsp_penalty = -1.0; j->force_multipath = FALSE; undef_para(&(j->analysis.para)); undef_para(&(j->analysis.para_hmm)); undef_para(&(j->analysis.para_default)); undef_para(&(j->analysis.para_htk)); make_default_para(&(j->analysis.para_default)); make_default_para_htk(&(j->analysis.para_htk)); j->analysis.cmnload_filename = NULL; j->analysis.map_cmn = TRUE; j->analysis.cmn_update = TRUE; j->analysis.cmnsave_filename = NULL; j->analysis.cmn_map_weight = 100.0; j->analysis.cmn_static_cvn_only = FALSE; j->frontend.ss_alpha = DEF_SSALPHA; j->frontend.ss_floor = DEF_SSFLOOR; j->frontend.sscalc = FALSE; j->frontend.sscalc_len = 300; j->frontend.ssload_filename = NULL; j->dnn.enabled = FALSE; j->dnn.paramtype = F_ERR_INVALID; j->dnn.optionstring = NULL; j->dnn.veclen = 0; j->dnn.contextlen = 0; j->dnn.inputnodes = 0; j->dnn.outputnodes = 0; j->dnn.hiddennodes = 0; j->dnn.hiddenlayernum = 0; j->dnn.wfile = NULL; j->dnn.bfile = NULL; j->dnn.output_wfile = NULL; j->dnn.output_bfile = NULL; j->dnn.priorfile = NULL; j->dnn.prior_factor = 1.0; j->dnn.batchsize = 1; j->dnn.num_threads = 2; }
/** * <JA> * Gaussian Mixture Selection のための状態選択用モノフォンHMMを読み込む. * </JA> * <EN> * Initialize context-independent HMM for state selection with Gaussian * Mixture Selection. * </EN> * * @param amconf [in] AM configuratino variables * * @return the newly created HMM information structure, or NULL on failure. */ static HTK_HMM_INFO * initialize_GSHMM(JCONF_AM *amconf) { HTK_HMM_INFO *hmm_gs; Value para_dummy; jlog("STAT: Reading GS HMMs:\n"); hmm_gs = hmminfo_new(); undef_para(¶_dummy); if (init_hmminfo(hmm_gs, amconf->hmm_gs_filename, NULL, ¶_dummy) == FALSE) { hmminfo_free(hmm_gs); return NULL; } return(hmm_gs); }
int main(int argc, char *argv[]) { FILE *fp; char *hmmdefs_file; char *hmmlist_file; char *outfile; int i; hmmdefs_file = hmmlist_file = outfile = NULL; for(i=1;i<argc;i++) { if (hmmdefs_file == NULL) { hmmdefs_file = argv[i]; } else if (hmmlist_file == NULL) { hmmlist_file = argv[i]; } else if (outfile == NULL) { outfile = argv[i]; } else { usage(argv[0]); return -1; } } if (hmmdefs_file == NULL || hmmlist_file == NULL || outfile == NULL) { usage(argv[0]); return -1; } hmminfo = hmminfo_new(); printf("---- reading hmmdefs ----\n"); printf("filename: %s\n", hmmdefs_file); /* read hmmdef file */ undef_para(¶); if (init_hmminfo(hmminfo, hmmdefs_file, hmmlist_file, ¶) == FALSE) { fprintf(stderr, "--- terminated\n"); return -1; } if (hmminfo->is_triphone) { fprintf(stderr, "making pseudo bi/mono-phone for IW-triphone\n"); if (make_cdset(hmminfo) == FALSE) { fprintf(stderr, "ERROR: m_fusion: failed to make context-dependent state set\n"); return -1; } } printf("\n------------------------------------------------------------\n"); print_hmmdef_info(stdout, hmminfo); printf("\n"); printf("------------------------------------------------------------\n"); printf("---- writing logical-to-physical mapping and pseudo phone info ----\n"); printf("filename: %s\n", outfile); if ((fp = fopen_writefile(outfile)) == NULL) { fprintf(stderr, "failed to open %s for writing\n", outfile); return -1; } if (save_hmmlist_bin(fp, hmminfo) == FALSE) { fprintf(stderr, "failed to write to %s\n", outfile); return -1; } if (fclose_writefile(fp) != 0) { fprintf(stderr, "failed to close %s\n", outfile); return -1; } printf("\n"); printf("binary HMMList and pseudo phone definitions are written to \"%s\"\n", outfile); return 0; }
int main(int argc, char *argv[]) { FILE *fp; char *infile; char *outfile; char *conffile; int i; infile = outfile = conffile = NULL; for(i=1;i<argc;i++) { if (strmatch(argv[i], "-C") || strmatch(argv[i], "-htkconf")) { if (++i >= argc) { usage(argv[0]); return -1; } conffile = argv[i]; } else { if (infile == NULL) { infile = argv[i]; } else if (outfile == NULL) { outfile = argv[i]; } else { usage(argv[0]); return -1; } } } if (infile == NULL || outfile == NULL) { usage(argv[0]); return -1; } hmminfo = hmminfo_new(); printf("---- reading hmmdefs ----\n"); printf("filename: %s\n", infile); /* read hmmdef file */ undef_para(¶); if (init_hmminfo(hmminfo, infile, NULL, ¶) == FALSE) { fprintf(stderr, "--- terminated\n"); return -1; } if (conffile != NULL) { /* if input HMMDEFS already has embedded parameter they will be overridden by the parameters in the config file */ printf("\n---- reading HTK Config ----\n"); if (para.loaded == 1) { printf("Warning: input hmmdefs has acoustic analysis parameter information\n"); printf("Warning: they are overridden by the HTK Config file...\n"); } /* load HTK config file */ undef_para(¶); if (htk_config_file_parse(conffile, ¶) == FALSE) { fprintf(stderr, "Error: failed to read %s\n", conffile); return(-1); } /* set some parameters from HTK HMM header information */ printf("\nsetting TARGETKIND and NUMCEPS from HMM definition header..."); calc_para_from_header(¶, hmminfo->opt.param_type, hmminfo->opt.vec_size); printf("done\n"); /* fulfill unspecified values with HTK defaults */ printf("fulfill unspecified values with HTK defaults..."); undef_para(¶_htk); make_default_para_htk(¶_htk); apply_para(¶, ¶_htk); printf("done\n"); } printf("\n------------------------------------------------------------\n"); print_hmmdef_info(stdout, hmminfo); printf("\n"); if (para.loaded == 1) { put_para(stdout, ¶); } printf("------------------------------------------------------------\n"); printf("---- writing ----\n"); printf("filename: %s\n", outfile); if ((fp = fopen_writefile(outfile)) == NULL) { fprintf(stderr, "failed to open %s for writing\n", outfile); return -1; } if (write_binhmm(fp, hmminfo, (para.loaded == 1) ? ¶ : NULL) == FALSE) { fprintf(stderr, "failed to write to %s\n", outfile); return -1; } if (fclose_writefile(fp) != 0) { fprintf(stderr, "failed to close %s\n", outfile); return -1; } printf("\n"); if (para.loaded == 1) { printf("binary HMM written to \"%s\", with acoustic parameters embedded for Julius.\n", outfile); } else { printf("binary HMM written to \"%s\"\n", outfile); } return 0; }