Skip to content

Commit

Permalink
doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynom committed Jun 20, 2018
1 parent a1608f4 commit 8ba1784
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,23 @@ To help people avoid submitting an incorrect e-mail address, one could try the f

```go
func SuggestAlternative(email string, domains []string) (string, float64) {

i := strings.LastIndex(email, "@")
if i <= 0 || i >= len(email) {
return email, 0
}

// Extracting the local and domain parts
localPart := email[:i]
hostname := email[i+1:]

sug, _ := finder.New(domains)
alternative, score := sug.Find(hostname)
if score > 0.9 {
alternative, score, exact := sug.Find(hostname)

if exact || score > 0.9 {
combined := localPart + "@" + alternative
return combined, score
}

return email, score
}
```
Expand Down

0 comments on commit 8ba1784

Please sign in to comment.