cmpstr
Version:
CmpStr is a lightweight, fast and well performing package for calculating string similarity
47 lines (46 loc) • 1.77 kB
TypeScript
/**
* Cologne Phonetic Algorithm
* src/phonetic/Cologne.ts
*
* @see https://en.wikipedia.org/wiki/Cologne_phonetics
*
* Cologne phonetics, also known as `Kölner Phonetik` or the `Cologne process`,
* is a phonetic algorithm that assigns a sequence of digits, referred to as the
* phonetic code, to words. The purpose of this method is to ensure that words
* with identical sounds receive the same code. This algorithm can facilitate a
* similarity search among words.
*
* Cologne phonetics is associated with the well-known Soundex phonetic algorithm,
* yet it is specifically optimized for the German language. This algorithm was
* introduced by Hans Joachim Postel in 1969.
*
* The Cologne phonetic algorithm works by mapping letters to digits, ignoring
* certain letters, and applying specific rules to handle character combinations.
*
* @module Phonetic/Cologne
* @author Paul Köhler (komed3)
* @license MIT
*/
import type { PhoneticOptions } from '../utils/Types';
import { Phonetic } from './Phonetic';
/**
* Cologne class extends the Phonetic class to implement the Cologne phonetic algorithm.
*/
export declare class Cologne extends Phonetic {
protected static default: PhoneticOptions;
/**
* Constructor for the Cologne class.
*
* Initializes the Cologne phonetic algorithm with the mapping and options.
*
* @param {PhoneticOptions} [opt] - Options for the Cologne phonetic algorithm
*/
constructor(opt?: PhoneticOptions);
/**
* Adjusts the phonetic code by removing all '0's except the first character.
*
* @param {string} code - The phonetic code to adjust
* @returns {string} - The adjusted phonetic code
*/
protected adjustCode(code: string): string;
}