Esempio n. 1
0
/* 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);
}
Esempio n. 2
0
/* HTS_ModelSet_load_duration: load duration model and number of state */
HTS_Boolean HTS_ModelSet_load_duration(HTS_ModelSet * ms, HTS_File ** pdf_fp, HTS_File ** tree_fp, int interpolation_size)
{
   /* check */
   if (ms == NULL) {
      return FALSE;
   }
   if (interpolation_size <= 0) {
      HTS_ModelSet_clear(ms);
      return FALSE;
   }
   if (pdf_fp == NULL) {
      HTS_error(1, "HTS_ModelSet_load_duration: File for duration PDFs is not specified.\n");
      HTS_ModelSet_clear(ms);
      return FALSE;
   }
   if (tree_fp == NULL) {
      HTS_error(1, "HTS_ModelSet_load_duration: File for duration trees is not specified.\n");
      HTS_ModelSet_clear(ms);
      return FALSE;
   }

   if (HTS_Stream_load_pdf_and_tree(&ms->duration, pdf_fp, tree_fp, interpolation_size) == FALSE) {
      HTS_ModelSet_clear(ms);
      return FALSE;
   }
   ms->nstate = ms->duration.vector_length;

   return TRUE;
}
Esempio n. 3
0
/* HTS_ModelSet_load_duration: load duration model and number of state */
void HTS_ModelSet_load_duration(HTS_ModelSet * ms, FILE ** pdf_fp,
                                FILE ** tree_fp, int interpolation_size)
{
   /* check */
   if (pdf_fp == NULL)
      HTS_error(1,
                "HTS_ModelSet_load_duration: File for duration PDFs is not specified.\n");
   if (tree_fp == NULL)
      HTS_error(1,
                "HTS_ModelSet_load_duration: File for duration trees is not specified.\n");

   HTS_Stream_load_pdf_and_tree(&ms->duration, pdf_fp, tree_fp, FALSE,
                                interpolation_size);
   ms->nstate = ms->duration.vector_length;
}
Esempio n. 4
0
/* 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;
}
Esempio n. 5
0
/* HTS_ModelSet_load_gv: load GV model */
void HTS_ModelSet_load_gv(HTS_ModelSet * ms, FILE ** pdf_fp, FILE ** tree_fp,
                          int stream_index, int interpolation_size)
{
   int i;

   /* check */
   if (pdf_fp == NULL)
      HTS_error(1,
                "HTS_ModelSet_load_gv: File for GV pdfs is not specified.\n");
   /* initialize */
   if (!ms->gv) {
      ms->gv = (HTS_Stream *) HTS_calloc(ms->nstream, sizeof(HTS_Stream));
      for (i = 0; i < ms->nstream; i++)
         HTS_Stream_initialize(&ms->gv[i]);
   }
   if (tree_fp)
      HTS_Stream_load_pdf_and_tree(&ms->gv[stream_index], pdf_fp, tree_fp,
                                   FALSE, interpolation_size);
   else
      HTS_Stream_load_pdf(&ms->gv[stream_index], pdf_fp, 1, FALSE,
                          interpolation_size);
}
Esempio n. 6
0
/* HTS_ModelSet_load_gv: load GV model */
HTS_Boolean HTS_ModelSet_load_gv(HTS_ModelSet * ms, HTS_File ** pdf_fp, HTS_File ** tree_fp, int stream_index, int interpolation_size)
{
   int i;

   /* check */
   if (ms == NULL) {
      return FALSE;
   }
   if (stream_index < 0 || stream_index >= ms->nstream || interpolation_size <= 0) {
      HTS_ModelSet_clear(ms);
      return FALSE;
   }
   if (pdf_fp == NULL) {
      HTS_error(1, "HTS_ModelSet_load_gv: File for GV pdfs is not specified.\n");
      HTS_ModelSet_clear(ms);
      return FALSE;
   }
   /* initialize */
   if (!ms->gv) {
      ms->gv = (HTS_Stream *) HTS_calloc(ms->nstream, sizeof(HTS_Stream));
      for (i = 0; i < ms->nstream; i++)
         HTS_Stream_initialize(&ms->gv[i]);
   }
   if (tree_fp) {
      if (HTS_Stream_load_pdf_and_tree(&ms->gv[stream_index], pdf_fp, tree_fp, interpolation_size) == FALSE) {
         HTS_ModelSet_clear(ms);
         return FALSE;
      }
   } else {
      if (HTS_Stream_load_pdf(&ms->gv[stream_index], pdf_fp, 1, interpolation_size) == FALSE) {
         HTS_ModelSet_clear(ms);
         return FALSE;
      }
   }

   return TRUE;
}