/** * This method computes the score for the implemented weighting model. * @param tf The term frequency in the document * @param documentFrequency The document frequency of the term * @param termFrequency the term frequency in the collection * @param keyFrequency The normalised query term frequency. * @param documentLength The length of the document. * @return the score returned by the implemented weighting model. */ public double score( double tf, double documentFrequency, double termFrequency, double keyFrequency, double documentLength) { keyFrequency = tf_concave_k(keyFrequency, k_3); tf = tf_concave_k(tf, k_1); final double idf = log((numberOfDocuments - documentFrequency + 0.5d) / (documentFrequency + 0.5d)); return keyFrequency * tf * idf; } }
/** * This method computes the score for the implemented weighting model. * @param tf The term frequency in the document * @param documentFrequency The document frequency of the term * @param termFrequency the term frequency in the collection * @param keyFrequency The normalised query term frequency. * @param documentLength The length of the document. * @return the score returned by the implemented weighting model. */ public double score( double tf, double documentFrequency, double termFrequency, double keyFrequency, double documentLength) { keyFrequency = tf_concave_k(keyFrequency, k_3); tf = tf_concave_k(tf, k_1); final double idf = log((numberOfDocuments - documentFrequency + 0.5d) / (documentFrequency + 0.5d)); return keyFrequency * tf * idf; } }
/** * Returns a concave pivot length normalized tf as described in Robertson et al., 1999. * Okapi at TREC-7: automatic ad hoc, filtering, VLC and filtering tracks. * In Proceedings of the Seventh Text REtrieval Conference (TREC-7), pages 253-264 * @param tf the term frequency to modify * @param b the slope * @param dl the document length * @param avdl the average document length in the collection * @param k1 the concavity coefficient * @return a concave pivot length normalized tf */ public static double tf_robertson(double tf, double b, double dl, double avdl, double k1) { return tf_concave_k(tf_pivoted(tf, b, dl, avdl), k1); }
/** * Returns a concave pivot length normalized tf as described in Robertson et al., 1999. * Okapi at TREC-7: automatic ad hoc, filtering, VLC and filtering tracks. * In Proceedings of the Seventh Text REtrieval Conference (TREC-7), pages 253-264 * @param tf the term frequency to modify * @param b the slope * @param dl the document length * @param avdl the average document length in the collection * @param k1 the concavity coefficient * @return a concave pivot length normalized tf */ public static double tf_robertson(double tf, double b, double dl, double avdl, double k1) { return tf_concave_k(tf_pivoted(tf, b, dl, avdl), k1); }