diff -C 2 -P scratch/ctk_HMM_decoder.cpp src/ctk_HMM_decoder.cpp
*** scratch/ctk_HMM_decoder.cpp	Thu Feb 15 14:13:34 2001
--- src/ctk_HMM_decoder.cpp	Thu Feb 15 14:16:11 2001
***************
*** 11,14 ****
--- 11,16 ----
  /******************************************************************************/
   
+ // Patch Applied: v1.1.0_2 - Feb 15, 2001 -  Fixes bug in HYPOTHESIS_FILTER
+ 
  #include <math.h>
  #include <vector>
***************
*** 264,270 ****
  
   
!   if (hypothesis_filter_param->get_set_flag())
      filter=compile_regular_expression(hypothesis_filter_param->get_value());
!   else
      filter=0;
     
--- 266,273 ----
  
   
!   if (hypothesis_filter_param->get_set_flag()) {
!     DecoderInfo::setRequiresNBestTraceInfo(true);   // Make sure decoder stores NBest traceback info    
      filter=compile_regular_expression(hypothesis_filter_param->get_value());
!   } else
      filter=0;
     
***************
*** 278,282 ****
    // Set the static NBest decoding number
    DecoderInfo::setNBestDecoding(num_hyp);
!   
    if (use_deltas_param->get_set_flag()==0) {
      // If use_deltas not set explicitily then just use them if they are there
--- 281,285 ----
    // Set the static NBest decoding number
    DecoderInfo::setNBestDecoding(num_hyp);
! 
    if (use_deltas_param->get_set_flag()==0) {
      // If use_deltas not set explicitily then just use them if they are there
diff -C 2 -P scratch/ctk_HMM_decoder.hh src/ctk_HMM_decoder.hh
*** scratch/ctk_HMM_decoder.hh	Thu Feb 15 14:13:34 2001
--- src/ctk_HMM_decoder.hh	Thu Feb 15 14:16:25 2001
***************
*** 15,18 ****
--- 15,19 ----
  // The finer steps reduce the chance of the NBest search getting stuck in big recursions
  
+ // Patch Applied: v1.1.0_2 - Feb 15, 2001 -  Fixes bug in HYPOTHESIS_FILTER
  
  #ifndef CTK_HMM_DECODER_HH
Only in scratch: ctk_binary_ops.cpp
diff -C 2 -P scratch/ctk_decoder.cpp src/ctk_decoder.cpp
*** scratch/ctk_decoder.cpp	Thu Feb 15 14:13:45 2001
--- src/ctk_decoder.cpp	Thu Feb 15 14:16:37 2001
***************
*** 17,20 ****
--- 17,22 ----
  /******************************************************************************/
  
+ // Patch Applied: v1.1.0_2 - Feb 15, 2001 -  Fixes bug in HYPOTHESIS_FILTER
+ 
  #include <math.h>
  #include <vector>
***************
*** 37,40 ****
--- 39,43 ----
  int DecoderInfo::ndecoders = 0;
  int DecoderInfo::nbest_decoding = 1;
+ bool DecoderInfo::requires_nbest = false;
  
  DecoderInfo::DecoderInfo(SetOfHMMs *these_hmms, const string &start_token, const string &final_token, HMMFloat word_creation_penalty):hmms(these_hmms), unique_name("_\0"){
***************
*** 151,155 ****
  }
  
! void DecoderInfo::back_trace(vector<RecoHypothesis*> &hyps, HMMFloat threshold/*=-NBEST_THRESHOLD_STEP_SIZE*/) {
    network->backTrace(hyps, threshold);  
  }
--- 154,158 ----
  }
  
! void DecoderInfo::back_trace(vector<RecoHypothesis*> &hyps, HMMFloat threshold) {
    network->backTrace(hyps, threshold);  
  }
***************
*** 159,166 ****
  
    vector<RecoHypothesis*> *hypp = new vector<RecoHypothesis*>;
! 
    try {
!     back_trace(*hypp, FILTER_NBEST_N_CONST);
    } catch (CTKError &error) {
      cerr << "Problems encountered constructing N best list.\n\r";
    }
--- 162,175 ----
  
    vector<RecoHypothesis*> *hypp = new vector<RecoHypothesis*>;
!   int nbest=getNBestDecoding();
!   
    try {
!     // Set the size of the NBest list to the length by the filter
!     setNBestDecoding(FILTER_NBEST_N_CONST);
!     back_trace(*hypp, -NBEST_THRESHOLD_STEP_SIZE);
!     // Reset the NBest list size for normal operation
!     setNBestDecoding(nbest);
    } catch (CTKError &error) {
+     setNBestDecoding(nbest);
      cerr << "Problems encountered constructing N best list.\n\r";
    }
***************
*** 456,463 ****
  void NonEmittingNode::extendWordRecord(int frame) {
    if (hasValidToken()) {
!     if (DecoderInfo::getNBestDecoding()==1) {
!       token.extendWordRecord(frame, word_creation_penalty);
!     } else {
        token.extendWordRecord(frame, word_creation_penalty, new_tokens);
      }
    }
--- 465,472 ----
  void NonEmittingNode::extendWordRecord(int frame) {
    if (hasValidToken()) {
!     if (DecoderInfo::requiresNBestTraceInfo()) {
        token.extendWordRecord(frame, word_creation_penalty, new_tokens);
+     } else {
+       token.extendWordRecord(frame, word_creation_penalty);
      }
    }
***************
*** 717,721 ****
  }
  
! void NodeNetwork::backTrace(vector<RecoHypothesis*> &hyps, HMMFloat threshold/*=-NBEST_THRESHOLD_STEP_SIZE*/) {
  
    
--- 726,730 ----
  }
  
! void NodeNetwork::backTrace(vector<RecoHypothesis*> &hyps, HMMFloat threshold) {
  
    
***************
*** 736,740 ****
  
    int nbest_decoding=DecoderInfo::getNBestDecoding();
!   
    if (nbest_decoding>1) {
      sort(hyps.begin(), hyps.end(), compare_hypotheses);
--- 745,749 ----
  
    int nbest_decoding=DecoderInfo::getNBestDecoding();
! 
    if (nbest_decoding>1) {
      sort(hyps.begin(), hyps.end(), compare_hypotheses);
***************
*** 746,750 ****
    } else if (hyps.size()<(unsigned)nbest_decoding) {
      // Failed to retrieve nbest_decoding hypotheses - try again with a lower threshold
!     if (threshold<MIN_BACK_TRACE_THRESHOLD_CONST2) {
        cerr << "Warning: Fewer than " << nbest_decoding << " hypotheses available\n\r";
      } else
--- 755,759 ----
    } else if (hyps.size()<(unsigned)nbest_decoding) {
      // Failed to retrieve nbest_decoding hypotheses - try again with a lower threshold
!     if (threshold<MIN_BACK_TRACE_THRESHOLD_CONST) {
        cerr << "Warning: Fewer than " << nbest_decoding << " hypotheses available\n\r";
      } else
diff -C 2 -P scratch/ctk_decoder.hh src/ctk_decoder.hh
*** scratch/ctk_decoder.hh	Thu Feb 15 14:13:45 2001
--- src/ctk_decoder.hh	Thu Feb 15 13:03:05 2001
***************
*** 44,50 ****
    String masked_name;    // 0's,1's replaced with X to find decoders to merge
  
!   static void setNBestDecoding(int x) {nbest_decoding=x;}
    static int getNBestDecoding() {return nbest_decoding;}
! 
    void cleanUp();
    
--- 44,54 ----
    String masked_name;    // 0's,1's replaced with X to find decoders to merge
  
!   // Set/query the size of the NBest list
!   static void setNBestDecoding(int x) {nbest_decoding=x; if (x>1) requires_nbest=true;}
    static int getNBestDecoding() {return nbest_decoding;}
!   
!   static void setRequiresNBestTraceInfo(bool x) {requires_nbest=x;} 
!   static bool requiresNBestTraceInfo() {return requires_nbest;}
!   
    void cleanUp();
    
***************
*** 54,58 ****
    
    static int ndecoders;
!   static int nbest_decoding;
    
    Integer frame_number;
--- 58,65 ----
    
    static int ndecoders;
! 
!   static bool requires_nbest;   // Set to true if decoder needs to save NBest backtrace info
!   static int nbest_decoding;   // The size of the NBest list to report
! 
    
    Integer frame_number;
***************
*** 80,84 ****
    void token_pass(Integer frame_number, Float word_creation_penalty);
  
!   void back_trace(vector<RecoHypothesis*> &hyps, HMMFloat threshold=-NBEST_THRESHOLD_STEP_SIZE);
  
    // Find  a hypothesis that does not match regex
--- 87,91 ----
    void token_pass(Integer frame_number, Float word_creation_penalty);
  
!   void back_trace(vector<RecoHypothesis*> &hyps, HMMFloat threshold);
  
    // Find  a hypothesis that does not match regex
diff -C 2 -P scratch/ctk_reco.cpp src/ctk_reco.cpp
*** scratch/ctk_reco.cpp	Thu Feb 15 14:13:50 2001
--- src/ctk_reco.cpp	Thu Feb 15 14:16:53 2001
***************
*** 10,14 ****
  /*									      */
  /******************************************************************************/
!  
  #include <math.h>
  #include <vector>
--- 10,16 ----
  /*									      */
  /******************************************************************************/
! 
! // Patch Applied: v1.1.0_2 - Feb 15, 2001 -  Fixes bug in HYPOTHESIS_FILTER
! 
  #include <math.h>
  #include <vector>
***************
*** 41,44 ****
--- 43,47 ----
  Boolean RecoHypothesis::matches_filter(regex_t *filter) const {
  
+   cerr << "\rFILTER: " << solution.c_str() << "\r";
    return (regexec(filter, solution.c_str(), 0, NULL, 0)==0);
  }
diff -C 2 -P scratch/ctk_reco.hh src/ctk_reco.hh
*** scratch/ctk_reco.hh	Thu Feb 15 14:13:50 2001
--- src/ctk_reco.hh	Thu Feb 15 14:15:59 2001
***************
*** 11,14 ****
--- 11,16 ----
  /******************************************************************************/
  
+ // Patch Applied: v1.1.0_2 - Feb 15, 2001 -  Fixes bug in HYPOTHESIS_FILTER
+ 
  #ifndef CTK_RECO_HH
  #define CTK_RECO_HH
diff -C 2 -P scratch/patch_list src/patch_list
*** scratch/patch_list	Thu Feb 15 12:49:29 2001
--- src/patch_list	Thu Feb 15 13:07:09 2001
***************
*** 7,8 ****
--- 7,9 ----
  
  v1.1.0_1.patch  - ctk_binary_ops.cpp - Feb 15, 2001 - Fixes bug in DividerBlock
+ v1.1.0_2.patch  - ctk_decoder.* ctk_HMM_decoder.* ctk_reco.* - Feb 15, 2001 - Fexes bugs in HYPOTHESIS_FILTER mechanism
