/** An entry in a {@link ScoresList}. */ export declare type ScoreEntry = [number, ...T]; /** * Special type of {@link PriorityList} that is intended to handle * suggestion scores. Stores arrays of values with a score number, and * limits the amount of entries within the list by removing the lowest * scoring values. * * @typeParam T - The array value to be stored as an entry. */ export declare class ScoresList { /** The maximum number of entries in the list. */ max: number; /** The comparator function that is used for the {@link PriorityList} instance. */ private static heapCmp; /** * The comparator function that is used when finalizing the list, which * requires a sort of the list. */ private static finishCmp; /** The internal list. */ private list; constructor( /** The maximum number of entries in the list. */ max: number); /** * Adds an entry to the list. * * @param score - The score of the entry being added. * @param args - The entry to add. */ add(score: number, ...args: T): void; /** * Finalizes the list by running a sort of the list and returning a (by * default) normalized version of the list, so that the entries in the * list are as they were originally given. * * @param map - An optional mapping function that manipulates the score * values before they are sorted. * @param keepScores - If true, the scores will not be removed from the * final list of entries. */ finish(map?: undefined, keepScores?: false): [...T][]; finish(map?: undefined, keepScores?: true): ScoreEntry[]; finish(map: (val: ScoreEntry) => ScoreEntry, keepScores?: false): [...O][]; finish(map: (val: ScoreEntry) => ScoreEntry, keepScores?: true): ScoreEntry[]; } /** * Simple scoring algorithm used for determining if a potential suggestion * is a good one for the misspelling given. * * @param misspelling - The misspelled word. * @param suggestion - The potential suggestion to determine the score of. */ export declare function rootScore(misspelling: string, suggestion: string): number; /** * Simple scoring algorithm used for sorting a list of suggestions from * closest matching to least matching. * * @param misspelling - The misspelled word. * @param suggestion - The suggestion to determine the score of. */ export declare function finalScore(misspelling: string, suggestion: string): number; /** * Finds a minimum threshold for a decent suggestion. * * @param word - The word (or misspelling) to have a threshold generated for. */ export declare function scoreThreshold(word: string): number; /** * Simple and rough estimation of score for an affixed form. * * @param misspelling - The misspelled word. * @param suggestion - The suggestion to determine the score of. * @see {@link preciseAffixScore} */ export declare function roughAffixScore(misspelling: string, suggestion: string): number; /** * Precise, mildly expensive (in comparison) scoring algorithm for affixed * forms. This function tends to generate three groups: * * - 1000 or more: The misspelling and suggestion are the same with the only * exception being casing. * - -100 or less: The word difference is too great, as determined by * `diffFactor` argument. * - -100...1000: Normal suggestion scores. * * @param misspelling - The misspelled word. * @param suggestion - The suggestion to determine the score of. * @param diffFactor - An adjustment knob for changing the number of * suggestions returned. A lower factor means that a suggestion must be * of a decent confidence to actually be given to the user. * @param base - The initial score between the misspelling and the suggestion. * @param hasPhonetic - If true, this indicates that the spellchecker also * has access a {@link PhonetTable}. This causes the scores to be adjusted * slightly lower so that the {@link PhonetTable} is more "important". */ export declare function preciseAffixScore(misspelling: string, suggestion: string, diffFactor: number, base: number, hasPhonetic: boolean): number;