// file: bw_train_constants.h
//
// definitions file for the BW training
//

// make sure definitions are made only once
//
#ifndef __ISIP_BW_TRAIN_CONSTANTS
#define __ISIP_BW_TRAIN_CONSTANTS

// isip include files
//  
#ifndef __ISIP_INTEGRAL_CONSTANTS
#include <integral_constants.h>
#endif

// forward declaration of classes
//
#ifndef __ISIP_TRAIN_HASH_CELL_CONSTANTS
#include <hash_cell_constants.h>
#endif

#ifndef __ISIP_TRAIN_HASH_TABLE_CONSTANTS
#include <hash_table_constants.h>
#endif

#ifndef __ISIP_TRAIN_LINK_LIST_CONSTANTS
#include <link_list_constants.h>
#endif

#ifndef __ISIP_TRAIN_LINK_NODE_CONSTANTS
#include <link_node_constants.h>
#endif

#ifndef __ISIP_TRAIN_MEMORY_MANAGER_CONSTANTS
#include <memory_manager_constants.h>
#endif

#ifndef __ISIP_TRAIN_MODEL_CONSTANTS
#include <model_constants.h>
#endif

#ifndef __ISIP_TRAIN_PHONE_CONSTANTS
#include <phone_constants.h>
#endif

#ifndef __ISIP_TRAIN_STATE_CONSTANTS
#include <state_constants.h>
#endif

#ifndef __ISIP_TRAIN_TRACE_CONSTANTS
#include <trace_constants.h>
#endif

#ifndef __ISIP_TRAIN_WORD_CONSTANTS
#include <word_constants.h>
#endif

// define the help file
//
#define BW_HELP_FILE (char_1*)"$ISIP_PROTO/doc/bw_train.help"

// phonetic context units
//
#define BW_TRIPHONE_SIZE (int_4)3

// define some special phones
//
#define BW_SP_PHONE (int_4)0
#define BW_SILENCE_PHONE (int_4)1
#define BW_NULL_PHONE (int_4)0

// define some special words
//
#define BW_SENT_START_WORD WRD_SENT_START_WORD
#define BW_SENT_END_WORD WRD_SENT_END_WORD

// strings for user-level control input in demo mode
//
#define BW_ABORT (int_4)-1

// characters used to trigger filename expansion via a system call ---
// since this is expensive, we only want to do it when it is
// absolutely necessary
//
#define BW_ENV_DELIMITERS (char_1*)"$~(){}[]?"

// define levels of the search network
//
#define BW_STATE_LEVEL TRACE_STATE_LEVEL
#define BW_PHONE_LEVEL TRACE_PHONE_LEVEL
#define BW_WORD_LEVEL TRACE_WORD_LEVEL
#define BW_NUM_LEVELS TRACE_NUM_LEVELS

//  define strings corresponding to users' choice
//
#define BW_MODEL_ALIGN_NAME (char_1*)"model"
#define BW_STATE_ALIGN_NAME (char_1*)"state"
#define BW_CONTEXT_EXP_CROSS_WORD_NAME (char_1*)"cross_word"
#define BW_CONTEXT_EXP_WORD_INTERNAL_NAME (char_1*)"word_internal"

// parameter file related constants (user choices)
//
#define BW_ALIGN_MODE_NAME (char_1*)"align_mode"
#define BW_INPUT_MODE_NAME (char_1*)"input_mode"
#define BW_OUTPUT_MODE_NAME (char_1*)"output_mode"
#define BW_VAR_FLOOR_NAME (char_1*)"variance_floor"
#define BW_MLF_MODE_NAME (char_1*)"mlf_mode"
#define BW_TRAIN_MODE_NAME (char_1*)"train_mode"
#define BW_CONTEXT_MODE_NAME (char_1*)"context_mode"
#define BW_WORD_INTERNAL_NAME (char_1*)"word_internal"
#define BW_MONO_PHONE_NAME (char_1*)"monophone"
#define BW_CROSS_WORD_NAME (char_1*)"cross_word"
#define BW_BEAM_WIDTH_NAME (char_1*)"beam_width"
#define BW_COM_TH_NAME (char_1*)"combined_threshold"
#define BW_TRANS_MODE_NAME (char_1*) "transcription_mode"
#define BW_MIN_MPD_NAME (char_1*)"min_mpd"
#define BW_STATE_OCC_NAME (char_1*)"state_occupancy"
#define BW_MIN_OCCP_NAME (char_1*)"min_occupancy"

//  define values corresponding to users' choice
//
#define BW_MODEL_ALIGN TRACE_PHONE_LEVEL
#define BW_STATE_ALIGN TRACE_STATE_LEVEL
#define BW_CONTEXT_EXP_CROSS_WORD (int_4)0
#define BW_CONTEXT_EXP_WORD_INTERNAL (int_4)1

