// file: dec_read_6.cc
//
 
// isip include files
//
#include "decoder.h"
#include "decoder_constants.h"
 
// method: read_ngram_cc
//
// arguments:
//  FILE* fp: (input) file pointer
//  
// return: a logical_1 indicating status
//
// this method reads in the ngram lm data from file into an ngram
// object
//
logical_1 Decoder::read_ngram_cc(FILE* fp_a) {

  // check file
  //
  if (fp_a == (FILE*)NULL) {
    error_handler_cc((char_1*)"read_ngram_cc",
		     (char_1*)"NULL input file pointer");
  }
  
  // initialize ngram if not done so
  //
  if (ngram_d == (Ngram*)NULL) {
    ngram_d = new Ngram();
  }
  ngram_d->set_order_cc(ngram_order_d);

  // read the ngram from file
  //
  ngram_d->read_ngram_cc(fp_a, lexicon_d);
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
