Expand description
Lexicon-based importance scoring — LexiconScorer trait, ConfigLexiconScorer,
DefaultEnglishScorer, CompositeLexiconScorer, LexiconAppender, and
LexiconProposal.
Lexicon-based importance scoring.
Provides LexiconScorer — a trait for domain-specific importance
weighting injected at crate::ContextForge construction time via the
builder API — and ConfigLexiconScorer, the default TOML-driven
implementation.
The scorer runs inside crate::engine::ContextEngine::assemble after
BM25 + recency decay, before the token-budget cut. Importance weighting
must happen at this point to influence which entries survive the budget
cut, not re-rank survivors after.
§Two-layer design
Lexicon scoring is opt-in on the builder. DefaultEnglishScorer recognizes
plain-English importance signals (“confirmed”, “never mind”, etc.) and is
enabled via with_default_english_scorer. A persona scorer
(ConfigLexiconScorer loaded from a TOML file) is added via
with_persona_scorer. When both are set they stack via
CompositeLexiconScorer — additive, with the engine applying the -1.0
floor clamp after fusion.
Structs§
- Composite
Lexicon Scorer - Applies multiple
LexiconScorers in sequence and sums their boosts. - Config
Lexicon Scorer LexiconScorerbacked by a TOML config file.- Default
English Scorer - Always-on baseline scorer for plain-English importance signals.
- Lexicon
Appender - Atomically appends or removes entries from a TOML lexicon file.
- Lexicon
Config - TOML schema for
ConfigLexiconScorer. - Lexicon
Patterns - A list of case-insensitive substring patterns.
- Lexicon
Proposal - A candidate term proposed for addition to the lexicon.
Traits§
- Lexicon
Scorer - Domain-specific importance scorer, injected at construction time.
Functions§
- bootstrap_
prompt - Generate a calibration prompt for bootstrapping a persona lexicon via an LLM.