/** * How little a word that EVERY entry carries may count. A floor, not zero, * because a common word still has to be worth something — "page" must still * find `ed-page`. Chosen in #2080 on measurements: routing was flat from 0.25 * down to 0.15, and the first benchmark regression appeared at 0. */ export declare const RARITY_FLOOR = 0.25; export interface TermWeights { /** A multiplier in `[RARITY_FLOOR, 1]` for one query term; plurals share their singular's. */ weightOf(term: string): number; } /** * Round a weighted score to nine decimal places. Weighted sums that are equal on * paper (0.1 + 0.2 + 0.3 and 0.3 + 0.2 + 0.1) differ in their last binary digit, * which was enough to stop two tied entries ever reaching the rankers' tiebreaks. */ export declare const settle: (score: number) => number; /** Every word counts the same — the behaviour before #2080, and the default when no weights are passed. */ export declare const UNWEIGHTED: TermWeights; /** The slice of a catalog entry that says what the entry IS. */ export interface WeightableEntry { tagName: string; displayName?: string; intent?: string; guidelines?: { use?: string[]; useWhen?: string[]; }; } /** * Build the weights for a catalog. `weight = floor + (1 - floor) × idf`, where * `idf = ln((N + 1) / (df + 1)) / ln(N + 1)` runs from 1 (no entry carries the * word) towards 0 (every entry does). An entry counts once per word however * often it says it. */ export declare function buildTermWeights(entries: WeightableEntry[], floor?: number): TermWeights; //# sourceMappingURL=term-weights.d.ts.map