Skip to content

Function: computeLessonScore() ​

ts
function computeLessonScore(
   lesson, 
   scoring, 
   context?
): number;

Defined in: runtime/lessons/lesson-scoring.ts:49

Computes the Bayesian sliding-window score $\text{Score}(L, Q)$ for a candidate LessonRecord (SPEC.md §3.4.3).

Combines text relevance $R(L, Q)$, partition-affinity boost $(1 + \beta \cdot \mathbb{I}(L.\text{partition} \in P))$, contract epoch decay $\gamma^{\max(0, E_{\text{now}} - E_0)}$, and sliding-window empirical reliability $(c_W + 1) / (c_W + 2v_W + 0.5g_W + 2)$.

Parameters ​

ParameterTypeDescription
lessonLessonRecordCandidate lesson record to score.
scoringLessonScoringConfigLesson scoring and sliding-window configuration.
context?| readonly string[] | LessonScoreContextParamsActive partitions and current partition epochs.

Returns ​

number

Computed lesson score $\text{Score}(L, Q) \ge 0$.

Released under the MIT License.