predict_email 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +22 -0
- data/.travis.yml +15 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +54 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +13 -0
- data/ToDo.md +5 -0
- data/bin/predict_email +5 -0
- data/lib/predict_email/app.rb +58 -0
- data/lib/predict_email/csv/sample_data.csv +7 -0
- data/lib/predict_email/find_pattern.rb +64 -0
- data/lib/predict_email/predict_email.rb +64 -0
- data/lib/predict_email/version.rb +3 -0
- data/lib/predict_email.rb +4 -0
- data/predict_email.gemspec +25 -0
- data/spec/find_pattern_spec.rb +73 -0
- data/spec/predict_email_spec.rb +77 -0
- data/spec/spec_helper.rb +7 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a280c17a8357a36c827be8904494e1d03671615b
|
4
|
+
data.tar.gz: e0e22ad84d8cd93688bb4e4bfcd0463f3af997b2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b92770f87ff58a9ab73c104c3693e357737b135bc6aec1ef3bd677a40e225f62ed46dace71aaddb0916a7b580574530e842cd5cb6ead175faab4903c320bace
|
7
|
+
data.tar.gz: d3449c513eae05f1434380c8262005e41babb38231eab6c158022d963358ca59f45de371b26514fb8c827e72da025a89afb54c55ab5060db3ff6758f97b515f2
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
predict_email (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coveralls (0.7.1)
|
10
|
+
multi_json (~> 1.3)
|
11
|
+
rest-client
|
12
|
+
simplecov (>= 0.7)
|
13
|
+
term-ansicolor
|
14
|
+
thor
|
15
|
+
diff-lcs (1.2.5)
|
16
|
+
docile (1.1.5)
|
17
|
+
mime-types (2.3)
|
18
|
+
multi_json (1.10.1)
|
19
|
+
netrc (0.7.7)
|
20
|
+
rake (10.3.2)
|
21
|
+
rest-client (1.7.2)
|
22
|
+
mime-types (>= 1.16, < 3.0)
|
23
|
+
netrc (~> 0.7)
|
24
|
+
rspec (3.0.0)
|
25
|
+
rspec-core (~> 3.0.0)
|
26
|
+
rspec-expectations (~> 3.0.0)
|
27
|
+
rspec-mocks (~> 3.0.0)
|
28
|
+
rspec-core (3.0.4)
|
29
|
+
rspec-support (~> 3.0.0)
|
30
|
+
rspec-expectations (3.0.4)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.0.0)
|
33
|
+
rspec-mocks (3.0.4)
|
34
|
+
rspec-support (~> 3.0.0)
|
35
|
+
rspec-support (3.0.4)
|
36
|
+
simplecov (0.9.0)
|
37
|
+
docile (~> 1.1.0)
|
38
|
+
multi_json
|
39
|
+
simplecov-html (~> 0.8.0)
|
40
|
+
simplecov-html (0.8.0)
|
41
|
+
term-ansicolor (1.3.0)
|
42
|
+
tins (~> 1.0)
|
43
|
+
thor (0.19.1)
|
44
|
+
tins (1.3.2)
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
ruby
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
bundler (~> 1.6)
|
51
|
+
coveralls
|
52
|
+
predict_email!
|
53
|
+
rake
|
54
|
+
rspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 kylefdoherty
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# PredictEmail
|
2
|
+
[![Code Climate](https://codeclimate.com/repos/53ff211a6956807cee01ecad/badges/9f8afa9a0ff41f8e85ff/gpa.svg)](https://codeclimate.com/repos/53ff211a6956807cee01ecad/feed)
|
3
|
+
[![Build Status](https://travis-ci.org/kylefdoherty/email-prediction.svg?branch=master)](https://travis-ci.org/kylefdoherty/email-prediction)
|
4
|
+
[![Coverage Status](https://img.shields.io/coveralls/kylefdoherty/email-prediction.svg)](https://coveralls.io/r/kylefdoherty/email-prediction?branch=master)
|
5
|
+
|
6
|
+
TODO: Write a gem description
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'predict_email'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install predict_email
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
TODO: Write usage instructions here
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
|
28
|
+
1. Fork it ( https://github.com/[my-github-username]/predict_email/fork )
|
29
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
30
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
31
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
32
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/ToDo.md
ADDED
data/bin/predict_email
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require_relative 'predict_email'
|
2
|
+
|
3
|
+
module PredictEmail
|
4
|
+
module Cli
|
5
|
+
class App
|
6
|
+
|
7
|
+
|
8
|
+
def parse_input(user_input)
|
9
|
+
user_input.split(',')
|
10
|
+
end
|
11
|
+
|
12
|
+
def valid_input(user_input)
|
13
|
+
name, company = parse_input(user_input)
|
14
|
+
if name.split(" ").size != 2 || company == nil
|
15
|
+
p "Please enter a first and last name along with the company, such as: 'Steve Jobs', 'Apple.com'"
|
16
|
+
user_input = gets.strip
|
17
|
+
valid_input(user_input)
|
18
|
+
else
|
19
|
+
return user_input
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
prediction = PredictEmail.new
|
25
|
+
|
26
|
+
puts "Enter a name and company website, such as: 'Steve Jobs', 'Apple.com' OR type 'exit' to leave."
|
27
|
+
user_input = gets.strip
|
28
|
+
|
29
|
+
until user_input == 'exit'
|
30
|
+
|
31
|
+
puts "\n"
|
32
|
+
name, company = parse_input(valid_input(user_input))
|
33
|
+
p "PREDICTION: #{prediction.predict_email(name, company.strip)}"
|
34
|
+
puts "\n"
|
35
|
+
p "Enter a name and company website, such as: 'Steve Jobs', 'Apple.com'"
|
36
|
+
user_input = gets.strip
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
if $0 == __FILE__
|
49
|
+
PredictEmail::Cli::App.new
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module PredictEmail
|
4
|
+
class FindPattern
|
5
|
+
attr_reader :emails
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@emails = CSV.read(Dir.pwd + '/lib/predict_email/csv/sample_data.csv').inject({}) do |result, element|
|
9
|
+
result[element.first] = element.last
|
10
|
+
result
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def normalize_company_name(company)
|
15
|
+
company.downcase.gsub(/\s+/, "")
|
16
|
+
end
|
17
|
+
|
18
|
+
def find_contacts(company)
|
19
|
+
company = normalize_company_name(company)
|
20
|
+
emails.select {|k,v| v.include?(company) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def split_email(email)
|
24
|
+
email[/[^@]+/].downcase.split('.')
|
25
|
+
end
|
26
|
+
|
27
|
+
def email_pattern(contact)
|
28
|
+
first_name, last_name = contact.first.downcase.split(' ')
|
29
|
+
before_dot, after_dot = split_email(contact.last)
|
30
|
+
|
31
|
+
if first_name == before_dot && last_name == after_dot
|
32
|
+
"first_name_dot_last_name"
|
33
|
+
elsif first_name == before_dot && last_name[0] == after_dot
|
34
|
+
"first_name_dot_last_initial"
|
35
|
+
elsif first_name[0] == before_dot && last_name == after_dot
|
36
|
+
"first_initial_dot_last_name"
|
37
|
+
elsif first_name[0] == before_dot && last_name[0] == after_dot
|
38
|
+
"first_initial_dot_last_initial"
|
39
|
+
else
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def find_patterns(company)
|
45
|
+
patterns = []
|
46
|
+
|
47
|
+
if find_contacts(company).empty?
|
48
|
+
patterns << nil
|
49
|
+
else
|
50
|
+
|
51
|
+
find_contacts(company).each do |contact|
|
52
|
+
patterns << email_pattern(contact)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
patterns = patterns.uniq
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
if $0 == __FILE__
|
63
|
+
test = PredictEmail::FindPattern.new
|
64
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative 'find_pattern'
|
2
|
+
|
3
|
+
module PredictEmail
|
4
|
+
class PredictEmail
|
5
|
+
|
6
|
+
def predict_email(name, company)
|
7
|
+
patterns = FindPattern.new.find_patterns(company)
|
8
|
+
if patterns.first
|
9
|
+
emails = patterns.map {|pat| self.send(pat.to_sym, name, company)}
|
10
|
+
"#{company} uses #{patterns.size} email #{pluralize_pattern(patterns)}: #{patterns_to_string(patterns)}. We predict #{name}'s email to be: #{emails_to_string(emails)}."
|
11
|
+
else
|
12
|
+
"Sorry, we can't predict the email for this person."
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def patterns_to_string(patterns)
|
17
|
+
patterns.join(", ")
|
18
|
+
end
|
19
|
+
|
20
|
+
def emails_to_string(emails)
|
21
|
+
emails.join(", ").gsub(", ", " OR ")
|
22
|
+
end
|
23
|
+
|
24
|
+
def split_name(name)
|
25
|
+
name.downcase.split(" ")
|
26
|
+
end
|
27
|
+
|
28
|
+
def first_name_dot_last_name(name, company)
|
29
|
+
first, last = split_name(name)
|
30
|
+
"#{first}.#{last}@#{company}"
|
31
|
+
end
|
32
|
+
|
33
|
+
def first_name_dot_last_initial(name, company)
|
34
|
+
first, last = split_name(name)
|
35
|
+
"#{first}.#{last[0]}@#{company}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def first_initial_dot_last_name(name, company)
|
39
|
+
first, last = split_name(name)
|
40
|
+
"#{first[0]}.#{last}@#{company}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def first_initial_dot_last_initial(name,company)
|
44
|
+
first, last = split_name(name)
|
45
|
+
"#{first[0]}.#{last[0]}@#{company}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def pluralize_pattern(patterns)
|
49
|
+
patterns.size > 1 ? 'patterns' : 'pattern'
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'predict_email/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "predict_email"
|
8
|
+
spec.version = PredictEmail::VERSION
|
9
|
+
spec.authors = ["kylefdoherty"]
|
10
|
+
spec.email = ["kyledoherty22@gmail.com"]
|
11
|
+
spec.summary = %q{Gem that allows you to predict a persons email from their name and company name.}
|
12
|
+
spec.description = %q{Can add a csv with names and emails and then predict what a person's email will be by looking at patterns used by other people from same company.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = ["predict_email"]
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "coveralls"
|
25
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe PredictEmail::FindPattern do
|
4
|
+
|
5
|
+
let(:prediction) { PredictEmail::FindPattern.new }
|
6
|
+
|
7
|
+
let(:sample_emails) {
|
8
|
+
{
|
9
|
+
"John Ferguson" => "john.ferguson@alphasights.com",
|
10
|
+
"Damon Aw" => "damon.aw@alphasights.com",
|
11
|
+
"Linda Li" => "linda.li@alphasights.com",
|
12
|
+
"Larry Page" => "larry.p@google.com",
|
13
|
+
"Sergey Brin" => "s.brin@google.com",
|
14
|
+
"Steve Jobs" => "s.j@apple.com",
|
15
|
+
"Kyle Doherty" => "kyle_doherty@flatironschool.com"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
|
20
|
+
#create class that has patterns & sample data
|
21
|
+
describe '#new' do
|
22
|
+
it 'is an instance of PredictEmail' do
|
23
|
+
expect(prediction).to be_instance_of(PredictEmail::FindPattern)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'has the sample data on initialization' do
|
27
|
+
expect(prediction.emails).to eq(sample_emails)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
#method that takes in name and company and figures out which pattern(s) that company uses
|
32
|
+
|
33
|
+
#first need to get the emails for that company we already have
|
34
|
+
describe '#find_contacts' do
|
35
|
+
alphasights_emails = {"John Ferguson" => "john.ferguson@alphasights.com",
|
36
|
+
"Damon Aw" => "damon.aw@alphasights.com",
|
37
|
+
"Linda Li" => "linda.li@alphasights.com"}
|
38
|
+
|
39
|
+
it 'takes the name and company and returns what pattern(s) that company uses for emails' do
|
40
|
+
expect(prediction.find_contacts("alphasights")).to eq(alphasights_emails)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
#loop through the emails we have and figure out what each uses
|
45
|
+
#and store them in a patterns collection
|
46
|
+
|
47
|
+
describe '#find_patterns' do
|
48
|
+
context 'compnay uses one email pattern' do
|
49
|
+
it 'returns the pattern(s) that company uses' do
|
50
|
+
expect(prediction.find_patterns('Alphasights.com')).to eq(['first_name_dot_last_name'])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'compnay uses more than one email pattern' do
|
55
|
+
it 'returns the pattern(s) that company uses' do
|
56
|
+
expect(prediction.find_patterns('google.com')).to eq(['first_name_dot_last_initial','first_initial_dot_last_name' ])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'company email pattern is not one of four checking for' do
|
61
|
+
it 'returns that it can not predict that pattern' do
|
62
|
+
expect(prediction.find_patterns('flatironschool.com')).to eq([nil])
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'no emails are returned for that company' do
|
67
|
+
it 'returns that there are no contacts for that company' do
|
68
|
+
expect(prediction.find_patterns('partnersgroup.com')).to eq([nil])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe PredictEmail::PredictEmail do
|
4
|
+
|
5
|
+
let(:prediction) { PredictEmail::PredictEmail.new }
|
6
|
+
|
7
|
+
describe '#predict_email' do
|
8
|
+
|
9
|
+
context 'company uses one pattern' do
|
10
|
+
it "predicts the person's email and returns pattern and predicted email" do
|
11
|
+
|
12
|
+
expected_response = "alphasights.com uses 1 email pattern: first_name_dot_last_name. We predict Peter Wong's email to be: peter.wong@alphasights.com."
|
13
|
+
|
14
|
+
expect(prediction.predict_email( "Peter Wong", "alphasights.com")).to eq(expected_response)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'company uses more than one pattern' do
|
19
|
+
it "predicts the person's email and returns patterns and predicted emails" do
|
20
|
+
expected_response = "google.com uses 2 email patterns: first_name_dot_last_initial, first_initial_dot_last_name. We predict Craig Silverstein's email to be: craig.s@google.com OR c.silverstein@google.com."
|
21
|
+
|
22
|
+
expect(prediction.predict_email("Craig Silverstein", "google.com")).to eq(expected_response)
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'company uses more than one pattern' do
|
28
|
+
it "tells user can't predict the email for this person" do
|
29
|
+
expected_response = "Sorry, we can't predict the email for this person."
|
30
|
+
|
31
|
+
expect(prediction.predict_email("Avi Flombaum", "flatironschool.com")).to eq(expected_response)
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'no contacts for that company' do
|
37
|
+
it "tells user can't predict email for this person" do
|
38
|
+
expected_response = "Sorry, we can't predict the email for this person."
|
39
|
+
|
40
|
+
expect(prediction.predict_email("Rust Cohle", "truedetective.com")).to eq(expected_response)
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
describe '#first_name_dot_last_name' do
|
49
|
+
it 'converts the name to appropriate email' do
|
50
|
+
expect(prediction.first_name_dot_last_name("Peter Wong", "alphasights.com")).to eq('peter.wong@alphasights.com')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#first_name_dot_last_initial' do
|
55
|
+
it 'converts the name to appropriate email' do
|
56
|
+
expect(prediction.first_name_dot_last_initial("Craig Silverstein", "google.com")).to eq('craig.s@google.com')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#first_initial_dot_last_name' do
|
61
|
+
it 'converts the name to appropriate email' do
|
62
|
+
expect(prediction.first_initial_dot_last_name("Marty Hart", "truedetective.com")).to eq('m.hart@truedetective.com')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#first_initial_dot_last_initial' do
|
67
|
+
it 'converts the name to appropriate email' do
|
68
|
+
expect(prediction.first_initial_dot_last_initial("Marty Hart", "truedetective.com")).to eq('m.h@truedetective.com')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: predict_email
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kylefdoherty
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Can add a csv with names and emails and then predict what a person's
|
70
|
+
email will be by looking at patterns used by other people from same company.
|
71
|
+
email:
|
72
|
+
- kyledoherty22@gmail.com
|
73
|
+
executables:
|
74
|
+
- predict_email
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".coveralls.yml"
|
79
|
+
- ".gitignore"
|
80
|
+
- ".travis.yml"
|
81
|
+
- Gemfile
|
82
|
+
- Gemfile.lock
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- ToDo.md
|
87
|
+
- bin/predict_email
|
88
|
+
- lib/predict_email.rb
|
89
|
+
- lib/predict_email/app.rb
|
90
|
+
- lib/predict_email/csv/sample_data.csv
|
91
|
+
- lib/predict_email/find_pattern.rb
|
92
|
+
- lib/predict_email/predict_email.rb
|
93
|
+
- lib/predict_email/version.rb
|
94
|
+
- predict_email.gemspec
|
95
|
+
- spec/find_pattern_spec.rb
|
96
|
+
- spec/predict_email_spec.rb
|
97
|
+
- spec/spec_helper.rb
|
98
|
+
homepage: ''
|
99
|
+
licenses:
|
100
|
+
- MIT
|
101
|
+
metadata: {}
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 2.2.2
|
119
|
+
signing_key:
|
120
|
+
specification_version: 4
|
121
|
+
summary: Gem that allows you to predict a persons email from their name and company
|
122
|
+
name.
|
123
|
+
test_files:
|
124
|
+
- spec/find_pattern_spec.rb
|
125
|
+
- spec/predict_email_spec.rb
|
126
|
+
- spec/spec_helper.rb
|