Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.com should take priority over .co in 3 letter domains beginning in 'c' #33

Open
1 of 4 tasks
PatrickEGorman opened this issue Nov 17, 2023 · 1 comment
Open
1 of 4 tasks
Labels
enhancement New feature or request

Comments

@PatrickEGorman
Copy link

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 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.
  • 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 PatrickEGorman added the enhancement New feature or request label Nov 17, 2023
@PatrickEGorman PatrickEGorman changed the title .com domain should take priority over .co .com domain should take priority over .co in 3 letter domains beginning in 'c' Nov 17, 2023
@PatrickEGorman PatrickEGorman changed the title .com domain should take priority over .co in 3 letter domains beginning in 'c' .com should take priority over .co in 3 letter domains beginning in 'c' Nov 17, 2023
@bgmort
Copy link

bgmort commented Apr 5, 2024

@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 })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants