// file: $isip/class/pr/HiddenMarkovModel/hmm_00.cc
// version: $Id: hmm_00.cc 10498 2006-03-15 21:42:32Z may $
//

// isip include files
//
#include "HiddenMarkovModel.h"

//------------------------------------------------------------------------
//
// required public methods
//
//-----------------------------------------------------------------------

// method: destructor
//
// arguments: none
//
// return: none
//
// this is the default destructor
//
HiddenMarkovModel::~HiddenMarkovModel() {}

// method: default constructor
//
// arguments: none
//
// return: none
//
// this is the default constructor
//
HiddenMarkovModel::HiddenMarkovModel() {

  // initialize protected data
  //
  algorithm_d = DEF_ALGORITHM;
  implementation_d = DEF_IMPLEMENTATION;
  
  nbest_paths_d = DEF_NBEST_PATHS;
  max_nbest_paths_d = DEF_MAX_NBEST_PATHS;
  nbest_beam_d = DEF_NBEST_BEAM;
  
  context_mode_d = DEF_CONTEXT_MODE;
  function_mode_d = DEF_FUNCTION_MODE;  
  update_mode_d = DEF_UPDATE_MODE;  
  output_mode_d = DEF_MODE;
  output_format_d = DEF_FORMAT;
  output_type_d = DEF_TYPE;  
  num_iterations_d = DEF_NUM_ITERATIONS;  
  num_levels_d = DEF_NUM_LEVELS;
  num_mixtures_d = DEF_NUM_MIXTURES;  
  verify_d = DEF_VERIFY;

  beta_threshold_d = DEF_BETA_PRUNING_THRESHOLD;
  trellis_d = (BiGraph<TrainNode>*)NULL;
  context_level_d = DEF_CONTEXT_LEVEL;
  context_order_d = DEF_CONTEXT_ORDER;

  initial_level_d = DEF_INITIAL_LEVEL;
  alignment_level_d = DEF_ALIGNMENT_LEVEL;
}

// method: copy constructor
//
// arguments:
//  const HiddenMarkovModel& arg: (input) copy arg
//
// return: none
//
// this is the copy constructor
//
HiddenMarkovModel::HiddenMarkovModel(const HiddenMarkovModel& arg_a) {
  assign(arg_a);
}

//-----------------------------------------------------------------------------
//
// we define non-integral constants in the default constructor
//      
//-----------------------------------------------------------------------------

// constants: required constants such as class name
//
const String HiddenMarkovModel::CLASS_NAME(L"HiddenMarkovModel");

// constants: NameMap(s) for the enumerated values
//
const NameMap HiddenMarkovModel::ALGO_MAP(L"DECODE, TRAIN, MODEL_CREATION, INITIALIZE, MIXTURE_SPLITTING, CONTEXT_GENERATION, TRAIN_PARAMETER_TYING, TEST_PARAMETER_TYING, FORCED_ALIGNMENT, MLLR, MAP, SYMBOL_GRAPH_GENERATION, SYMBOL_GRAPH_RESCORING, NBEST_GENERATION");
const NameMap HiddenMarkovModel::IMPL_MAP(L"VITERBI, STACK, BAUM_WELCH, GLOBAL, VARIANCE_SPLITTING, SYMBOL_GENERATION, ML, MODEL_GENERATION, WORD_DEPENDENT_NBEST, VITERBI_NBEST, RESCORE_ACOUSTIC, RESCORE_LANGUAGE, RESCORE_BOTH");
const NameMap HiddenMarkovModel::MODE_MAP(L"FILE, TRANSFORM, LIST, DATABASE");
const NameMap HiddenMarkovModel::CONTEXT_MODE_MAP(L"SYMBOL_ONLY, SYMBOL_INTERNAL, CROSS_SYMBOL");
const NameMap HiddenMarkovModel::FUNCTION_MODE_MAP(L"NONE, GRAMMAR_DECODING, NETWORK_DECODING, ACCUMULATE, UPDATE");
const NameMap HiddenMarkovModel::FORMAT_MAP(L"NIST_SCORE, NATIVE, JSGF, IHD, XML, ABNF, BNF, SYMBOL_GRAPH");
const NameMap HiddenMarkovModel::TYPE_MAP(L"TEXT, BINARY");
const NameMap HiddenMarkovModel::UPDATE_MODE_MAP(L"TRANSITIONS, OBSERVATIONS, ALL");

