lite-address 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ 'north': 'N'
2
+ 'northeast': 'NE'
3
+ 'east': 'E'
4
+ 'southeast': 'SE'
5
+ 'south': 'S'
6
+ 'southwest': 'SW'
7
+ 'west': 'W'
8
+ 'northwest': 'NW'
@@ -0,0 +1,363 @@
1
+ 'allee': 'aly'
2
+ 'alley': 'aly'
3
+ 'ally': 'aly'
4
+ 'anex': 'anx'
5
+ 'annex': 'anx'
6
+ 'annx': 'anx'
7
+ 'arcade': 'arc'
8
+ 'av': 'ave'
9
+ 'aven': 'ave'
10
+ 'avenu': 'ave'
11
+ 'avenue': 'ave'
12
+ 'avn': 'ave'
13
+ 'avnue': 'ave'
14
+ 'bayoo': 'byu'
15
+ 'bayou': 'byu'
16
+ 'beach': 'bch'
17
+ 'bend': 'bnd'
18
+ 'bluf': 'blf'
19
+ 'bluff': 'blf'
20
+ 'bluffs': 'blfs'
21
+ 'bot': 'btm'
22
+ 'bottm': 'btm'
23
+ 'bottom': 'btm'
24
+ 'boul': 'blvd'
25
+ 'boulevard': 'blvd'
26
+ 'boulv': 'blvd'
27
+ 'branch': 'br'
28
+ 'brdge': 'brg'
29
+ 'bridge': 'brg'
30
+ 'brnch': 'br'
31
+ 'brook': 'brk'
32
+ 'brooks': 'brks'
33
+ 'burg': 'bg'
34
+ 'burgs': 'bgs'
35
+ 'bypa': 'byp'
36
+ 'bypas': 'byp'
37
+ 'bypass': 'byp'
38
+ 'byps': 'byp'
39
+ 'camp': 'cp'
40
+ 'canyn': 'cyn'
41
+ 'canyon': 'cyn'
42
+ 'cape': 'cpe'
43
+ 'causeway': 'cswy'
44
+ 'causway': 'cswy'
45
+ 'cen': 'ctr'
46
+ 'cent': 'ctr'
47
+ 'center': 'ctr'
48
+ 'centers': 'ctrs'
49
+ 'centr': 'ctr'
50
+ 'centre': 'ctr'
51
+ 'circ': 'cir'
52
+ 'circl': 'cir'
53
+ 'circle': 'cir'
54
+ 'circles': 'cirs'
55
+ 'ck': 'crk'
56
+ 'cliff': 'clf'
57
+ 'cliffs': 'clfs'
58
+ 'club': 'clb'
59
+ 'cmp': 'cp'
60
+ 'cnter': 'ctr'
61
+ 'cntr': 'ctr'
62
+ 'cnyn': 'cyn'
63
+ 'common': 'cmn'
64
+ 'corner': 'cor'
65
+ 'corners': 'cors'
66
+ 'course': 'crse'
67
+ 'court': 'ct'
68
+ 'courts': 'cts'
69
+ 'cove': 'cv'
70
+ 'coves': 'cvs'
71
+ 'cr': 'crk'
72
+ 'crcl': 'cir'
73
+ 'crcle': 'cir'
74
+ 'crecent': 'cres'
75
+ 'creek': 'crk'
76
+ 'crescent': 'cres'
77
+ 'cresent': 'cres'
78
+ 'crest': 'crst'
79
+ 'crossing': 'xing'
80
+ 'crossroad': 'xrd'
81
+ 'crscnt': 'cres'
82
+ 'crsent': 'cres'
83
+ 'crsnt': 'cres'
84
+ 'crssing': 'xing'
85
+ 'crssng': 'xing'
86
+ 'crt': 'ct'
87
+ 'curve': 'curv'
88
+ 'dale': 'dl'
89
+ 'dam': 'dm'
90
+ 'div': 'dv'
91
+ 'divide': 'dv'
92
+ 'driv': 'dr'
93
+ 'drive': 'dr'
94
+ 'drives': 'drs'
95
+ 'drv': 'dr'
96
+ 'dvd': 'dv'
97
+ 'estate': 'est'
98
+ 'estates': 'ests'
99
+ 'exp': 'expy'
100
+ 'expr': 'expy'
101
+ 'express': 'expy'
102
+ 'expressway': 'expy'
103
+ 'expw': 'expy'
104
+ 'extension': 'ext'
105
+ 'extensions': 'exts'
106
+ 'extn': 'ext'
107
+ 'extnsn': 'ext'
108
+ 'falls': 'fls'
109
+ 'ferry': 'fry'
110
+ 'field': 'fld'
111
+ 'fields': 'flds'
112
+ 'flat': 'flt'
113
+ 'flats': 'flts'
114
+ 'ford': 'frd'
115
+ 'fords': 'frds'
116
+ 'forest': 'frst'
117
+ 'forests': 'frst'
118
+ 'forg': 'frg'
119
+ 'forge': 'frg'
120
+ 'forges': 'frgs'
121
+ 'fork': 'frk'
122
+ 'forks': 'frks'
123
+ 'fort': 'ft'
124
+ 'freeway': 'fwy'
125
+ 'freewy': 'fwy'
126
+ 'frry': 'fry'
127
+ 'frt': 'ft'
128
+ 'frway': 'fwy'
129
+ 'frwy': 'fwy'
130
+ 'garden': 'gdn'
131
+ 'gardens': 'gdns'
132
+ 'gardn': 'gdn'
133
+ 'gateway': 'gtwy'
134
+ 'gatewy': 'gtwy'
135
+ 'gatway': 'gtwy'
136
+ 'glen': 'gln'
137
+ 'glens': 'glns'
138
+ 'grden': 'gdn'
139
+ 'grdn': 'gdn'
140
+ 'grdns': 'gdns'
141
+ 'green': 'grn'
142
+ 'greens': 'grns'
143
+ 'grov': 'grv'
144
+ 'grove': 'grv'
145
+ 'groves': 'grvs'
146
+ 'gtway': 'gtwy'
147
+ 'harb': 'hbr'
148
+ 'harbor': 'hbr'
149
+ 'harbors': 'hbrs'
150
+ 'harbr': 'hbr'
151
+ 'haven': 'hvn'
152
+ 'havn': 'hvn'
153
+ 'height': 'hts'
154
+ 'heights': 'hts'
155
+ 'hgts': 'hts'
156
+ 'highway': 'hwy'
157
+ 'highwy': 'hwy'
158
+ 'hill': 'hl'
159
+ 'hills': 'hls'
160
+ 'hiway': 'hwy'
161
+ 'hiwy': 'hwy'
162
+ 'hllw': 'holw'
163
+ 'hollow': 'holw'
164
+ 'hollows': 'holw'
165
+ 'holws': 'holw'
166
+ 'hrbor': 'hbr'
167
+ 'ht': 'hts'
168
+ 'hway': 'hwy'
169
+ 'inlet': 'inlt'
170
+ 'island': 'is'
171
+ 'islands': 'iss'
172
+ 'isles': 'isle'
173
+ 'islnd': 'is'
174
+ 'islnds': 'iss'
175
+ 'jction': 'jct'
176
+ 'jctn': 'jct'
177
+ 'jctns': 'jcts'
178
+ 'junction': 'jct'
179
+ 'junctions': 'jcts'
180
+ 'junctn': 'jct'
181
+ 'juncton': 'jct'
182
+ 'key': 'ky'
183
+ 'keys': 'kys'
184
+ 'knol': 'knl'
185
+ 'knoll': 'knl'
186
+ 'knolls': 'knls'
187
+ 'la': 'ln'
188
+ 'lake': 'lk'
189
+ 'lakes': 'lks'
190
+ 'landing': 'lndg'
191
+ 'lane': 'ln'
192
+ 'lanes': 'ln'
193
+ 'ldge': 'ldg'
194
+ 'light': 'lgt'
195
+ 'lights': 'lgts'
196
+ 'lndng': 'lndg'
197
+ 'loaf': 'lf'
198
+ 'lock': 'lck'
199
+ 'locks': 'lcks'
200
+ 'lodg': 'ldg'
201
+ 'lodge': 'ldg'
202
+ 'loops': 'loop'
203
+ 'manor': 'mnr'
204
+ 'manors': 'mnrs'
205
+ 'meadow': 'mdw'
206
+ 'meadows': 'mdws'
207
+ 'medows': 'mdws'
208
+ 'mill': 'ml'
209
+ 'mills': 'mls'
210
+ 'mission': 'msn'
211
+ 'missn': 'msn'
212
+ 'mnt': 'mt'
213
+ 'mntain': 'mtn'
214
+ 'mntn': 'mtn'
215
+ 'mntns': 'mtns'
216
+ 'motorway': 'mtwy'
217
+ 'mount': 'mt'
218
+ 'mountain': 'mtn'
219
+ 'mountains': 'mtns'
220
+ 'mountin': 'mtn'
221
+ 'mssn': 'msn'
222
+ 'mtin': 'mtn'
223
+ 'neck': 'nck'
224
+ 'orchard': 'orch'
225
+ 'orchrd': 'orch'
226
+ 'overpass': 'opas'
227
+ 'ovl': 'oval'
228
+ 'parks': 'park'
229
+ 'parkway': 'pkwy'
230
+ 'parkways': 'pkwy'
231
+ 'parkwy': 'pkwy'
232
+ 'passage': 'psge'
233
+ 'paths': 'path'
234
+ 'pikes': 'pike'
235
+ 'pine': 'pne'
236
+ 'pines': 'pnes'
237
+ 'pk': 'park'
238
+ 'pkway': 'pkwy'
239
+ 'pkwys': 'pkwy'
240
+ 'pky': 'pkwy'
241
+ 'place': 'pl'
242
+ 'plain': 'pln'
243
+ 'plaines': 'plns'
244
+ 'plains': 'plns'
245
+ 'plaza': 'plz'
246
+ 'plza': 'plz'
247
+ 'point': 'pt'
248
+ 'pointe': 'pt'
249
+ 'points': 'pts'
250
+ 'port': 'prt'
251
+ 'ports': 'prts'
252
+ 'prairie': 'pr'
253
+ 'prarie': 'pr'
254
+ 'prk': 'park'
255
+ 'prr': 'pr'
256
+ 'rad': 'radl'
257
+ 'radial': 'radl'
258
+ 'radiel': 'radl'
259
+ 'ranch': 'rnch'
260
+ 'ranches': 'rnch'
261
+ 'rapid': 'rpd'
262
+ 'rapids': 'rpds'
263
+ 'rdge': 'rdg'
264
+ 'rest': 'rst'
265
+ 'ridge': 'rdg'
266
+ 'ridges': 'rdgs'
267
+ 'river': 'riv'
268
+ 'rivr': 'riv'
269
+ 'rnchs': 'rnch'
270
+ 'road': 'rd'
271
+ 'roads': 'rds'
272
+ 'route': 'rte'
273
+ 'rvr': 'riv'
274
+ 'shoal': 'shl'
275
+ 'shoals': 'shls'
276
+ 'shoar': 'shr'
277
+ 'shoars': 'shrs'
278
+ 'shore': 'shr'
279
+ 'shores': 'shrs'
280
+ 'skyway': 'skwy'
281
+ 'spng': 'spg'
282
+ 'spngs': 'spgs'
283
+ 'spring': 'spg'
284
+ 'springs': 'spgs'
285
+ 'sprng': 'spg'
286
+ 'sprngs': 'spgs'
287
+ 'spurs': 'spur'
288
+ 'sqr': 'sq'
289
+ 'sqre': 'sq'
290
+ 'sqrs': 'sqs'
291
+ 'squ': 'sq'
292
+ 'square': 'sq'
293
+ 'squares': 'sqs'
294
+ 'station': 'sta'
295
+ 'statn': 'sta'
296
+ 'stn': 'sta'
297
+ 'str': 'st'
298
+ 'strav': 'stra'
299
+ 'strave': 'stra'
300
+ 'straven': 'stra'
301
+ 'stravenue': 'stra'
302
+ 'stravn': 'stra'
303
+ 'stream': 'strm'
304
+ 'street': 'st'
305
+ 'streets': 'sts'
306
+ 'streme': 'strm'
307
+ 'strt': 'st'
308
+ 'strvn': 'stra'
309
+ 'strvnue': 'stra'
310
+ 'sumit': 'smt'
311
+ 'sumitt': 'smt'
312
+ 'summit': 'smt'
313
+ 'terr': 'ter'
314
+ 'terrace': 'ter'
315
+ 'throughway': 'trwy'
316
+ 'tpk': 'tpke'
317
+ 'tr': 'trl'
318
+ 'trace': 'trce'
319
+ 'traces': 'trce'
320
+ 'track': 'trak'
321
+ 'tracks': 'trak'
322
+ 'trafficway': 'trfy'
323
+ 'trail': 'trl'
324
+ 'trails': 'trl'
325
+ 'trk': 'trak'
326
+ 'trks': 'trak'
327
+ 'trls': 'trl'
328
+ 'trnpk': 'tpke'
329
+ 'trpk': 'tpke'
330
+ 'tunel': 'tunl'
331
+ 'tunls': 'tunl'
332
+ 'tunnel': 'tunl'
333
+ 'tunnels': 'tunl'
334
+ 'tunnl': 'tunl'
335
+ 'turnpike': 'tpke'
336
+ 'turnpk': 'tpke'
337
+ 'underpass': 'upas'
338
+ 'union': 'un'
339
+ 'unions': 'uns'
340
+ 'valley': 'vly'
341
+ 'valleys': 'vlys'
342
+ 'vally': 'vly'
343
+ 'vdct': 'via'
344
+ 'viadct': 'via'
345
+ 'viaduct': 'via'
346
+ 'view': 'vw'
347
+ 'views': 'vws'
348
+ 'vill': 'vlg'
349
+ 'villag': 'vlg'
350
+ 'village': 'vlg'
351
+ 'villages': 'vlgs'
352
+ 'ville': 'vl'
353
+ 'villg': 'vlg'
354
+ 'villiage': 'vlg'
355
+ 'vist': 'vis'
356
+ 'vista': 'vis'
357
+ 'vlly': 'vly'
358
+ 'vst': 'vis'
359
+ 'vsta': 'vis'
360
+ 'walks': 'walk'
361
+ 'well': 'wl'
362
+ 'wells': 'wls'
363
+ 'wy': 'way'
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'digest' unless defined?(Digest)
4
+
5
+ module Lite
6
+ module Address
7
+ class Ukey
8
+
9
+ class << self
10
+
11
+ def generate(value)
12
+ result = value.downcase.gsub(/[^0-9a-z]/i, '')
13
+ Digest::MD5.hexdigest(result)
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lite
4
+ module Address
5
+
6
+ VERSION = '1.0.0'
7
+
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lite/address/version'
4
+ require 'lite/address/ukey'
5
+ require 'lite/address/list'
6
+ require 'lite/address/regexp'
7
+ require 'lite/address/format'
8
+ require 'lite/address/parser'
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'lite/address/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'lite-address'
9
+ spec.version = Lite::Address::VERSION
10
+ spec.authors = ['Juan Gomez']
11
+ spec.email = %w[j.gomez@drexed.com]
12
+
13
+ spec.summary = 'Parse and normalize street addresses'
14
+ spec.homepage = 'http://drexed.github.io/lite-address'
15
+ spec.license = 'MIT'
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata.merge(
21
+ 'allowed_push_host' => 'https://rubygems.org',
22
+ 'changelog_uri' => 'https://github.com/drexed/lite-address/blob/master/CHANGELOG.md',
23
+ 'homepage_uri' => spec.homepage,
24
+ 'source_code_uri' => 'https://github.com/drexed/lite-address'
25
+ )
26
+ else
27
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
28
+ 'public gem pushes.'
29
+ end
30
+
31
+ # Specify which files should be added to the gem when it is released.
32
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
33
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
34
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
35
+ end
36
+ spec.bindir = 'exe'
37
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
+ spec.require_paths = %w[lib]
39
+
40
+ spec.add_dependency 'countries'
41
+ spec.add_dependency 'snail'
42
+
43
+ spec.add_development_dependency 'bundler'
44
+ spec.add_development_dependency 'fasterer'
45
+ spec.add_development_dependency 'rake'
46
+ spec.add_development_dependency 'rspec'
47
+ spec.add_development_dependency 'rubocop'
48
+ spec.add_development_dependency 'rubocop-performance'
49
+ spec.add_development_dependency 'rubocop-rake'
50
+ spec.add_development_dependency 'rubocop-rspec'
51
+ end