Giter Site home page Giter Site logo

email-predictor's Introduction

Email Predictor

The rules for email prediction are outlined in RULES.md.

Idea

The goal of the project was to write a simple system to predict email addresses from the name and domain of the company. While the task itself is relatively straightforward my approach was to write code as if for a real project with only minor simplifications. I tried to adhere to the following:

  • Single purpose classes: separating functionality into separate objects that talk to each other. This would simplify changing the system later. For example adding another email pattern is trivial. It also wouldn't be to hard to generate physical mailing addresses using this system.
  • Design patterns: in particular I used Strategy Pattern for the email encoder and something similar to it for decoder.
  • Isolating dependencies: each class is created with minimum number of dependecies.

Usage

To generate predictions for the predefined list set in the problem description run the following command in the Terminal (assuming ruby is installed and you are in the correct folder):

$ ruby main.rb

To generate custom new predictions first require the files in irb (the load file is shortcut for other system pieces):

require './load.rb'

Start a new predictor:

predictor = Predictor.new(AVAILABLE_PATTERNS)

Additional patterns can potentially be added at this point if required (e.g. [email protected])

Seed the database:

predictor.seed(SEED)

Database can be seeded with any hash containing names and emails. Also names and emails can be added in the constants.rb file.

Generate predictions:

predictor.predict('James Dean','alphasights.com')

Predictions will be generated in an array. Currently the code does not discriminate between available patterns. In some cases more than one pattern will be generated. If you require only correct predictions (eg. you don't want to send an email to the address that might be wrong) use

predictor.predict_correct_only('James Dean','alphasights.com')

These functions can also be put in main.rb.

Installation

From the Terminal:

$ git clone [email protected]:duboff/email-predictor.git
$ cd email-predictor/
$ bundle

This assumes you have command line tools installed.

Testing

To run the specs:

$ rspec

email-predictor's People

Contributors

duboff avatar

Stargazers

 avatar

Watchers

 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.