// define DFs
//
#define BW_DF_ALIGN_MODE BW_MODEL_ALIGN
#define BW_DF_CONTEXT_MODE BW_CROSS_WORD
#define BW_DF_INPUT_MODE BW_ASCII_MODE
#define BW_DF_INPUT_FEATURE_FORMAT BW_ISIP_PROTO_FORMAT
#define BW_DF_OUTPUT_MODE BW_ASCII_MODE
#define BW_DF_PHONE_SIZE BW_TRIPHONE_SIZE
#define BW_DF_BEAM_WIDTH 1.0e10
#define BW_DF_MIN_OCCP 1.0e-10
#define BW_DF_MIN_MPD (int_4)1000
#define BW_DF_OCC_MODE BW_OPT_OFF
#define BW_DF_DELTA_WIN (int_4)2
#define BW_DF_DELTA ISIP_FALSE
#define BW_DF_ACC ISIP_FALSE

// commandline identifiers
//
#define BW_PARAMS_OPT "-p"
#define BW_CONTEXT_OPT "-c"
#define BW_HELP_OPT "-help"

// on and off options
//
#define BW_OPT_ON (int_4)1
#define BW_OPT_OFF (int_4)0
#define BW_OPT_ON_NAME (char_1*)"on"
#define BW_OPT_OFF_NAME (char_1*)"off"

// parameter file options
//
#define BW_MONOPHONE_FILE "monophones_file"
#define BW_TRANSITIONS_FILE "transitions_file"
#define BW_STATES_FILE "states_file"
#define BW_UPDATED_STATE_FILE "updated_states_file"
#define BW_MODELS_FILE  "models_file"
#define BW_UPDATED_TRANS_FILE "updated_trans_file"
#define BW_PHONES_FILE "phones_file"
#define BW_LABLIST_FILE "lablist_file"
#define BW_MFCCLIST_FILE "mfcclist_file"
#define BW_LEXICON_FILE "lexicon_file"
#define BW_ACC_FILE "acc_file"
#define BW_ACCLIST_FILE "acclist_file"
#define BW_STATE_OCC_FILE "state_occupancy_file"
#define BW_VARIANCE_FLOOR_FILE "variance_floor_file"
#define BW_MIN_MODEL_COUNT_NAME (char_1*)"min_model_count"

// default model count modes
//
#define BW_DEF_MIN_MOD_COUNT (int_4) 3;

// training mode related parameters
//
#define BW_BATCH_MODE_NAME "batch"
#define BW_NORMAL_MODE_NAME "normal"
#define BW_COMBINE_MODE_NAME "combine"
#define BW_DF_TRAIN_MODE BW_NORMAL_MODE
#define BW_NORMAL_MODE (int_4)0
#define BW_BATCH_MODE (int_4)1
#define BW_COMBINE_MODE (int_4)2

// output mode
//
#define BW_OUTPUT_MODE "output_mode"

// context size related parameters
//
#define BW_DEF_TRIPHONE 3
#define BW_WRD_INTERNAL (int_4)2
#define BW_MONOPHONE (int_4)1
#define BW_CROSS_WORD (int_4)3

// input feature modes and transcription modes
//
#define BW_ASCII_MODE 0
#define BW_ASCII "ascii"
#define BW_BINARY_MODE 1
#define BW_BINARY "binary"
#define BW_MODEL_TRANS ISIP_TRUE

// input feature file format
//
#define BW_INPUT_FEATURE_FORMAT "input_feature_format"
#define BW_ISIP_PROTO "isip_proto"
#define BW_HTK "htk"
#define BW_ISIP_PROTO_FORMAT 0
#define BW_HTK_FORMAT 1

// file reading formats
//
#define BW_UTT_ID_FORMAT (char_1*)"\"*/%s.lab""\n"
#define BW_MAX_TRANS_LENGTH 4096

// constants string for the format of parameter files
//
#define BW_STR_NUM_MODELS "num_models"
#define BW_STR_NUM_MONOPHONES "num_monophones"
#define BW_STR_NUM_PHONES "num_phones"
#define BW_STR_NUM_TRANSITIONS "num_transitions"

// define the sp string
//
#define BW_SP_STRING "sp"
#define BW_SIL_STRING "sil"
#define BW_LOG_ZERO -1.0e10
#define BW_LOG_ONE (float_8)0.00
#define BW_LOG_MIN -0.5e10
#define BW_MIN_LARG 2.45e-308
#define BW_MIN_EARG -708.3
#define BW_MAX_NUM_STATE (int_4)1500
#define BW_INIT_MOD_INDEX (int_4)-1
#define BW_MINUS_LOG_INF -23.0258509299405

// define the transcription mode related stuff
//
#define BW_DF_TRANS_MODE BW_PHONE_TRANS
#define BW_PHONE_TRANS 0
#define BW_WORD_TRANS 1
#define BW_PHONE_TRANS_NAME (char_1*) "phone"
#define BW_WORD_TRANS_NAME (char_1*) "word"

// define the delta and acceleration constants
//
#define BW_OPT_DELTA_WIN (char_1*) "delta_window"
#define BW_OPT_COMPUTE_DELTA (char_1*) "compute_delta"
#define BW_OPT_COMPUTE_ACC (char_1*) "compute_acc"
#define BW_YES (char_1*) "yes"
#define BW_NO (char_1*) "no"

// end of file
//
#endif
