src/retrieval based query topic analysis/src/edu/virginia/cs/index/OkapiBM25.java
@Override
    protected float score(BasicStats stats, float termFreq, float docLength) {
        float relevance;
        float part1 = (float) (Math.log((stats.getNumberOfDocuments() - stats.getDocFreq() + 0.5) / (stats.getDocFreq() + 0.5)) / Math.log(Math.E));
        float part2 = (float) (((k1 + 1) * termFreq) / ((k1 * (1 - b + b * (docLength / stats.getAvgFieldLength()))) + termFreq));
        float part3 = (float) (((k2 + 1) * 1) / (k2 + 1));
        relevance = part1 * part2 * part3;
        return relevance;
    }
/**
     * Returns a score for a single term in the document.
     *
     * @param stats Provides access to corpus-level statistics
     * @param termFreq
     * @param docLength
     */
Returns a score for a single term in the document.
@param stats Provides access to corpus-level statistics
@param termFreq
@param docLength
Returns a score for a single term in the document . @param stats Provides access to corpus - level statistics @param termFreq @param docLength
@Override
    protected float score(BasicStats stats, float termFreq, float docLength) {
        float relevance;
        float part1 = (float) (Math.log((stats.getNumberOfDocuments() - stats.getDocFreq() + 0.5) / (stats.getDocFreq() + 0.5)) / Math.log(Math.E));
        float part2 = (float) (((k1 + 1) * termFreq) / ((k1 * (1 - b + b * (docLength / stats.getAvgFieldLength()))) + termFreq));
        float part3 = (float) (((k2 + 1) * 1) / (k2 + 1));
        relevance = part1 * part2 * part3;
        return relevance;
    }
@ Override protected float score ( BasicStats stats , float termFreq , float docLength ) { float relevance ; float part1 = ( float ) ( Math . log ( ( stats . getNumberOfDocuments ( ) - stats . getDocFreq ( ) + 0.5 ) / ( stats . getDocFreq ( ) + 0.5 ) ) / Math . log ( Math . E ) ) ; float part2 = ( float ) ( ( ( k1 + 1 ) * termFreq ) / ( ( k1 * ( 1 - b + b * ( docLength / stats . getAvgFieldLength ( ) ) ) ) + termFreq ) ) ; float part3 = ( float ) ( ( ( k2 + 1 ) * 1 ) / ( k2 + 1 ) ) ; relevance = part1 * part2 * part3 ; return relevance ; }
Returns a score for a single term in the document.
Returns a score for a single term in the document .