// file: ngrm_cstr_0.cc
//

// isip include files
//
#include "ngram.h"
#include "ngram_constants.h"

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

  // delete the ngram lists
  //
  if (ngram_lists_d != (Ngram_list**)NULL) {

    // loop over all ngram lists
    //
    for (int_4 i = 0; i < ngram_order_d; i++) {
      
      // delete only if necessary
      //
      if (ngram_lists_d[i] != (Ngram_list*)NULL) {
	delete ngram_lists_d[i];
	ngram_lists_d[i] = (Ngram_list*)NULL;
      }
    } 
    delete [] ngram_lists_d;
    ngram_lists_d = (Ngram_list**)NULL;
  }
  
  // reset ngram order
  //
  ngram_order_d = NGRAM_DEFAULT_ORDER;

  // reset lm params
  //
  lmscale_d = NGRAM_LMSCALE;
  wdpenalty_d = NGRAM_WDPENALTY;

  // exit gracefully
  //
}
