{"id":13565336,"url":"https://github.com/fewlaps/quitnow-email-suggester","last_synced_at":"2025-04-03T22:31:10.204Z","repository":{"id":34719238,"uuid":"38696470","full_name":"fewlaps/quitnow-email-suggester","owner":"fewlaps","description":"📧 Correct typos in email addresses like hello@gmail.con","archived":false,"fork":false,"pushed_at":"2021-05-23T13:44:52.000Z","size":215,"stargazers_count":46,"open_issues_count":6,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-04T18:46:43.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://quitnow.app","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fewlaps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-07T15:23:12.000Z","updated_at":"2024-05-11T22:35:45.000Z","dependencies_parsed_at":"2022-08-29T10:40:54.101Z","dependency_job_id":null,"html_url":"https://github.com/fewlaps/quitnow-email-suggester","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fewlaps%2Fquitnow-email-suggester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fewlaps%2Fquitnow-email-suggester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fewlaps%2Fquitnow-email-suggester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fewlaps%2Fquitnow-email-suggester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fewlaps","download_url":"https://codeload.github.com/fewlaps/quitnow-email-suggester/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247090049,"owners_count":20881910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:44.920Z","updated_at":"2025-04-03T22:31:05.631Z","avatar_url":"https://github.com/fewlaps.png","language":"Java","funding_links":[],"categories":["Java","人工智能"],"sub_categories":["自然语言处理"],"readme":"[![Build Status](https://travis-ci.org/Fewlaps/quitnow-email-suggester.svg?branch=master)](https://travis-ci.org/Fewlaps/quitnow-email-suggester)\n[![Coverage Status](https://coveralls.io/repos/Fewlaps/quitnow-email-suggester/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/Fewlaps/quitnow-email-suggester?branch=master)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-quitnow--email--suggester-green.svg?style=flat)](https://android-arsenal.com/details/1/2465)\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Fewlaps/quitnow-email-suggester?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\n# [QuitNow!](http://quitnowapp.com)'s e-mail suggester\nPeople don't write e-mail addresses without misspelling from time to time. @gmial.con addresses are too common... And we need to put a stop to it!\n\nQuitNow!'s server is doing the usual e-mail validaton during user creation time. We're doing it like everyone does: sending an e-mail to the user, and waiting for the user to click a link. The only validation we do is to check the e-mail with usual regex... but we need to go a little beyond that. Looking for *.con* and suggesting *.com* is something that would make the world a better place!\n\nBy the way, we recently learnt a lot about TDD (Test-Driven Development) at some [Karumi](https://github.com/Karumi) masterclasses, so we decided to go on with TDD. The only way to master something is by doing. Incidentally, it will be useful if we improve our e-mail validation (and, hopefully, yours).\n\nIf you want to see what suggestions and validations are being done, \u003ca href=\"https://github.com/Fewlaps/quitnow-email-suggester/tree/master/src/test/java/com/fewlaps/quitnowemailsuggester\"\u003echeck the actual tests\u003c/a\u003e. It's an easy way for us to document the behaviour, and it's the tried-and-true list for you to know what's exactly happening here.\n\n## How it works?\n\n### Email suggester\n```java\n// Hello! Let me show the magic of this library: the email suggester\nEmailSuggester suggester = new EmailSuggester();\n\n// It is a little thing that has an algorithm to fix human typos.\n// Let's say your user mistyped his email address:\nString badEmail = \"roc@gmial.com\";\nString goodEmail = suggester.getSuggestedEmail(badEmail);\n// goodEmail will contain the fixed email address. WOW!\n// And there are tons of email fixes. They're listed at https://goo.gl/IF52EV\n// In addition, it will never suggest a bad domain. All the suggestions are written one by one,\n// based on the QuitNow! users and their e-mail bounces. If it doesn't know nothing\n// better than the input, it will return the same email.\n```\n\n### Email validator \u0026 Android account email cleaner\n```java\n// Well! Something else? Yes: this library hosts some more email related things\nEmailValidator validator = new EmailValidator();\nvalidator.hasGoodSyntax(goodEmail); //Does it match the email regex?\nvalidator.hasValidTld(goodEmail); //Has it a valid TLD?\nvalidator.isAlias(goodEmail); //Is it an alias?\nvalidator.isDisposable(goodEmail); //Is it listed as a disposable domain?\n\n// To finish up: if you work with Android, you'll find roc@fewlaps.com:WhatEVER emails\n// If you want to clean them, here it goes:\nAndroidAccountEmailCleaner cleaner = new AndroidAccountEmailCleaner();\nString androidAccountEmail = \"roc@fewlaps.com:WhatEVER\";\nString cleanedEmail = cleaner.cleanEmail(androidAccountEmail);\n// cleanedEmail will contain roc@fewlaps.com\n```\n\n\n#### *.hasValidTld()* and *.isDisposable()* under the hood\n- *.hasValidTld()* is getting data from this public repo: https://github.com/publicsuffix/list\n- *.isDisposable()* is checking the domain against this another one: https://github.com/ivolo/disposable-email-domains\n\nThe files needs to be attached to the project cause they're parsed locally.\n\nSo, before starting, initalise git submodules:\n\n```\ngit submodule update --init --recursive\n```\n\n## Download\n\n* Get \u003ca href=\"https://github.com/Fewlaps/quitnow-email-suggester/releases/download/v2.0.0/quitnow-email-suggester-2.0.0.jar\"\u003ethe latest .jar\u003c/a\u003e \n\n* Grab via Gradle:\n```groovy\nrepositories { jcenter() }\n    \ncompile 'com.fewlaps.quitnowemailsuggester:quitnow-email-suggester:2.0.0'\n```\n* Grab via Maven:\n```xml\n\u003crepository\u003e\n  \u003cid\u003ejcenter\u003c/id\u003e\n  \u003curl\u003ehttp://jcenter.bintray.com\u003c/url\u003e\n\u003c/repository\u003e\n\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.fewlaps.quitnowemailsuggester\u003c/groupId\u003e\n    \u003cartifactId\u003equitnow-email-suggester\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## LICENSE\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Fewlaps\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffewlaps%2Fquitnow-email-suggester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffewlaps%2Fquitnow-email-suggester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffewlaps%2Fquitnow-email-suggester/lists"}