1 /** 2 * @file define.h 3 * 4 * <JA> 5 * @brief ������������Τ���Υ���ܥ���� 6 * 7 * configure ������ץȤϡ������ƥ�/�桼�����Ȥ������ config.h �˽Ф� 8 * �ޤ�. ���Υե�����Ǥϡ����� configure �����ꤵ�줿 config.h �������� 9 * ���ˡ�Julius/Julian �Τ������������ܥ�������Ԥ��ޤ�. 10 * �����ϼ¸��ѤΥ����ɤ��ڤ��ؤ���Ť����ץ����Ȥθߴ����Τ���� 11 * �������Ƥ����Τ��ۤȤ�ɤǤ�. �̾�Υ桼���Ϥ������������� 12 * ɬ�פϤ���ޤ���. 13 * </JA> 14 * 15 * <EN> 16 * @brief Internal symbol definitions 17 * 18 * The "configure" script will output the system- and user-dependent 19 * configuration in "config.h". This file defines some symboles 20 * according to the generated config.h, to switch internal functions. 21 * Most of the definitions here are for disabling experimental or debug 22 * code for development, or to keep compatibility with old Julius. These 23 * definitions are highly internal, and normal users should not alter 24 * these definitions without knowning what to do. 25 * </EN> 26 * 27 * @author Akinobu LEE 28 * @date Mon Mar 7 15:17:26 2005 29 * 30 * $Revision: 1.4 $ 31 * 32 */ 33 /* 34 * Copyright (c) 1991-2007 Kawahara Lab., Kyoto University 35 * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology 36 * Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology 37 * All rights reserved 38 */ 39 40 #ifndef __J_DEFINE_H__ 41 #define __J_DEFINE_H__ 42 43 44 /*****************************************************************************/ 45 /** DO NOT MODIFY MANUALLY DEFINES BELOW UNLESS YOU KNOW WHAT YOU ARE DOING **/ 46 /*****************************************************************************/ 47 48 /* type of language model */ 49 #define LM_UNDEF 0 ///< not specified 50 #define LM_PROB 1 ///< Statistical (N-gram - Julius) 51 #define LM_DFA 2 ///< DFA (Julian) 52 53 /* LM variation specification */ 54 #define LM_NGRAM 0 ///< N-gram 55 #define LM_DFA_GRAMMAR 1 ///< DFA grammar 56 #define LM_DFA_WORD 2 ///< Isolated word recognition 57 #define LM_NGRAM_USER 3 ///< User-defined statistical LM 58 59 /* recognition status */ 60 #define J_RESULT_STATUS_REJECT_POWER -6 ///< Input rejected by power 61 #define J_RESULT_STATUS_TERMINATE -5 ///< Input was terminated by app. request 62 #define J_RESULT_STATUS_ONLY_SILENCE -4 ///< Input contains only silence 63 #define J_RESULT_STATUS_REJECT_GMM -3 ///< Input rejected by GMM 64 #define J_RESULT_STATUS_REJECT_SHORT -2 ///< Input rejected by short input 65 #define J_RESULT_STATUS_FAIL -1 ///< Recognition ended with no candidate 66 #define J_RESULT_STATUS_SUCCESS 0 ///< Recognition output some result 67 68 /* delete incoherent option */ 69 /* CATEGORY_TREE: DFA=always on, NGRAM=always off */ 70 /* switch with recog->category_tree */ 71 /* UNIGRAM_FACTORING: DFA=always off, NGRAM=option */ 72 /* enclose UNIGRAM_FACTORING section with "if (lmtype == LM_NGRAM)" */ 73 74 /* abbreviations for verbose message output */ 75 #define VERMES if (verbose_flag) jlog 76 77 /** 78 * define this to report memory usage on exit (Linux only) 79 * 80 */ 81 #undef REPORT_MEMORY_USAGE 82 83 /*** N-gram tree construction ***/ 84 /* With 1-best approximation, Constructing a single tree from all words 85 causes much error by factoring. Listing each word flatly with no 86 tree-organization will not cause this error, but the network becomes 87 much larger and, especially, the inter-word LM handling becomes much more 88 complex (O(n^2)). The cost may be eased by LM caching, but it needs much 89 memory. */ 90 /* This is a trade-off of accuracy and cost */ 91 #define SHORT_WORD_LEN 2 92 #ifdef LOWMEM 93 /* don't separate, construct a single tree from all words */ 94 /* root nodes are about 50 in monophone, cache size will be 5MB on max */ 95 #define NO_SEPARATE_SHORT_WORD 96 #else 97 #ifdef LOWMEM2 98 /* experimental: separate words frequently appears in corpus (1-gram) */ 99 /* root nodes will be "-sepnum num" + 50, cache size will be 10MB or so */ 100 #define NO_SEPARATE_SHORT_WORD 101 #define SEPARATE_BY_UNIGRAM 102 #else 103 /* separate all short words (<= 2 phonemes) */ 104 /* root nodes are about 1100 in 20k (proportional to vocabulary), 105 cache size will be about 100MB on max */ 106 #endif /* LOWMEM2 */ 107 #endif /* LOWMEM */ 108 109 /*#define HASH_CACHE_IW*/ 110 /* "./configure --enable-lowmem" defines NO_SEPARATE_SHORT_WORD instead */ 111 112 /* default language model weight and insertion penalty for pass1 and pass2 */ 113 /* these values come from the best parameters in IPA evaluation result */ 114 #define DEFAULT_LM_WEIGHT_MONO_PASS1 5.0 115 #define DEFAULT_LM_PENALTY_MONO_PASS1 -1.0 116 #define DEFAULT_LM_WEIGHT_MONO_PASS2 6.0 117 #define DEFAULT_LM_PENALTY_MONO_PASS2 0.0 118 #ifdef PASS1_IWCD 119 #define DEFAULT_LM_WEIGHT_TRI_PASS1 8.0 120 #define DEFAULT_LM_PENALTY_TRI_PASS1 -2.0 121 #define DEFAULT_LM_WEIGHT_TRI_PASS2 8.0 122 #define DEFAULT_LM_PENALTY_TRI_PASS2 -2.0 123 #else 124 #define DEFAULT_LM_WEIGHT_TRI_PASS1 9.0 125 #define DEFAULT_LM_PENALTY_TRI_PASS1 8.0 126 #define DEFAULT_LM_WEIGHT_TRI_PASS2 11.0 127 #define DEFAULT_LM_PENALTY_TRI_PASS2 -2.0 128 #endif /* PASS1_IWCD */ 129 130 /* Switch head/tail word insertion penalty to be inserted */ 131 #undef FIX_PENALTY 132 133 /* some definitions for short-pause segmentation */ 134 #undef SP_BREAK_EVAL /* output messages for evaluation */ 135 #undef SP_BREAK_DEBUG /* output messages for debug */ 136 #undef SP_BREAK_RESUME_WORD_BEGIN /* resume word = maxword at beginning of sp area */ 137 138 #ifdef GMM_VAD 139 #define DEFAULT_GMM_MARGIN 20 /* backstep margin / determine buffer length */ 140 #define GMM_VAD_AUTOSHRINK_LIMIT 500 141 #undef GMM_VAD_DEBUG /* output debug message */ 142 #endif 143 144 /* default values for spseg_naist */ 145 #ifdef SPSEGMENT_NAIST 146 #define DEFAULT_SP_MARGIN 40 147 #define DEFAULT_SP_DELAY 4 148 #define SPSEGMENT_NAIST_AUTOSHRINK_LIMIT 500 149 #endif 150 151 /* '01/10/18 by ri: enable fix for trellis lookup order */ 152 #define PREFER_CENTER_ON_TRELLIS_LOOKUP 153 154 /* '01/11/28 by ri: malloc step for startnode for multipath mode */ 155 #define STARTNODE_STEP 300 156 157 /* default dict entry for IW-sp word that will be added to dict with -iwspword */ 158 #define IWSPENTRY_DEFAULT "<UNK> [sp] sp sp" 159 160 /* confidence scoring method */ 161 #ifdef CONFIDENCE_MEASURE 162 # ifndef CM_NBEST /* use conventional N-best CM, will be defined if "--enable-cm-nbest" specified */ 163 # define CM_SEARCH /* otherwise, use on-the-fly CM scoring */ 164 # endif 165 #endif 166 167 /* dynamic word graph generation */ 168 #undef GRAPHOUT_SEARCH_CONSIDER_RIGHT /* if defined, only hypothesis whose 169 left/right contexts is already 170 included in popped hypo will be merged. 171 EXPERIMENTAL, should not be defined. 172 */ 173 #ifdef CM_SEARCH_LIMIT 174 #undef CM_SEARCH_LIMIT_AFTER /* enable above only after 1 sentence found */ 175 #undef CM_SEARCH_LIMIT_POP /* terminate hypo of low CM on pop */ 176 #endif 177 178 /* compute exact boundary instead of using 1st pass result */ 179 /* also propagate exact time boundary to the right context after generation */ 180 /* this may produce precise word boundary, but cause bigger word graph output */ 181 #define GRAPHOUT_PRECISE_BOUNDARY 182 183 #undef GDEBUG /* enable debug message in graphout.c */ 184 185 /* some decoding fix candidates */ 186 #undef FIX_35_PASS2_STRICT_SCORE /* fix hypothesis scores by enabling 187 bt_discount_pescore() in standard mode 188 with PASS2_STRICT_IWCD, 189 */ 190 #define FIX_35_INHIBIT_SAME_WORD_EXPANSION /* privent connecting the same trellis word in 2nd pass */ 191 192 193 /* below are new since 3.5.2 */ 194 195 /** 196 * Allow overwriting existing graph word if score is higher. 197 * By default, while search, Julius merges the same graph words appeared at the 198 * same location as previously stored word, and terminate search. This 199 * option make Julius to continue search in that case if fscore_head of 200 * current hypo. is greater than the already existing one. In that case, 201 * the score of existing one will be overridden by the new higher one. 202 * (from 3.5.2) 203 * 204 */ 205 #define GRAPHOUT_OVERWRITE 206 207 /* with GRAPHOUT_OVERWRITE, use gscore_head instead of fscore_head */ 208 /** 209 * (EXPERIMENTAL) With GRAPHOUT_OVERWRITE, use gscore_head for the 210 * comparison instead of fscore_head. 211 * 212 */ 213 #undef GRAPHOUT_OVERWRITE_GSCORE 214 215 /** 216 * At post-processing of graph words, this option limits the number of 217 * "fit boundary" loop up to this value. This option is made to avoid 218 * long loop by the "boundary oscillation" of short words. (from 3.5.2) 219 * 220 */ 221 #define GRAPHOUT_LIMIT_BOUNDARY_LOOP 222 223 /** 224 * This option enables "-graphsearchdelay" and "-nographsearchdelay" option. 225 * When "-graphsearchdelay" option is set, Julius modifies its alogrithm of 226 * graph generation on the 2nd pass not to apply search termination by graph 227 * merging until the first sentence candidate is found. 228 * 229 * This option may result in slight improvement of graph accuracy only 230 * when you are going to generate a huge word graph by setting broad search. 231 * Namely, it may result in better graph accuracy when you set wide beams on 232 * both 1st pass "-b" and 2nd pass "-b2", and large number for "-n". 233 * 234 */ 235 #define GRAPHOUT_SEARCH_DELAY_TERMINATION 236 237 /** 238 * This option enables word graph cutting by word depth at post-processing. 239 * This option will erase many short words to explode at a wide beam width. 240 * 241 */ 242 #define GRAPHOUT_DEPTHCUT 243 244 /** 245 * Mimimal beam width that will be auto-determined for the 1st pass. 246 * See set_beam_width() and default_width() for details. 247 * 248 */ 249 #define MINIMAL_BEAM_WIDTH 200 250 251 /** 252 * (DEBUG) Use old full lcdset instead of category-pair-aware lcdset 253 * on Julian (-oldiwcd on 3.5.3 and previous) 254 */ 255 #undef USE_OLD_IWCD 256 257 /** 258 * (EXPERIMENTAL) early word determination on isolated word recognition mode. 259 * Results will be shown via CALLBACK_RESULT_PASS1_DETERMINED. 260 * 261 */ 262 #undef DETERMINE 263 264 #define FWD_NGRAM 265 266 #define MAX_SPEECH_ALLOC_STEP 320000 267 268 269 #define POWER_REJECT_DEFAULT_THRES 9.0 270 271 /** 272 * A test to find optimal warping factor for VTLN (EXPERIMENTAL) 273 * 274 */ 275 #undef DEBUG_VTLN_ALPHA_TEST 276 #define VTLN_RANGE 0.2 277 #define VTLN_STEP 0.02 278 279 /** 280 * Use fast successor composition at 1-gram factoring. 281 * 282 */ 283 #define FAST_FACTOR1_SUCCESSOR_LIST 284 285 286 #endif /* __J_DEFINE_H__ */ 287 288