UNPKG

hunspell-reader

Version:
73 lines 2.91 kB
import type { Sequence } from 'gensequence'; import type { AffWord } from './affDef.js'; import type { Aff } from './affLegacy.js'; import type { WordInfo } from './types.js'; export { WordInfo } from './types.js'; export interface HunspellSrcData { /** The Aff rules to use with the dictionary entries */ aff: Aff; /** the hunspell dictionary entries complete with affix flags */ dic: string[]; } export declare class IterableHunspellReaderLegacy implements Iterable<string> { readonly src: HunspellSrcData; readonly aff: Aff; constructor(src: HunspellSrcData); get dic(): string[]; set maxDepth(value: number); get maxDepth(): number; /** the number of .dic entries */ get size(): number; /** * @internal */ dicWordsSeq(): Sequence<WordInfo>; /** * iterates through the root words of the dictionary */ iterateRootWords(): Iterable<string>; iterateWords(): Iterable<string>; /** * Iterator for all the words in the dictionary. The words are in the order found in the .dic after the * transformations have been applied. Forbidden and CompoundOnly words are filtered out. */ [Symbol.iterator](): Sequence<string>; /** * create an iterable sequence of the words in the dictionary. * * @param tapPreApplyRules -- optional function to be called before rules are applied to a word. * It is mostly used for monitoring progress in combination with `size`. */ seqAffWords(tapPreApplyRules?: (dicEntry: string, index: number) => void, maxDepth?: number): Sequence<AffWord>; /** * create an iterable sequence of the words in the dictionary. * * @param tapPreApplyRules -- optional function to be called before rules are applied to a word. * It is mostly used for monitoring progress in combination with `size`. */ seqTransformDictionaryEntries(tapPreApplyRules?: (dicEntry: string, index: number) => void, maxDepth?: number): Sequence<AffWord[]>; /** * Iterator for all the words in the dictionary. The words are in the order found in the .dic after the * transformations have been applied. Forbidden and CompoundOnly ARE INCLUDED. * * @internal */ seqWords(): Sequence<string>; /** * Returns an iterable that will only return stand alone words. */ wholeWords(): Sequence<string>; /** * @internal */ seqRootWords(): Sequence<string>; /** * * @param affFile - path to aff file. * @param dicFile - path to dic file. * @returns IterableHunspellReader */ static createFromFiles(affFile: string, dicFile: string): Promise<IterableHunspellReaderLegacy>; } export declare function createMatchingWordsFilter(): (t: string) => boolean; //# sourceMappingURL=IterableHunspellReaderLegacy.d.ts.map