cmpstr
Version:
CmpStr is a lightweight, fast and well performing package for calculating string similarity
56 lines (55 loc) • 1.92 kB
TypeScript
/**
* Caverphone Phonetic Algorithm
* src/phonetic/Caverphone.ts
*
* @see https://en.wikipedia.org/wiki/Caverphone
*
* This module implements the Caverphone phonetic algorithm, which is designed
* to encode words into a phonetic representation. The Caverphone algorithm is
* used primarily in New Zealand and was developed to assist in the indexing of
* names in genealogical databases.
*
* It converts words into a standardized phonetic code, allowing for variations
* in spelling and pronunciation to be matched.
*
* @module Phonetic/Caverphone
* @author Paul Köhler (komed3)
* @license MIT
*/
import type { PhoneticOptions } from '../utils/Types';
import { Phonetic } from './Phonetic';
/**
* Caverphone class extends the Phonetic class to implement the Caverphone phonetic algorithm.
*/
export declare class Caverphone extends Phonetic {
protected static default: PhoneticOptions;
/**
* Constructor for the Caverphone class.
*
* Initializes the Caverphone phonetic algorithm with the mapping and options.
*
* @param {PhoneticOptions} [opt] - Options for the Caverphone phonetic algorithm
*/
constructor(opt?: PhoneticOptions);
/**
* Generates the Caverphone code for a given word.
*
* @param {string} word - The input word to be converted into a Caverphone code
* @returns {string} - The generated Caverphone code
*/
protected encode(word: string): string;
/**
* Overrides the mapChar method to skip character mapping.
*
* @param {string} char - The character to be mapped
* @returns {string} - The mapped character
*/
protected mapChar(char: string): string;
/**
* Adjusts the phonetic code to uppercase.
*
* @param {string} code - The phonetic code to adjust
* @returns {string} - The adjusted phonetic code
*/
protected adjustCode(code: string): string;
}