Expand description
Alpha auto-detection and query-driven boosting.
Port of ~/src/semble/src/semble/ranking/weighting.py and
~/src/semble/src/semble/ranking/boosting.py.
Three public entry points:
resolve_alpha— picks the semantic/BM25 blend weight from the query shape: 0.3 for bare-symbol queries (lean BM25), 0.5 for natural-language queries (balanced).apply_query_boost— adds query-type boosts on top of a score map. Returns a new map; callers re-rank afterwards.boost_multi_chunk_files— file-coherence boost; promotes the top chunk of files whose chunks collectively score high.
Where Python keys combined_scores by Chunk, this port uses
HashMap<usize, f32> (chunk index → score) plus &[CodeChunk] for
lookups. Same shape as crate::encoder::ripvec::penalties::rerank_topk.
Constants§
- ALPHA_
NL - Semantic blend weight for natural-language queries. Balanced.
- ALPHA_
SYMBOL - Semantic blend weight for symbol-shaped queries. Lean BM25.
Functions§
- apply_
query_ boost - Apply query-type boosts to candidate scores.
- boost_
multi_ chunk_ files - Promote files with multiple high-scoring chunks by boosting their
top chunk in place. Mirrors
boost_multi_chunk_files. - is_
symbol_ query - Return
truewhen the query looks like a bare symbol or namespace-qualified identifier (Foo::Bar,module.Class,_x,getX,XMLParser, etc.). - resolve_
alpha - Return the semantic blend weight, optionally overriding by caller.