src/ccmain/reject.cpp
float compute_reject_threshold(WERD_CHOICE *word) {
  float threshold;      // rejection threshold
  float bestgap = 0.0f; // biggest gap
  float gapstart;       // bottom of gap

  auto blob_count = word->length();
  std::vector<float> ratings;
  ratings.reserve(blob_count);
  for (unsigned i = 0; i < blob_count; ++i) {
    ratings.push_back(word->certainty(i));
  }
  std::sort(ratings.begin(), ratings.end());
  gapstart = ratings[0] - 1; // all reject if none better
  if (blob_count >= 3) {
    for (unsigned index = 0; index < blob_count - 1; index++) {
      if (ratings[index + 1] - ratings[index] > bestgap) {
        bestgap = ratings[index + 1] - ratings[index];
        // find biggest
        gapstart = ratings[index];
      }
    }
  }
  threshold = gapstart + bestgap / 2;

  return threshold;
}
/**********************************************************************
 * compute_reject_threshold
 *
 * Set a rejection threshold for this word.
 * Initially this is a trivial function which looks for the largest
 * gap in the certainty value.
 **********************************************************************/
compute_reject_threshold
Set a rejection threshold for this word.
Initially this is a trivial function which looks for the largest
gap in the certainty value.
compute_reject_threshold Set a rejection threshold for this word . Initially this is a trivial function which looks for the largest gap in the certainty value .
float compute_reject_threshold(WERD_CHOICE *word) {
  float threshold;      
  float bestgap = 0.0f; 
  float gapstart;       
  auto blob_count = word->length();
  std::vector<float> ratings;
  ratings.reserve(blob_count);
  for (unsigned i = 0; i < blob_count; ++i) {
    ratings.push_back(word->certainty(i));
  }
  std::sort(ratings.begin(), ratings.end());
  gapstart = ratings[0] - 1; 
  if (blob_count >= 3) {
    for (unsigned index = 0; index < blob_count - 1; index++) {
      if (ratings[index + 1] - ratings[index] > bestgap) {
        bestgap = ratings[index + 1] - ratings[index];
        gapstart = ratings[index];
      }
    }
  }
  threshold = gapstart + bestgap / 2;
  return threshold;
}
float compute_reject_threshold ( WERD_CHOICE * word ) { float threshold ; float bestgap = 0.0f ; float gapstart ; auto blob_count = word -> length ( ) ; std :: vector < float > ratings ; ratings . reserve ( blob_count ) ; for ( unsigned i = 0 ; i < blob_count ; ++ i ) { ratings . push_back ( word -> certainty ( i ) ) ; } std :: sort ( ratings . begin ( ) , ratings . end ( ) ) ; gapstart = ratings [ 0 ] - 1 ; if ( blob_count >= 3 ) { for ( unsigned index = 0 ; index < blob_count - 1 ; index ++ ) { if ( ratings [ index + 1 ] - ratings [ index ] > bestgap ) { bestgap = ratings [ index + 1 ] - ratings [ index ] ; gapstart = ratings [ index ] ; } } } threshold = gapstart + bestgap / 2 ; return threshold ; }
compute_reject_threshold
 Set a rejection threshold for this word.
compute_reject_threshold Set a rejection threshold for this word .
// rejection threshold // biggest gap // bottom of gap // all reject if none better // find biggest