email-spell-checker
email-spell-checker copied to clipboard
.com should take priority over .co in 3 letter domains beginning in 'c'
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: [email protected] corrects to [email protected] or [email protected] (right hand shifted one key left on a querty keyboard) also corrects to [email protected] even though [email protected] 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 with c
.
Are you willing to resolve this issue by submitting a Pull Request?
- [ ] Yes, I have the time, and I know how to start.
- [ ] Yes, I have the time, but I don't know how to start. I would need guidance.
- [X] No, I don't have the time, although I believe I could do it if I had the time...
- [ ] No, I don't have the time and I wouldn't even know how to start.
@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 })