hunspell-reader
Version:
A library for reading Hunspell Dictionary Files
51 lines • 2.26 kB
TypeScript
import type { AffInfo, AffWord, AffWordFlags, Fx, Rule } from './affDef.js';
import { Converter } from './converter.js';
/** The `word` field in a Converted AffWord has been converted using the OCONV mapping */
export type ConvertedAffWord = AffWord;
export declare class Aff {
#private;
readonly affInfo: AffInfo;
readonly filename?: string | undefined;
protected rules: Map<string, Rule>;
protected _oConv: Converter;
protected _iConv: Converter;
private _maxSuffixDepth;
private _mapRules;
constructor(affInfo: AffInfo, filename?: string | undefined);
get maxSuffixDepth(): number;
set maxSuffixDepth(value: number);
/**
* Takes a line from a hunspell.dic file and applies the rules found in the aff file.
* For performance reasons, only the `word` field is mapped with OCONV.
* @param {string} line - the line from the .dic file.
*/
applyRulesToDicEntry(line: string, maxDepth?: number): ConvertedAffWord[];
/**
* @internal
*/
applyRulesToWord(affWord: AffWord, remainingDepth: number): AffWord[];
applyAffixesToWord(affixRules: Fx[], affWord: AffWord, remainingDepth: number): AffWord[];
applyAffixToWord(affix: Fx, affWord: AffWord, combinableSfx: string): AffWord[];
getMatchingRules(rules: string): Rule[];
joinRules(rules: string[]): string;
separateRules(rules: string): string[];
get iConv(): Converter;
get oConv(): Converter;
}
declare function signature(aff: AffWord): string;
export declare function processRules(affInfo: AffInfo): Map<string, Rule>;
export declare function logAffWord(affWord: AffWord, message: string): AffWord;
export declare function affWordToColoredString(affWord: AffWord): string;
export declare function flagsToString(flags: AffWordFlags): string;
export declare function asAffWord(word: string, rules?: string, flags?: AffWordFlags): AffWord;
export declare function compareAff(a: AffWord, b: AffWord): 0 | 1 | -1;
/**
* Returns a filter function that will filter adjacent AffWords
* It compares the word and the flags.
*/
export declare function filterAff(): (t: AffWord) => boolean;
export declare const debug: {
signature: typeof signature;
};
export {};
//# sourceMappingURL=affLegacy.d.ts.map