personal

package module
v0.0.0-...-09e4b24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2016 License: MIT Imports: 3 Imported by: 0

README

go-personal Build Status GoDoc

A tiny library to score strings as fullnames or emails. Given a list of strings the library returns which is the most accurate Fullname or Email.

Installation

The recommended way to install go-personal

go get github.com/mcuadros/go-personal

Examples

A basic example:

names := []string{"mcuadros", "Máximo Cuadros", "Máximo Cuadros Ortiz"}
best := personal.GetBestFullName(names)
fmt.Printlm(best)
//Returns "Máximo Cuadros Ortiz"

names := []string{"bar@foo.com", "bar@gmail.com", "bar@localdomain.local"}
best := personal.GetBestEmail(names)
fmt.Printlm(best)
//Returns "bar@gmail.com"

License

MIT, see LICENSE

Documentation

Overview

Package personal is a tiny library to score strings as fullname or emails. Given a list of strings the library returns which is the most accurate Fullname or Email.

Index

Constants

This section is empty.

Variables

View Source
var TLDs = map[string]interface{}{}/* 3813 elements not displayed */

TLDs is a map of tld for quick lookup

Functions

func GetBestEmail

func GetBestEmail(emails []string) string

GetBestEmail returns the best email that can be found on the list of strings.

func GetBestFirstname

func GetBestFirstname(names []string) string

GetBestFirstname returns the first name that can be found on the list of fullnames.

func GetBestFullName

func GetBestFullName(names []string) string

GetBestFullName returns the best fullname that can be found on the list of strings. It gives priority to strings with correctly capitalized names, only letter strings, longer strings and strings with more than two words and less than four.

func ScoreEmail

func ScoreEmail(email string) float64

ScoreEmail returns the score for a given email, higher is better.

func ScoreEmails

func ScoreEmails(emails []string) map[string]float64

ScoreEmails returns a map with the emails and its score, higher is better

func ScoreFullName

func ScoreFullName(s string) float64

ScoreFullName returns the full name score for a given string

func ScoreFullNames

func ScoreFullNames(names []string) map[string]float64

ScoreFullNames returns a map with the fullnames and his score, higher is better

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL