How do spell:suggest() and spell:suggest-detailed() arrive at their suggestions?
29 August 2013 02:44 PM
|
||
Introductionspell:suggest() and spell:suggest-detailed aren't simply looking for character differences between the provided strings and the strings in your dictionaries - they're also factoring in differences in the resulting phonetics represented by these strings. DetailThere is an undocumented option that can be passed along to increase the phonetic-distance threshold (which is 1, by default). For example, consider the following:
Note that the option "distance-threshold" corresponds to "distance" in the result, and "phonetic-distance" corresponds to "key-distance." Also note that increasing the phonetic-distance may cause spell:suggest() and spell:suggest-detailed() to use significantly more CPU. Metaphones are short keys, so a larger distance may match a very large fraction of the dictionary, which would then mean each of those matches would need to be checked in the distance algorithms. | ||
|