DoubleMetaphone class Null safety
Encodes a string to a Double Metaphone value. This implementation is based on the algorithm that was published by Lawrence Philips in Dr. Dobbs and includes fixes published by others since. By design, this encoding always contains two values. If there is no alternate, the primary and the alternate encodings will be the same.
Note that this implementation avoids any class corruption or concurrency problems by avoiding class properties. All of the data required is passed on the stack when each internal method is called.
This algorithm improves on the Soundex algorithm by using expert rules about inconsistencies in English spelling and pronunciation to produce a more accurate encoding, which does a better job of matching words and names which sound similar. Just like Soundex, similar-sounding words should share the same keys.
If you want (or need) to understand more details, here are some good references that help explain the details:
- Implemented types
String input) → PhoneticEncoding?
Encodes a string using the Double Metaphone algorithm as configured. [...]
Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
) → String
A string representation of this object. [...]