@dcoffey/espells
Version:
Pure JS/TS spellchecker, using Hunspell dictionaries. Based on Spylls.
27 lines (26 loc) • 1.08 kB
TypeScript
import type { Aff } from "../aff/index.js";
import { AffixForm } from "./forms.js";
import type { LKFlags } from "./lk-flags.js";
import type { LKWord } from "./lk-word.js";
export declare const enum AffixType {
PREFIX = 0,
SUFFIX = 1
}
/**
* Yields permutations of a word split up (with whitespace) using the
* `BREAK` rules given by the spellchecker's {@link Aff} data.
*
* @param aff - The affix data to use.
* @param text - The word/text to split.
* @param depth - The current depth of the check. Used by this function
* when calling itself recursively. There isn't any need to set it yourself.
*/
export declare function breakWord(aff: Aff, text: string, depth?: number): Iterable<string[]>;
/**
* Takes in a {@link LKWord} and yields a progressive decomposition of the
* affixes and stems that can be found in the word.
*
* @param word - The word to decompose.
* @param flags - The {@link LKFlags} that restrain the possible forms of the word.
*/
export declare function decompose(word: LKWord, flags: LKFlags): Generator<AffixForm, void, undefined>;