module EmailDomainTypoFinder
Overview
Find email addresses whose domain looks like a typo of a common mailbox domain.
Defined in:
email_domain_typo_finder.crConstant Summary
-
DEFAULT_DOMAINS =
["gmail.com", "yahoo.com", "outlook.com", "hotmail.com", "icloud.com", "aol.com", "proton.me", "live.com", "msn.com"] of ::String -
MIN_LENGTH_FOR_DISTANCE_2 =
6 -
A domain shorter than this only counts as a typo at distance 1.
-
VERSION =
"1.0.0"
Class Method Summary
- .check(text : String, extra : Array(String) = [] of String) : Result
-
.distance(a : String, b : String) : Int32
Levenshtein edit distance (insert, delete, substitute; each costs 1).
-
.parse_domains(text : String) : Array(String)
Reads a list of domains, one per line.
- .render(result : Result) : String
-
.suggest(domain : String, known : Array(String)) : Tuple(String, Int32) | Nil
The one known domain this domain is a typo of, with its distance, or nil.
Class Method Detail
def self.distance(a : String, b : String) : Int32
#
Levenshtein edit distance (insert, delete, substitute; each costs 1).
def self.parse_domains(text : String) : Array(String)
#
Reads a list of domains, one per line. Blank lines are skipped.
def self.suggest(domain : String, known : Array(String)) : Tuple(String, Int32) | Nil
#
The one known domain this domain is a typo of, with its distance, or nil.