coderifous-address_extractor 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('address_extractor', '0.1.2') do |p|
5
+ Echoe.new('address_extractor', '0.1.3') do |p|
6
6
  p.description = "Give it text. It finds addresses in it."
7
7
  p.url = "http://github.com/coderifous/address_extractor"
8
8
  p.author = "Jim Garvin"
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{address_extractor}
3
- s.version = "0.1.2"
3
+ s.version = "0.1.3"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Jim Garvin"]
7
- s.date = %q{2008-11-16}
7
+ s.date = %q{2008-11-17}
8
8
  s.description = %q{Give it text. It finds addresses in it.}
9
9
  s.email = %q{jim at thegarvin dot com}
10
10
  s.extra_rdoc_files = ["lib/address_extractor.rb", "LICENSE.textile", "README.textile"]
@@ -154,7 +154,7 @@ class AddressExtractor
154
154
  \s+
155
155
  (?:[A-Za-z'.-]+\s?){0,2} (?:[A-Za-z'.-]+) # Followed by a street name
156
156
  )
157
- \s* ,? \s*
157
+ \s* ,? \s* # a comma, optionally
158
158
  (
159
159
  (?:\d+\s+)? # a secondary unit, optionally
160
160
  (?:#{SECONDARY_UNIT_DESIGNATORS_REGEX})
@@ -167,10 +167,10 @@ class AddressExtractor
167
167
  \s* ,? \s* # a comma, optionally
168
168
  \b(#{STATE_REGEX})\b # state
169
169
  \s* ,? \s* # a comma, optionally
170
- (\d{6})? # a zip code, optionally
170
+ (\d{5})? # a zip code, optionally
171
171
  )
172
172
  | # or, instead of city and state
173
- (\d{6})? # a lone zip code will do
173
+ (\d{5})? # a lone zip code will do
174
174
  )
175
175
  /xi
176
176
  end
@@ -61,20 +61,28 @@ test_input "
61
61
  via mail at:
62
62
  123 Goob Avenue
63
63
  Apt 123
64
- Nice Town CA 123456
65
- ",
64
+ Nice Town CA 12345",
66
65
  { :street1 => "123 Foo St.", :street2 => nil, :city => "Someplace", :state => "FL", :zip => nil },
67
- { :street1 => "123 Goob Avenue", :street2 => "Apt 123", :city => "Nice Town", :state => "CA", :zip => "123456" }
66
+ { :street1 => "123 Goob Avenue", :street2 => "Apt 123", :city => "Nice Town", :state => "CA", :zip => "12345" }
68
67
 
69
- test_input "Let's meet tomorrow at noon at 123 Foo Bar Street, Scooby NY 123456",
70
- { :street1 => "123 Foo Bar Street", :street2 => nil, :city => "Scooby", :state => "NY", :zip => "123456" }
68
+ test_input "Let's meet tomorrow at noon at 123 Foo Bar Street, Scooby NY 12345",
69
+ { :street1 => "123 Foo Bar Street", :street2 => nil, :city => "Scooby", :state => "NY", :zip => "12345" }
71
70
 
72
- test_input "Let's meet tomorrow at noon at 123 Foo Bar Street, Scooby, NY 123456",
73
- { :street1 => "123 Foo Bar Street", :street2 => nil, :city => "Scooby", :state => "NY", :zip => "123456" }
71
+ test_input "Let's meet tomorrow at noon at 123 Foo Bar Street, Scooby, NY 12345",
72
+ { :street1 => "123 Foo Bar Street", :street2 => nil, :city => "Scooby", :state => "NY", :zip => "12345" }
74
73
 
75
- test_input "Let's meet tomorrow at noon at 123 Foo Bar Street, Scooby, NY, 123456",
76
- { :street1 => "123 Foo Bar Street", :street2 => nil, :city => "Scooby", :state => "NY", :zip => "123456" }
74
+ test_input "Let's meet tomorrow at noon at 123 Foo Bar Street, Scooby, NY, 12345",
75
+ { :street1 => "123 Foo Bar Street", :street2 => nil, :city => "Scooby", :state => "NY", :zip => "12345" }
77
76
 
78
- test_input "Let's meet tomorrow at noon at 123 Foo Bar Street, 123456",
79
- { :street1 => "123 Foo Bar Street", :street2 => nil, :city => nil, :state => nil, :zip => "123456" }
77
+ test_input "Let's meet tomorrow at noon at 123 Foo Bar Street, 12345",
78
+ { :street1 => "123 Foo Bar Street", :street2 => nil, :city => nil, :state => nil, :zip => "12345" }
80
79
 
80
+ test_input "
81
+ Apple Computer, Inc.
82
+ 1 Infinite Loop
83
+ Cupertino, CA 95014",
84
+ { :street1 => "1 Infinite Loop", :street2 => nil, :city => "Cupertino", :state => "CA", :zip => "95014" }
85
+
86
+ test_input "Apple Computer, Inc. 1 Infinite Loop, Cupertino, CA 95014",
87
+ { :street1 => "1 Infinite Loop", :street2 => nil, :city => "Cupertino", :state => "CA", :zip => "95014" }
88
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coderifous-address_extractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Garvin
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-16 00:00:00 -08:00
12
+ date: 2008-11-17 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15