Open PatrickEGorman opened 1 year ago
@PatrickEGorman I was able to work around this by using a custom distance function with a special case for .com:
import mailcheck from '@zootools/email-spell-checker'
import distance from '@zootools/email-spell-checker/dist/lib/helpers/sift3Distance'
const mailcheckDistance = (domain: string, knownDomain: string) => {
let dist = distance(domain, knownDomain)
// force prioritize .com matches over .co and .ca
if (knownDomain === 'com') dist -= 0.75
return dist
}
const suggestion = mailcheck.run({ email, distanceFunction: mailcheckDistance })
Feature Request
Is your feature request related to a problem? Please describe.
There are some cases where .co is the preferred suggestion when .com seems to be a much more likely candidate of what the user meant to input.
Ex: test@test.con corrects to test@test.co or test@test.cin (right hand shifted one key left on a querty keyboard) also corrects to test@test.co even though test@test.com seems like a much more probable candidate on what the user meant to input.
Describe the solution you'd like
With around 50% of top level domains being
.com
and only around 1% of TLDs being.co
it seems like .com should be preferred over .co in a majority of cases especially in 3 letter domain names beginning withc
.Are you willing to resolve this issue by submitting a Pull Request?