/* HTS_ModelSet_load_parameter: load model */ void HTS_ModelSet_load_parameter(HTS_ModelSet * ms, FILE ** pdf_fp, FILE ** tree_fp, FILE ** win_fp, int stream_index, HTS_Boolean msd_flag, int window_size, int interpolation_size) { int i; /* check */ if (pdf_fp == NULL) HTS_error(1, "HTS_ModelSet_load_parameter: File for pdfs is not specified.\n"); if (tree_fp == NULL) HTS_error(1, "HTS_ModelSet_load_parameter: File for wins is not specified.\n"); if (win_fp == NULL) HTS_error(1, "HTS_ModelSet_load_parameter: File for wins is not specified.\n"); /* initialize */ if (!ms->stream) { ms->stream = (HTS_Stream *) HTS_calloc(ms->nstream, sizeof(HTS_Stream)); for (i = 0; i < ms->nstream; i++) HTS_Stream_initialize(&ms->stream[i]); } /* load */ HTS_Stream_load_pdf_and_tree(&ms->stream[stream_index], pdf_fp, tree_fp, msd_flag, interpolation_size); HTS_Stream_load_dynamic_window(&ms->stream[stream_index], win_fp, window_size); }
/* HTS_ModelSet_load_parameter: load model */ HTS_Boolean HTS_ModelSet_load_parameter(HTS_ModelSet * ms, HTS_File ** pdf_fp, HTS_File ** tree_fp, HTS_File ** win_fp, int stream_index, int window_size, int interpolation_size) { int i; /* check */ if (ms == NULL) { return FALSE; } if (stream_index < 0 || stream_index >= ms->nstream || window_size <= 0 || interpolation_size <= 0) { HTS_ModelSet_clear(ms); return FALSE; } if (pdf_fp == NULL) { HTS_error(1, "HTS_ModelSet_load_parameter: File for pdfs is not specified.\n"); HTS_ModelSet_clear(ms); return FALSE; } if (tree_fp == NULL) { HTS_error(1, "HTS_ModelSet_load_parameter: File for wins is not specified.\n"); HTS_ModelSet_clear(ms); return FALSE; } if (win_fp == NULL) { HTS_error(1, "HTS_ModelSet_load_parameter: File for wins is not specified.\n"); HTS_ModelSet_clear(ms); return FALSE; } /* initialize */ if (!ms->stream) { ms->stream = (HTS_Stream *) HTS_calloc(ms->nstream, sizeof(HTS_Stream)); for (i = 0; i < ms->nstream; i++) HTS_Stream_initialize(&ms->stream[i]); } /* load */ if (HTS_Stream_load_pdf_and_tree(&ms->stream[stream_index], pdf_fp, tree_fp, interpolation_size) == FALSE) { HTS_ModelSet_clear(ms); return FALSE; } if (HTS_Stream_load_dynamic_window(&ms->stream[stream_index], win_fp, window_size) == FALSE) { HTS_ModelSet_clear(ms); return FALSE; } return TRUE; }