Shorten workspace directory names to app, bot and core
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// BM25F: normalize field frequencies before saturation. Title/username share
|
||||
// the short field. Corpus-wide document frequency is counted once per term.
|
||||
pub(crate) fn term_score(
|
||||
counts: [usize; 2],
|
||||
lengths: [usize; 2],
|
||||
averages: [f64; 2],
|
||||
n: usize,
|
||||
df: usize,
|
||||
) -> f64 {
|
||||
let weights = [3.0, 1.0];
|
||||
let mut frequency = 0.0;
|
||||
for field in 0..2 {
|
||||
let norm = 0.25 + 0.75 * lengths[field] as f64 / averages[field].max(1.0);
|
||||
frequency += weights[field] * counts[field] as f64 / norm;
|
||||
}
|
||||
let idf = (1.0 + ((n - df) as f64 + 0.5) / (df as f64 + 0.5)).ln();
|
||||
idf * (2.2 * frequency) / (1.2 + frequency)
|
||||
}
|
||||
Reference in New Issue
Block a user