Given these 3 pieces of information:
- An advisor's name
- The domain name of the company he works for
- A set of name's and emails of other advisors that work for the same company
For this scenario there are 4 potential patterns
first_name_dot_last_name
: "[email protected]"first_name_dot_last_initial
: "[email protected]"first_initial_dot_last_name
: "[email protected]"first_initial_dot_last_initial
: "[email protected]"
And given a sample dataset:
{
"John Ferguson" => "[email protected]",
"Damon Aw" => "[email protected]",
"Linda Li" => "[email protected]",
"Larry Page" => "[email protected]",
"Sergey Brin" => "[email protected]",
"Steve Jobs" => "[email protected]"
}
We have to work out the most likely email address for the following:
- "Peter Wong", "alphasights.com"
- "Craig Silverstein", "google.com"
- "Steve Wozniak", "apple.com"
- "Barack Obama", "whitehouse.gov"
To run the test-suite that covers all 4 occurrences
$ bundle exec rspec
To log into the application's console, set CONSOLE
to true
when running the test suite
$ CONSOLE=true bundle exec rspec
which will boot pry
with the app loaded. Sample execution:
prediction = EmailPredictor::Prediction.new("Peter Wong", "alphasights.com")
=> #<EmailPredictor::Prediction:0x00000101e295f8
@domain=#<EmailPredictor::Domain:0x00000101e29580 @full_domain="alphasights.com">,
@name=#<EmailPredictor::Name:0x00000101e295a8 @full_name="Peter Wong">>
email = prediction.predicted_email
=> #<EmailPredictor::PredictedEmail:0x00000101d2c2e0 @address="[email protected]", @pattern=:first_name_dot_last_name>
email.address
=> "[email protected]"
email.pattern
=> :first_name_dot_last_name
-
For predominant patterns: the pattern used will always be the one with more ocurrences on the database
-
For multiple non-predominant patterns: any of them is used
-
For no previous pattern found a
NotImplementedError
is raised.