Coder Social home page Coder Social logo

email-guesser's Introduction

Email Address Predictor

Contents

Background

You're working for a flower marketing company and your job is to guess people's email addresses when given their full name and the domain name of the company they work for so you can send them coupons for holiday bouquets.

You've decided that instead of manually predicting their email addresses, you'll write a program to do it for you. This will allow you to watch your favorite actor John Cho crack jokes in the TV show Selfie.

Anyway...you have the following information available:

  1. The potential customer's name.
  2. The domain name of the company he/she works for.
  3. The names and emails of other advisors that work for the same company (and domain name).

The last bit of information is particularly helpful as it's what you use to figure out what pattern a company uses when assigning its email addresses.

Once you understand their pattern, you then make a prediction on what the advisor's email will be.

As an example, let's say you have a potential customer named "Jahmil Eady" who you know works for "wiser.com".

For this exercise, there are four potential patterns this employee's email could come in (or none at all):

Pattern Email
1 first_name_dot_last_name [email protected]
2 first_name_dot_last_initial [email protected]
3 first_initial_dot_last_name [email protected]
4 first_initial_dot_last_initial [email protected]

So, if you know the correct addresses for several other people who work at "wiser.com", you can predict Jahmil Eady's email address. For instance, if you know that Bianca Hoppe's email is [email protected], then you know that Wiser uses the first-initial-dot-last-name pattern, thus Jahmil Eady's email is probably [email protected].

Objective

Given the following sample dataset of past customers:

{
  "Jahmil Eady": "[email protected]",
  "Armando Amador": "[email protected]",
  "Linda Li": "[email protected]",
  "Anisha Ramnani": "[email protected]",
  "Sergey Brin": "[email protected]",
  "Nikki Thean": "[email protected]",
  "Amanda Pickering": "[email protected]"
}

Create a program that will read a JSON file of known emails, much like the JSON above, and use this data to predict new email addresses.

What is JSON?

About

To accomplish this lab, your program must be able to read JSON. So what is JSON? Well it stands for JavaScript Object Notation. JSON is a way to store information in an organized, easy-to-access manner. You might be alarmed and thinking, "But wait, I don't know JavaScript!" Don't worry, you don't need to know how to program in JavaScript to use JSON. In fact, Ruby has a built-in library for using it.

Example

// government.json

{
  "president": "Barack Obama",
  "vice president": "Joe Biden",
  "secretary of state": "John Kerry",
  "secretary of the treasury": "Jacob Lew"
}
require 'open-uri'
require 'json'

gov_file = File.read('government.json')

gov = JSON.parse(gov_file)

gov
# => 
# {
#   "president" => "Barack Obama",
#   "vice president" => "Joe Biden",
#   "secretary of state" => "John Kerry",
#   "secretary of the treasury" => "Jacob Lew"
# }

Final Thoughts

To learn more about JSON, take a look at Copter Labs' post, Hack Hands' post, or Wikipedia's page.

Instructions

This lab is test-driven so just run the testing suite to get started. The datasets you'll be reading are in spec/fixtures.

Resources

View this lesson on Learn.co

email-guesser's People

Contributors

kthffmn avatar fislabstest avatar nathaniel-miller avatar ahimmelstoss avatar fs-lms-test-bot avatar sarogers avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.