src/ext/default.c
/* internal common tf-idf function, where just the normalization method changes */
internal common tf-idf function, where just the normalization method changes
internal common tf - idf function where just the normalization method changes
static inline double tfIdfInternal(const ScoringFunctionArgs *ctx, const RSIndexResult *h,
                                   const RSDocumentMetadata *dmd, double minScore, int normMode) {
  if (dmd->score == 0) return 0;
  double norm = normMode == NORM_MAXFREQ ? (double)dmd->maxFreq : dmd->len;
  double tfidf = dmd->score * tfidfRecursive(h, dmd) / norm;
  if (tfidf < minScore) {
    return 0;
  }
  tfidf /= (double)ctx->GetSlop(h);
  return tfidf;
}
static inline double tfIdfInternal ( const ScoringFunctionArgs * ctx , const RSIndexResult * h , const RSDocumentMetadata * dmd , double minScore , int normMode ) { if ( dmd -> score == 0 ) return 0 ; double norm = normMode == NORM_MAXFREQ ? ( double ) dmd -> maxFreq : dmd -> len ; double tfidf = dmd -> score * tfidfRecursive ( h , dmd ) / norm ; if ( tfidf < minScore ) { return 0 ; } tfidf /= ( double ) ctx -> GetSlop ( h ) ; return tfidf ; }
internal common tf-idf function, where just the normalization method changes
internal common tf - idf function where just the normalization method changes
// no need to factor the distance if tfidf is already below minimal score