import type { Aff } from "../aff"; import type { Dic } from "../dic"; /** The resulting data returned from executing a lookup. */ export interface LookupResult { /** Indicates if the word was spelled correctly. */ correct: boolean; /** * Indicates if the word was marked as forbidden with the spellchecker's * dictionary. */ forbidden: boolean; /** * Indicates if the word was marked as "warn" in the dictionary, which * probably means that the word is *technically* valid but is still * likely to have been a mistake. */ warn: boolean; } /** * {@link Lookup} context. Many methods in the {@link Lookup} class share * these options. */ export interface LKC { /** If true, lookups will be case sensitive. */ caps?: boolean; /** * If false, words which are in the dictionary, but are flagged with the * `NOSUGGEST` flag (if provided), will not be considered correct. * Defaults to true. */ allowNoSuggest?: boolean; /** * Used by {@link Lookup.forms}. If false, {@link AffixForm} instances * won't be yielded. Defaults to true. */ affixForms?: boolean; /** * Used by {@link Lookup.forms}. If false, {@link CompoundForm} instances * won't be yielded. Defaults to true. */ compoundForms?: boolean; /** * Used by {@link Lookup.affixForms}. If true, {@link AffixForm}s that have * the `FORBIDDENWORD` flag will still be yielded. */ withForbidden?: boolean; } /** Class that facilitaties lookups for a spellchecker. */ export declare class Lookup { /** Spellchecker's affix data. */ aff: Aff; /** Spellchecker's dictionary data. */ dic: Dic; /** * @param aff - The affix data to use. * @param dic - The dictionary data to use. */ constructor(aff: Aff, dic: Dic); /** * Checks if a word is spelled correctly. * * @param word - The word to check. * @param caps - If true, checking will be case sensitive. Defaults to true. * @param allowNoSuggest - If false, words which are in the dictionary, * but are flagged with the `NOSUGGEST` flag (if provided), will not be * considered correct. Defaults to true. */ check(word: string, caps?: boolean, allowNoSuggest?: boolean): LookupResult; /** * Yields *correct* combinations of stems and affixes for a word, * specifically instances of {@link AffixForm} or {@link CompoundForm}. If * this function does actually yield a form, that means that it can be * considered as spelled correctly. * * @param word - The word to yield the forms of. * @see {@link LKC} */ forms(word: string, { caps, allowNoSuggest, affixForms, compoundForms }?: LKC): Generator; /** * Checks if a word is spelled correctly. Performs no processing on the * word, such as handling `aff.IGNORE` characters. * * @param word - The word to check. * @see {@link LKC} */ correct(word: string, { caps, allowNoSuggest, affixForms, compoundForms }?: LKC): boolean; /** * Yields the stems of a word. If no stems are returned, the word was incorrect. * * @param word - The word to yield the stems of. * @see {@link LKC} */ stems(word: string, { caps, allowNoSuggest, affixForms, compoundForms }?: LKC): Generator; /** * Yields a list of a data maps associated with the homonyms of the given stem. * * @param stem - The stem to get the data of. * @param caps - If true, checking will be case sensitive. Defaults to true. */ data(stem: string, caps?: boolean): Generator>, void, unknown>; /** * Determines if a stem is marked with the `WARN` flag. * * @param stem - The stem to check. */ isWarn(stem: string): boolean; /** * Determines if a stem is marked as forbidden, either through the * `FORBIDDENWORD` flag *or* the the combination of the stem having the * `WARN` flag and the `FORBIDWARN` directive being true. * * @param stem - The word to check. */ isForbidden(stem: string): boolean; }