UNPKG

nysiis

Version:

NYSIIS phonetic encoding algorithm.

61 lines (60 loc) 1.45 kB
interface NysiisOptions { maxLength?: number; strict?: boolean; languageRules?: string[]; } declare class Nysiis { private readonly vowels; private readonly options; private readonly firstCharRules; private readonly lastCharRules; private readonly middleCharRules; private readonly accentMap; private static readonly DEFAULT_OPTIONS; constructor(options?: NysiisOptions); /** * Encodes a name using the NYSIIS algorithm */ encode(name: string): string; /** * Validates the input string */ private isValidInput; /** * Preprocesses the input name */ private preprocessName; /** * Translates first characters according to language-specific rules */ private translateFirstCharacters; /** * Translates last characters according to NYSIIS rules */ private translateLastCharacters; /** * Applies middle character rules */ private applyMiddleCharRules; /** * Handles vowel transformations with harmony */ private handleVowel; /** * Generates the NYSIIS key */ private generateKey; /** * Finalises the NYSIIS key */ private finaliseKey; /** * Gets available language rules */ getAvailableLanguages(): string[]; /** * Sets active language rules */ setLanguageRules(languages: string[]): void; } export default Nysiis;