aarondb/scoring

scoring — local result-combination compatibility helper

This module is the authoritative helper for combining caller-owned scored result lists. It is used by the standalone local BM25 test surface and is intentionally separate from engine/cognitive: it does not learn, persist relevance, execute retrieval, or define a cognitive-memory model.

weighted_union is deterministic only up to its documented score ordering; callers that need a semantic retrieval contract must use an engine-backed query or define one explicitly.

Types

pub type NormalizationStrategy {
  MinMax
  None
}

Constructors

  • MinMax
  • None
pub type ScoredResult {
  ScoredResult(entity: fact.EntityId, score: Float)
}

Constructors

Values

pub fn weighted_union(
  results_a: List(ScoredResult),
  results_b: List(ScoredResult),
  weight_a: Float,
  weight_b: Float,
  normalization: NormalizationStrategy,
) -> List(ScoredResult)

Combines two lists of scored results using weighted union. Scores are first normalized (if requested) then combined by weight. If an entity appears in only one list, it’s treated as having score 0.0 in the other.

Search Document