kbolt-core 0.1.7

Core engine for kbolt local-first retrieval
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
pub(super) fn dense_distance_to_score(distance: f32) -> f32 {
    1.0 / (1.0 + distance.max(0.0))
}

pub(super) fn max_option(left: Option<f32>, right: Option<f32>) -> Option<f32> {
    match (left, right) {
        (Some(a), Some(b)) => Some(a.max(b)),
        (Some(a), None) => Some(a),
        (None, Some(b)) => Some(b),
        (None, None) => None,
    }
}