At AlphaSights, we often want to contact advisors even when we don't know know their email address.
This presents us with the challenge of having to predict what their actual email address will be.
To help with this process, we have the following information available:
- The advisor's name.
- The domain name of the company he works for.
- The names and emails of other advisors in our database that work for the same company (and domain name).
The last bit of information is particularly helpful as we can use it to figure out what pattern a company uses when assigning its email addresses.
Once we understand their pattern, we can then make a prediction on what the advisor's email will be.
As an example, let's say we have an advisor named "John Ferguson" who we know works for "alphasights.com"
For this exercise, there are four potential patterns this advisor's email could come in (or none at all):
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]"
So, if we have several other people in our database that work for "alphasights.com", we can use their info to predict John Ferguson's email address.
Given the following 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]"
}
Predict the email addresses for the following advisors:
- "Peter Wong", "alphasights.com"
- "Craig Silverstein", "google.com"
- "Steve Wozniak", "apple.com"
- "Barack Obama", "whitehouse.gov"
-
Remember that you only have to address four potential patterns:
- first_name_dot_last_name
- first_name_dot_last_initial
- first_initial_dot_last_name
- first_initial_dot_last_initial
-
It is possible that no prediction can accurately be made. The code should be able to respond appropriately to such a situation.
-
You can write the solution in any language you like, but keep in mind that we use Ruby as the primary language for all of our projects.
-
Organize and structure the code however you like. How well designed the code is will be relevant for us when evaluating your work.
-
We value code that is simple and clear. Oftentimes, the less complex solution is preferred, as long as it doesn't compromise on clarity.
-
It is best to have tests that check the expected behavior against the code's actual output. Much of the test cases can be inferred from the emails you expect the prediction to return.
-
Please provide us with instructions on how to get the code to run.
-
If you have any questions or need anything clarified, please don't hesitate to ask.