address-matcher 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/.gitignore +35 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +49 -0
- data/README.md +59 -0
- data/Rakefile +12 -0
- data/VERSION +0 -0
- data/address_matcher.gemspec +24 -0
- data/lib/address_matcher.rb +5 -0
- data/lib/address_matcher/address_group.rb +36 -0
- data/lib/address_matcher/address_library.rb +48 -0
- data/spec/address_group_spec.rb +49 -0
- data/spec/address_library_spec.rb +120 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/support/geocoder.rb +77 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1831908f206efe59220256895312e2ce97de4129
|
4
|
+
data.tar.gz: 32f4b6abc67ad11c50a996c57540c0fb8c4923c9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d4276c12dc3d9e21d3664d334aac9a1562d85414d6a6fc59bdcf5618aad6fe08a149256103a22c00c065f70664eda00d953a1cc6e49097f053d05f4c77458398
|
7
|
+
data.tar.gz: 0745c45623cf69e85ff962332ed1b5fa2f3cf0e6a2b663a5e1f3918cb064ff0ff41c1aad9e4de37e78cc8f33fbe146e769c860a3b0add63d0297c7dfe87f4a75
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/vendor/bundle
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
address-matcher (0.0.1)
|
5
|
+
geocoder (~> 1.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
coderay (1.1.0)
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
docile (1.1.5)
|
13
|
+
geocoder (1.2.8)
|
14
|
+
method_source (0.8.2)
|
15
|
+
multi_json (1.11.0)
|
16
|
+
pry (0.10.1)
|
17
|
+
coderay (~> 1.1.0)
|
18
|
+
method_source (~> 0.8.1)
|
19
|
+
slop (~> 3.4)
|
20
|
+
rake (10.4.2)
|
21
|
+
rspec (3.2.0)
|
22
|
+
rspec-core (~> 3.2.0)
|
23
|
+
rspec-expectations (~> 3.2.0)
|
24
|
+
rspec-mocks (~> 3.2.0)
|
25
|
+
rspec-core (3.2.2)
|
26
|
+
rspec-support (~> 3.2.0)
|
27
|
+
rspec-expectations (3.2.0)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.2.0)
|
30
|
+
rspec-mocks (3.2.1)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.2.0)
|
33
|
+
rspec-support (3.2.2)
|
34
|
+
simplecov (0.9.2)
|
35
|
+
docile (~> 1.1.0)
|
36
|
+
multi_json (~> 1.0)
|
37
|
+
simplecov-html (~> 0.9.0)
|
38
|
+
simplecov-html (0.9.0)
|
39
|
+
slop (3.6.0)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
address-matcher!
|
46
|
+
pry (~> 0.10)
|
47
|
+
rake (~> 10.4)
|
48
|
+
rspec (~> 3.2)
|
49
|
+
simplecov (~> 0.9)
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Address Matcher
|
2
|
+
|
3
|
+
## What's in an address?
|
4
|
+
|
5
|
+
Are `123 Main St., Smalltown, RI` and `123 Main Street, Smalltown, RI` the same
|
6
|
+
address? `==` says `false`, but `human intuition` says yes. This gem leverages
|
7
|
+
the excellent [geocoder gem](https://github.com/alexreisner/geocoder) to make a
|
8
|
+
more educated guess by comparing lat/long of two addresses and returning `true`
|
9
|
+
if they are close enough.
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
`$ gem install address_matcher`
|
14
|
+
|
15
|
+
`require address_matcher`
|
16
|
+
|
17
|
+
Create an `AddressLibrary` with all of the "known" address strings that you want
|
18
|
+
to match against:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
addresses = ['30 Lincoln Center Plaza, New York, NY 10023',
|
22
|
+
'1000 5th Ave, New York, NY 10028',
|
23
|
+
'1001 5th Avenue, New York, NY 10028',
|
24
|
+
'1002 5th Avenue, New York, NY 10028'
|
25
|
+
]
|
26
|
+
|
27
|
+
library = AddressLibrary.build(addresses)
|
28
|
+
```
|
29
|
+
|
30
|
+
Then simply call `match` to find the closest matching address:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
library.match('1000 5th Avenue, New York, NY 10028')
|
34
|
+
#=> 1000 5th Ave, New York, NY 10028
|
35
|
+
```
|
36
|
+
|
37
|
+
## License
|
38
|
+
### MIT
|
39
|
+
|
40
|
+
```
|
41
|
+
Copyright (c) 2015 Stuart Terrett
|
42
|
+
|
43
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
44
|
+
this software and associated documentation files (the "Software"), to deal in
|
45
|
+
the Software without restriction, including without limitation the rights to
|
46
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
47
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
48
|
+
subject to the following conditions:
|
49
|
+
|
50
|
+
The above copyright notice and this permission notice shall be included in all
|
51
|
+
copies or substantial portions of the Software.
|
52
|
+
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
54
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
55
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
56
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
57
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
58
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
59
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
desc 'Default: run specs.'
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
desc 'Run specs'
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
|
+
|
11
|
+
desc 'Generate code coverage'
|
12
|
+
RSpec::Core::RakeTask.new(:coverage)
|
data/VERSION
ADDED
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'address-matcher'
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.date = '2015-04-07'
|
5
|
+
s.summary = "Matches addresses by geocoding"
|
6
|
+
s.description = "Uses geocoding to perform fuzzy match on address strings"
|
7
|
+
s.authors = ["Stuart Terrett"]
|
8
|
+
s.email = 'shterrett@gmail.com'
|
9
|
+
s.files = ["lib/address_matcher.rb"]
|
10
|
+
s.homepage = 'http://github.com/shterrett/address_matcher'
|
11
|
+
s.license = 'MIT'
|
12
|
+
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
|
18
|
+
s.add_dependency('geocoder', '~> 1.2')
|
19
|
+
|
20
|
+
s.add_development_dependency('rake', '~> 10.4')
|
21
|
+
s.add_development_dependency('rspec', '~> 3.2')
|
22
|
+
s.add_development_dependency('simplecov', '~> 0.9')
|
23
|
+
s.add_development_dependency('pry', '~> 0.10')
|
24
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class AddressGroup
|
2
|
+
def initialize
|
3
|
+
@store = {}
|
4
|
+
end
|
5
|
+
|
6
|
+
def []=(lat_long, address)
|
7
|
+
store[lat_long] = address
|
8
|
+
end
|
9
|
+
|
10
|
+
def [](lat_long)
|
11
|
+
store[lat_long]
|
12
|
+
end
|
13
|
+
|
14
|
+
def match(lat_long)
|
15
|
+
if exact = store[lat_long]
|
16
|
+
exact
|
17
|
+
else
|
18
|
+
closest_match(lat_long)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
attr_reader :store
|
24
|
+
|
25
|
+
def closest_match(lat_long)
|
26
|
+
closest = store.keys.min do |a, b|
|
27
|
+
distance_between(lat_long, a) <=> distance_between(lat_long, b)
|
28
|
+
end
|
29
|
+
|
30
|
+
store[closest]
|
31
|
+
end
|
32
|
+
|
33
|
+
def distance_between(p1, p2)
|
34
|
+
Geocoder::Calculations.distance_between(p1, p2)
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class AddressLibrary
|
2
|
+
def self.build(address_list)
|
3
|
+
new.tap do |library|
|
4
|
+
address_list.each { |address| library.add_address(address) }
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@store = Hash.new do |outer, o_key|
|
10
|
+
outer[o_key] = Hash.new do |inner, i_key|
|
11
|
+
inner[i_key] = AddressGroup.new
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_address(address_string)
|
17
|
+
coords = geocode(address_string)
|
18
|
+
store[latitude_index(coords)][longitude_index(coords)][coords] = address_string
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
def near(coords)
|
23
|
+
store[latitude_index(coords)][longitude_index(coords)]
|
24
|
+
end
|
25
|
+
|
26
|
+
def match(address_string)
|
27
|
+
coords = geocode(address_string)
|
28
|
+
group = store[latitude_index(coords)][longitude_index(coords)]
|
29
|
+
group.match(coords)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
attr_reader :store
|
34
|
+
|
35
|
+
def geocode(address_string)
|
36
|
+
Geocoder.search(address_string)
|
37
|
+
.first
|
38
|
+
.coordinates
|
39
|
+
end
|
40
|
+
|
41
|
+
def latitude_index(coords)
|
42
|
+
coords.first.round(3)
|
43
|
+
end
|
44
|
+
|
45
|
+
def longitude_index(coords)
|
46
|
+
coords.last.round(3)
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AddressGroup do
|
4
|
+
let(:symphony_hall) do
|
5
|
+
{ lat_long: [42.3426, -71.0858],
|
6
|
+
address: '301 Massachusetts Ave, Boston, MA 02115'
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:nec) do
|
11
|
+
{ lat_long: [42.3406, -71.0869],
|
12
|
+
address: '290 Huntington Ave, Boston, MA 02115'
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:boco) do
|
17
|
+
{ lat_long: [42.3462, -71.0901],
|
18
|
+
address: '8 Fenway, Boston, MA 02215'
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
it 'stores addresses keyed by lat/long' do
|
24
|
+
address_group = AddressGroup.new
|
25
|
+
address_group[symphony_hall[:lat_long]] = symphony_hall[:address]
|
26
|
+
|
27
|
+
expect(address_group[symphony_hall[:lat_long]]).to eq symphony_hall[:address]
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'returns the address of an exact lat/long match' do
|
31
|
+
address_group = AddressGroup.new
|
32
|
+
address_group[symphony_hall[:lat_long]] = symphony_hall[:address]
|
33
|
+
address_group[nec[:lat_long]] = nec[:address]
|
34
|
+
|
35
|
+
match = address_group.match(symphony_hall[:lat_long])
|
36
|
+
|
37
|
+
expect(match).to eq symphony_hall[:address]
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'returns the address of the closest lat/long if there is not an exact match' do
|
41
|
+
address_group = AddressGroup.new
|
42
|
+
address_group[boco[:lat_long]] = boco[:address]
|
43
|
+
address_group[nec[:lat_long]] = nec[:address]
|
44
|
+
|
45
|
+
match = address_group.match(symphony_hall[:lat_long])
|
46
|
+
|
47
|
+
expect(match).to eq nec[:address]
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AddressLibrary do
|
4
|
+
it 'geocodes an address' do
|
5
|
+
allow(Geocoder).to receive(:search).and_call_original
|
6
|
+
|
7
|
+
AddressLibrary.new.add_address('30 Lincoln Center Plaza, New York, NY 10023')
|
8
|
+
|
9
|
+
expect(Geocoder).to(
|
10
|
+
have_received(:search).with('30 Lincoln Center Plaza, New York, NY 10023')
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'adds address to an AddressGroup indexed by lat-long to 3 digit precision' do
|
15
|
+
lib = AddressLibrary.new.add_address('30 Lincoln Center Plaza, New York, NY 10023')
|
16
|
+
|
17
|
+
group = lib.near([40.773, -73.984])
|
18
|
+
|
19
|
+
expect(group).to be_an_instance_of AddressGroup
|
20
|
+
expect(group[[40.772748, -73.98384759999]]).to(
|
21
|
+
eq '30 Lincoln Center Plaza, New York, NY 10023'
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'adds multiple nearby addresses to the same AddressGroup' do
|
26
|
+
lib = AddressLibrary.new
|
27
|
+
.add_address('1000 5th Avenue, New York, NY 10028')
|
28
|
+
.add_address('1002 5th Avenue, New York, NY 10028')
|
29
|
+
|
30
|
+
group = lib.near([40.779, -73.963])
|
31
|
+
|
32
|
+
expect(group[[40.7791655, -73.9629278]]).to(
|
33
|
+
eq '1000 5th Avenue, New York, NY 10028'
|
34
|
+
)
|
35
|
+
expect(group[[40.7785016, -73.9625847]]).to(
|
36
|
+
eq '1002 5th Avenue, New York, NY 10028'
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'adds multiple far-apart addresses to different AddressGroups' do
|
41
|
+
lib = AddressLibrary.new
|
42
|
+
.add_address('1000 5th Avenue, New York, NY 10028')
|
43
|
+
.add_address('30 Lincoln Center Plaza, New York, NY 10023')
|
44
|
+
|
45
|
+
group_1 = lib.near([40.779, -73.963])
|
46
|
+
group_2 = lib.near([40.773, -73.984])
|
47
|
+
|
48
|
+
expect(group_1[[40.7791655, -73.9629278]]).to(
|
49
|
+
eq '1000 5th Avenue, New York, NY 10028'
|
50
|
+
)
|
51
|
+
expect(group_2[[40.7791655, -73.9629278]]).to be_nil
|
52
|
+
expect(group_1[[40.772748, -73.98384759999]]).to be_nil
|
53
|
+
expect(group_2[[40.772748, -73.98384759999]]).to(
|
54
|
+
eq '30 Lincoln Center Plaza, New York, NY 10023'
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'adds an array of addresses' do
|
59
|
+
addresses = ['30 Lincoln Center Plaza, New York, NY 10023',
|
60
|
+
'1000 5th Ave, New York, NY 10028',
|
61
|
+
'1001 5th Avenue, New York, NY 10028',
|
62
|
+
'1002 5th Avenue, New York, NY 10028'
|
63
|
+
]
|
64
|
+
|
65
|
+
lib = AddressLibrary.build(addresses)
|
66
|
+
|
67
|
+
group_1 = lib.near([40.779, -73.963])
|
68
|
+
group_2 = lib.near([40.773, -73.984])
|
69
|
+
group_3 = lib.near([40.779, -73.962])
|
70
|
+
|
71
|
+
expect(group_1[[40.77916555, -73.9629278]]).to(
|
72
|
+
eq '1000 5th Ave, New York, NY 10028'
|
73
|
+
)
|
74
|
+
expect(group_1[[40.7785016, -73.9625847]]).to(
|
75
|
+
eq '1002 5th Avenue, New York, NY 10028'
|
76
|
+
)
|
77
|
+
expect(group_2[[40.772748, -73.98384759999]]).to(
|
78
|
+
eq '30 Lincoln Center Plaza, New York, NY 10023'
|
79
|
+
)
|
80
|
+
expect(group_3[[40.7785889, -73.9621559]]).to(
|
81
|
+
eq '1001 5th Avenue, New York, NY 10028'
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#near' do
|
86
|
+
it 'returns the address group indexed at the 3-digit precision for a given set of coordinates' do
|
87
|
+
lib = AddressLibrary.new
|
88
|
+
.add_address('1000 5th Avenue, New York, NY 10028')
|
89
|
+
.add_address('30 Lincoln Center Plaza, New York, NY 10023')
|
90
|
+
|
91
|
+
group_1 = lib.near([40.7791655, -73.9629278])
|
92
|
+
group_2 = lib.near([40.772748, -73.98384759999])
|
93
|
+
|
94
|
+
expect(group_1[[40.7791655, -73.9629278]]).to(
|
95
|
+
eq '1000 5th Avenue, New York, NY 10028'
|
96
|
+
)
|
97
|
+
expect(group_2[[40.7791655, -73.9629278]]).to be_nil
|
98
|
+
expect(group_1[[40.772748, -73.98384759999]]).to be_nil
|
99
|
+
expect(group_2[[40.772748, -73.98384759999]]).to(
|
100
|
+
eq '30 Lincoln Center Plaza, New York, NY 10023'
|
101
|
+
)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe '#match' do
|
106
|
+
it 'returns the address which most nearly matches the given address' do
|
107
|
+
addresses = ['30 Lincoln Center Plaza, New York, NY 10023',
|
108
|
+
'1000 5th Ave, New York, NY 10028',
|
109
|
+
'1001 5th Avenue, New York, NY 10028',
|
110
|
+
'1002 5th Avenue, New York, NY 10028'
|
111
|
+
]
|
112
|
+
|
113
|
+
lib = AddressLibrary.build(addresses)
|
114
|
+
|
115
|
+
match = lib.match('1000 5th Avenue, New York, NY 10028')
|
116
|
+
|
117
|
+
expect(match).to eq '1000 5th Ave, New York, NY 10028'
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'pry'
|
3
|
+
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter 'spec/'
|
6
|
+
end
|
7
|
+
|
8
|
+
# encoding: utf-8
|
9
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
10
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
11
|
+
|
12
|
+
require 'geocoder'
|
13
|
+
require_relative 'support/geocoder'
|
14
|
+
|
15
|
+
Dir['./spec/shared/**/*.rb'].sort.each { |f| require f }
|
16
|
+
require_relative '../lib/address_matcher'
|
17
|
+
|
18
|
+
require 'rspec'
|
19
|
+
|
20
|
+
RSpec.configure do |config|
|
21
|
+
config.order = 'random'
|
22
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
Geocoder.configure(lookup: :test)
|
2
|
+
|
3
|
+
Geocoder::Lookup::Test.add_stub(
|
4
|
+
'Lincoln Center for the Performing Arts, 30 Lincoln Center Plaza, New York, NY 10023', [
|
5
|
+
{ 'latitude' => 40.772748,
|
6
|
+
'longitude' => -73.98384759999,
|
7
|
+
'address' => '30 Lincoln Center Plaza, New York, NY 10023',
|
8
|
+
'state' => 'New York',
|
9
|
+
'state_code' => 'NY',
|
10
|
+
'country' => 'United States',
|
11
|
+
'country_code' => 'US'
|
12
|
+
}
|
13
|
+
]
|
14
|
+
)
|
15
|
+
Geocoder::Lookup::Test.add_stub(
|
16
|
+
'30 Lincoln Center Plaza, New York, NY 10023', [
|
17
|
+
{ 'latitude' => 40.772748,
|
18
|
+
'longitude' => -73.98384759999,
|
19
|
+
'address' => '30 Lincoln Center Plaza, New York, NY 10023',
|
20
|
+
'state' => 'New York',
|
21
|
+
'state_code' => 'NY',
|
22
|
+
'country' => 'United States',
|
23
|
+
'country_code' => 'US'
|
24
|
+
}
|
25
|
+
]
|
26
|
+
)
|
27
|
+
|
28
|
+
Geocoder::Lookup::Test.add_stub(
|
29
|
+
'1000 5th Ave, New York, NY 10028', [
|
30
|
+
{ 'latitude' => 40.77916555,
|
31
|
+
'longitude' => -73.9629278,
|
32
|
+
'address' => '1000 5th Ave, New York, NY 10028',
|
33
|
+
'state' => 'New York',
|
34
|
+
'state_code' => 'NY',
|
35
|
+
'country' => 'United States',
|
36
|
+
'country_code' => 'US'
|
37
|
+
}
|
38
|
+
]
|
39
|
+
)
|
40
|
+
Geocoder::Lookup::Test.add_stub(
|
41
|
+
'1000 5th Avenue, New York, NY 10028', [
|
42
|
+
{ 'latitude' => 40.7791655,
|
43
|
+
'longitude' => -73.9629278,
|
44
|
+
'address' => '1000 5th Ave, New York, NY 10028',
|
45
|
+
'state' => 'New York',
|
46
|
+
'state_code' => 'NY',
|
47
|
+
'country' => 'United States',
|
48
|
+
'country_code' => 'US'
|
49
|
+
}
|
50
|
+
]
|
51
|
+
)
|
52
|
+
|
53
|
+
Geocoder::Lookup::Test.add_stub(
|
54
|
+
'1001 5th Avenue, New York, NY 10028', [
|
55
|
+
{ 'latitude' => 40.7785889,
|
56
|
+
'longitude' => -73.9621559,
|
57
|
+
'address' => '1000 5th Ave, New York, NY 10028',
|
58
|
+
'state' => 'New York',
|
59
|
+
'state_code' => 'NY',
|
60
|
+
'country' => 'United States',
|
61
|
+
'country_code' => 'US'
|
62
|
+
}
|
63
|
+
]
|
64
|
+
)
|
65
|
+
|
66
|
+
Geocoder::Lookup::Test.add_stub(
|
67
|
+
'1002 5th Avenue, New York, NY 10028', [
|
68
|
+
{ 'latitude' => 40.7785016,
|
69
|
+
'longitude' => -73.9625847,
|
70
|
+
'address' => '1002 5th Ave, New York, NY 10028',
|
71
|
+
'state' => 'New York',
|
72
|
+
'state_code' => 'NY',
|
73
|
+
'country' => 'United States',
|
74
|
+
'country_code' => 'US'
|
75
|
+
}
|
76
|
+
]
|
77
|
+
)
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: address-matcher
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stuart Terrett
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: geocoder
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.4'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.10'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.10'
|
83
|
+
description: Uses geocoding to perform fuzzy match on address strings
|
84
|
+
email: shterrett@gmail.com
|
85
|
+
executables: []
|
86
|
+
extensions: []
|
87
|
+
extra_rdoc_files: []
|
88
|
+
files:
|
89
|
+
- ".gitignore"
|
90
|
+
- Gemfile
|
91
|
+
- Gemfile.lock
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
94
|
+
- VERSION
|
95
|
+
- address_matcher.gemspec
|
96
|
+
- lib/address_matcher.rb
|
97
|
+
- lib/address_matcher/address_group.rb
|
98
|
+
- lib/address_matcher/address_library.rb
|
99
|
+
- spec/address_group_spec.rb
|
100
|
+
- spec/address_library_spec.rb
|
101
|
+
- spec/spec_helper.rb
|
102
|
+
- spec/support/geocoder.rb
|
103
|
+
homepage: http://github.com/shterrett/address_matcher
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.2.2
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: Matches addresses by geocoding
|
127
|
+
test_files:
|
128
|
+
- spec/address_group_spec.rb
|
129
|
+
- spec/address_library_spec.rb
|
130
|
+
- spec/spec_helper.rb
|
131
|
+
- spec/support/geocoder.rb
|