Julius 4.2
libsent/src/hmminfo/check_hmmtype.c
説明を見る。
00001 
00018 /*
00019  * Copyright (c) 1991-2011 Kawahara Lab., Kyoto University
00020  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00021  * Copyright (c) 2005-2011 Julius project team, Nagoya Institute of Technology
00022  * All rights reserved
00023  */
00024 
00025 #include <sent/stddefs.h>
00026 #include <sent/htk_defs.h>
00027 #include <sent/htk_hmm.h>
00028 #include <sent/htk_param.h>
00029 
00037 boolean
00038 check_hmm_options(HTK_HMM_INFO *hmm)
00039 {
00040   boolean ret_flag = TRUE;
00041   
00042   /* 
00043    * if (hmm->opt.stream_info.num > 1) {
00044    *   jlog("Error: check_hmmtype: Input stream must be single\n");
00045    *   ret_flag = FALSE;
00046    * }
00047    */
00048 /* 
00049  *   if (hmm->opt.dur_type != D_NULL) {
00050  *     jlog("Error: check_hmmtype: Duration types other than NULLD are not supported.\n");
00051  *     ret_flag = FALSE;
00052  *   }
00053  */
00054   if (hmm->opt.cov_type != C_DIAG_C) {
00055     jlog("Error: check_hmmtype: Covariance matrix type must be DIAGC, others not supported.\n");
00056     ret_flag = FALSE;
00057   }
00058 
00059   return(ret_flag);
00060 }
00061 
00070 boolean
00071 check_param_coherence(HTK_HMM_INFO *hmm, HTK_Param *pinfo)
00072 {
00073   boolean ret_flag;
00074 
00075   ret_flag = TRUE;
00076 
00077   /* HMM type check */
00078   if (hmm->opt.param_type
00079       != (pinfo->header.samptype & ~(F_COMPRESS | F_CHECKSUM))) {
00080 /* 
00081  *     jlog("Error: check_hmmtype: incompatible parameter type\n");
00082  *     jlog("Error: check_hmmtype: HMM trained by %s\n", param_code2str(buf, hmm->opt.param_type, FALSE));
00083  *     jlog("Error: check_hmmtype: input parameter is %s\n", param_code2str(buf, pinfo->header.samptype, FALSE));
00084  */
00085     ret_flag = FALSE;
00086   }
00087 
00088   /* vector length check */
00089   if (hmm->opt.vec_size != pinfo->veclen) {
00090 /* 
00091  *     jlog("Error: check_hmmtype: vector length differ.\n");
00092  *     jlog("Error: check_hmmtype: HMM=%d, param=%d\n", hmm->opt.vec_size, pinfo->veclen);
00093  */
00094     ret_flag = FALSE;
00095   }
00096   
00097   return(ret_flag);
00098 }
00099 
00108 boolean
00109 check_param_basetype(HTK_HMM_INFO *hmm, HTK_Param *pinfo)
00110 {
00111   if ((hmm->opt.param_type & F_BASEMASK)
00112       != (pinfo->header.samptype & F_BASEMASK)) {
00113     return FALSE;
00114   } else {
00115     return TRUE;
00116   }
00117 }