Constructor for the Soundex class.
Initializes the Soundex phonetic algorithm with the mapping and options.
Optionalopt: PhoneticOptions = {}Options for the Soundex phonetic algorithm
Protected ReadonlymapProtected ReadonlyoptionsPhonetic map and options for the algorithm
Protected ReadonlyoptProtected StaticdefaultDefault options for the Soundex phonetic algorithm
ProtectedadjustAdjusts the phonetic code by removing leading zeros and ensuring the first character is uppercase.
The phonetic code to adjust
The characters used in the phonetic code
ProtectedapplyApplies patterns to a word based on the phonetic map.
This method processes the word by applying all defined patterns in the phonetic map. It replaces occurrences of specified patterns with their corresponding replacements.
The input word to be processed
ProtectedapplyApplies phonetic rules to a character in a word context.
This method is designed to be generic and efficient for all phonetic algorithms. It checks all rule types (prev, next, prevNot, nextNot, position, etc.) and returns either the appropriate code (string) or undefined.
The current character
The current position within the word
The word as an array of characters
The total length of the word
ProtectedencodeGenerates the phonetic code for a given word.
This method processes the word character by character, applying phonetic rules and mappings to generate a phonetic code.
The input word to be converted into a phonetic code
ProtectedequalEnsures the phonetic code has a fixed length by padding or truncating.
The input string to be adjusted
ProtectedexitDetermines whether to exit early based on the current phonetic code length.
The current phonetic code
The current index in the word
Get the name of the phonetic algorithm.
Generates a phonetic index for the given input string.
The input string to be indexed
Asynchronously generates a phonetic index for the given input string.
The input string to be indexed
ProtectedloopProcesses an array of words to generate their phonetic indices.
This method iterates over each word, generates its phonetic code, and ensures that the resulting codes are of equal length.
An array of words to be processed
ProtectedloopAsynchronously processes an array of words to generate their phonetic indices.
This method iterates over each word, generates its phonetic code asynchronously, and ensures that the resulting codes are of equal length.
An array of words to be processed
ProtectedmapConverts a character to its phonetic code based on the mapping and rules.
The current character
The current position within the word
The word as an array of characters
The total length of the word
The last code generated (to avoid duplicates)
The phonetic mapping
Protectedword2Converts a word into an array of characters.
The input word to be converted
StaticclearStatic method to clear the cache of indexed words.
Soundex class extends the Phonetic class to implement the Soundex phonetic algorithm.