// constants: default values
//
const String HiddenMarkovModel::DEF_TRANSCRIPTION_LEVEL(L"unknown");
const String HiddenMarkovModel::DEF_SYMBOL_GRAPH_LEVEL(L"unknown");
const String HiddenMarkovModel::DEF_FORCE_ALIGNMENT_LEVEL(L"unknown");

// constants: i/o related constants
//
const String HiddenMarkovModel::DEF_PARAM(L"");
const String HiddenMarkovModel::PARAM_TRANSCRIPTION_LEVEL(L"transcription_level");
const String HiddenMarkovModel::PARAM_SYMBOL_GRAPH_LEVEL(L"symbol_graph_level");
const String HiddenMarkovModel::PARAM_FORCE_ALIGNMENT_LEVEL(L"alignment_level");
const String HiddenMarkovModel::PARAM_ALGORITHM(L"algorithm");
const String HiddenMarkovModel::PARAM_IMPLEMENTATION(L"implementation");
const String HiddenMarkovModel::PARAM_NUM_MIXTURES(L"num_mixtures");
const String HiddenMarkovModel::PARAM_UPDATE_LEVELS(L"update_levels");
const String HiddenMarkovModel::PARAM_NUM_ITERATIONS(L"num_iterations");
const String HiddenMarkovModel::PARAM_VAR_FLOOR_FILE(L"variance_floor_file");
const String HiddenMarkovModel::PARAM_VAR_FLOOR(L"variance_floor");
const String HiddenMarkovModel::PARAM_BETA_THRESHOLD(L"beta_threshold");
const String HiddenMarkovModel::PARAM_MIN_MPD(L"min_mpd");
const String HiddenMarkovModel::PARAM_MIN_OCCUPANCY(L"min_occupancy");
const String HiddenMarkovModel::PARAM_MIN_MODEL_COUNT(L"min_model_count");
const String HiddenMarkovModel::PARAM_LANGUAGE_MODEL(L"language_model");
const String HiddenMarkovModel::PARAM_STATISTICAL_MODEL_POOL(L"statistical_model_pool");
const String HiddenMarkovModel::PARAM_CONFIGURATION(L"configuration");
const String HiddenMarkovModel::PARAM_FRONT_END(L"frontend");
const String HiddenMarkovModel::PARAM_TRANS_DB(L"transcription_database");
const String HiddenMarkovModel::PARAM_AUDIO_DB(L"audio_database");
const String HiddenMarkovModel::PARAM_SYMBOL_GRAPH_DB(L"symbol_graph_database");
const String HiddenMarkovModel::PARAM_UPDATE_LANGUAGE_MODEL(L"update_language_model");
const String HiddenMarkovModel::PARAM_UPDATE_STATISTICAL_MODEL_POOL(L"update_statistical_model_pool");
const String HiddenMarkovModel::PARAM_QUES_ANS(L"phonetic_ques_ans");
const String HiddenMarkovModel::PARAM_PHONETIC_DT(L"phonetic_decisiontree");
const String HiddenMarkovModel::PARAM_PHONETIC_DT_SPLIT_THRESHOLD(L"split_threshold");
const String HiddenMarkovModel::PARAM_PHONETIC_DT_MERGE_THRESHOLD(L"merge_threshold");
const String HiddenMarkovModel::PARAM_PHONETIC_DT_NUM_OCC_THRESHOLD(L"num_occ_threshold");
const String HiddenMarkovModel::PARAM_MLLR(L"mllr");
const String HiddenMarkovModel::PARAM_NBEST_PATHS(L"nbest_paths");
const String HiddenMarkovModel::PARAM_MAX_NBEST_PATHS(L"max_nbest_paths");
const String HiddenMarkovModel::PARAM_NBEST_BEAM(L"nbest_beam");
const String HiddenMarkovModel::PARAM_CONTEXT_LEVEL(L"context_level");
const String HiddenMarkovModel::PARAM_CONTEXT_ORDER(L"context_order");
const String HiddenMarkovModel::PARAM_OUTPUT_MODE(L"output_mode");
const String HiddenMarkovModel::PARAM_OUTPUT_FORMAT(L"output_format");
const String HiddenMarkovModel::PARAM_OUTPUT_TYPE(L"output_type");
const String HiddenMarkovModel::PARAM_OUTPUT_LEVELS(L"output_levels");
const String HiddenMarkovModel::PARAM_UPDATE_MODE(L"update_mode");
const String HiddenMarkovModel::PARAM_FUNCTION_MODE(L"function_mode");
const String HiddenMarkovModel::PARAM_CONTEXT_MODE(L"context_mode");
const String HiddenMarkovModel::PARAM_OUTPUT_FILE(L"output_file");
const String HiddenMarkovModel::PARAM_ACCUMULATOR(L"accumulator");
const String HiddenMarkovModel::PARAM_ACCUMULATOR_LIST(L"accumulator_list");
const String HiddenMarkovModel::PARAM_OUTPUT_LIST(L"output_list");
const String HiddenMarkovModel::PARAM_CONTEXT_LIST(L"context_list");
const String HiddenMarkovModel::OPTION_MODE_FILE(L"FILE");
const String HiddenMarkovModel::OPTION_MODE_TRANSFORM(L"TRANSFORM");
const String HiddenMarkovModel::OPTION_MODE_LIST(L"LIST");
const String HiddenMarkovModel::OPTION_MODE_DATABASE(L"DATABASE");
const String HiddenMarkovModel::OPTION_FORMAT_NIST_SCORE(L"NIST_SCORE");
const String HiddenMarkovModel::OPTION_FORMAT_NATIVE(L"NATIVE");
const String HiddenMarkovModel::OPTION_FORMAT_JSGF(L"JSGF");
const String HiddenMarkovModel::OPTION_UPDATE_TRANSITIONS(L"TRANSITIONS");
const String HiddenMarkovModel::OPTION_UPDATE_OBSERVATIONS(L"OBSERVATIONS");
const String HiddenMarkovModel::OPTION_TEXT(L"TEXT");
const String HiddenMarkovModel::OPTION_BINARY(L"BINARY");
const String HiddenMarkovModel::OPTION_UPDATE_ALL(L"ALL");
const String HiddenMarkovModel::OPTION_FUNCTION_NONE(L"NONE");
const String HiddenMarkovModel::OPTION_FUNCTION_GRAMMAR_DECODING(L"GRAMMAR_DECODING");
const String HiddenMarkovModel::OPTION_FUNCTION_NETWORK_DECODING(L"NETWORK_DECODING");
const String HiddenMarkovModel::OPTION_FUNCTION_ACCUMULATE(L"ACCUMULATE");
const String HiddenMarkovModel::OPTION_FUNCTION_UPDATE(L"UPDATE");
const String HiddenMarkovModel::OPTION_TRANSCRIPTION_LEVEL(L"level");

// static instantiations: memory manager, debug level and verbosity
//
MemoryManager HiddenMarkovModel::mgr_d(sizeof(HiddenMarkovModel),
				       HiddenMarkovModel::CLASS_NAME);

Integral::DEBUG HiddenMarkovModel::debug_level_d = Integral::NONE;
Integral::DEBUG HiddenMarkovModel::verbosity_d = Integral::NONE;
