perambulate 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CONTRIBUTING.md +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +41 -0
- data/README +36 -0
- data/Rakefile +0 -0
- data/lib/perambulate/address/address.rb +15 -0
- data/lib/perambulate/designations.rb +6 -0
- data/lib/perambulate/lexer/aussie_lexer.rb +12 -0
- data/lib/perambulate/parser/parser.rb +62 -0
- data/lib/perambulate/version.rb +3 -0
- data/lib/perambulate.rb +25 -0
- data/perambulate.gemspec +25 -0
- data/test/factories/address_factory.rb +5 -0
- data/test/spec/address_integration_spec.rb +36 -0
- data/test/spec/address_model_spec.rb +37 -0
- data/test/spec/aussie_lexer_spec.rb +76 -0
- data/test/spec/parser_spec.rb +92 -0
- data/test/spec/perambulate_spec.rb +47 -0
- data/test/spec/spec_helper.rb +2 -0
- data/test/test_helper.rb +3 -0
- metadata +162 -0
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Please include RSpec tests for contributions.
|
2
|
+
|
3
|
+
That's It?!
|
4
|
+
===========
|
5
|
+
|
6
|
+
Perambulate is only a baby project at the moment... As of this writing it doesn't even work yet. So putting up more
|
7
|
+
barriers to contribution would be like erecting a gate for a pile of scrap.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
perambulate (0.0.3)
|
5
|
+
lexr (~> 0.3.1)
|
6
|
+
rake (~> 0.9.2.2)
|
7
|
+
whittle (~> 0.0.8)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (3.2.9)
|
13
|
+
i18n (~> 0.6)
|
14
|
+
multi_json (~> 1.0)
|
15
|
+
diff-lcs (1.1.3)
|
16
|
+
factory_girl (4.1.0)
|
17
|
+
activesupport (>= 3.0.0)
|
18
|
+
i18n (0.6.1)
|
19
|
+
lexr (0.3.1)
|
20
|
+
minitest (3.3.0)
|
21
|
+
multi_json (1.3.7)
|
22
|
+
rake (0.9.2.2)
|
23
|
+
rspec (2.10.0)
|
24
|
+
rspec-core (~> 2.10.0)
|
25
|
+
rspec-expectations (~> 2.10.0)
|
26
|
+
rspec-mocks (~> 2.10.0)
|
27
|
+
rspec-core (2.10.1)
|
28
|
+
rspec-expectations (2.10.0)
|
29
|
+
diff-lcs (~> 1.1.3)
|
30
|
+
rspec-mocks (2.10.1)
|
31
|
+
whittle (0.0.8)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
java
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
factory_girl (~> 4.1.0)
|
39
|
+
minitest (~> 3.3.0)
|
40
|
+
perambulate!
|
41
|
+
rspec (~> 2.10.0)
|
data/README
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
Perambulate is a library for parsing addresses in natural language.
|
2
|
+
|
3
|
+
As Seen On TV(tm), Perambulate makes it easier for you to get customer addresses in a normal, conversational form.
|
4
|
+
No more thousands of input boxes, drop-downs and annoying conversational logic. Simply ask for their address
|
5
|
+
and run it through Perambulate.
|
6
|
+
|
7
|
+
Limitations
|
8
|
+
===========
|
9
|
+
Currently, this tool does nothing. It's still in very early stages and doesn't even have a concrete architecture yet.
|
10
|
+
|
11
|
+
You *CAN* expect constant breaking changes on Master.
|
12
|
+
|
13
|
+
The first iteration will not handle countries: To make things simpler, you need to know what country address grammar you're
|
14
|
+
attempting to parse before parsing it.
|
15
|
+
|
16
|
+
The first iteration is being done on Australian style addresses because that's what I'm familiar with. Sorry, Matz.
|
17
|
+
|
18
|
+
Goals
|
19
|
+
=====
|
20
|
+
|
21
|
+
I want Perambulate to be an address management toolkit for developers. Desired features are:
|
22
|
+
|
23
|
+
* Chunk any given address
|
24
|
+
* Offer a likilhood of any string being a specific set of address units
|
25
|
+
* Validate that any chunk is a member of a valid set (ie restrict 'suburb' to a defined set)
|
26
|
+
* Have a variety of address parsers to suit specific combinations of
|
27
|
+
|
28
|
+
Architecture
|
29
|
+
============
|
30
|
+
|
31
|
+
This section was last updated for version: 0.0.1
|
32
|
+
If this is not the latest version of the gem, this document is out of date. You're most welcome to correct everything below
|
33
|
+
this paragraph but please don't change the version without checking that the following is true. I don't want to lie to
|
34
|
+
other developers ;)
|
35
|
+
|
36
|
+
Perambulate is the library module where all user interaction functions live, including configuration.
|
data/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Perambulate
|
2
|
+
class Address
|
3
|
+
attr_accessor :street_number, :street_name, :suburb, :designation, :postcode, :state
|
4
|
+
|
5
|
+
def initialize(options = {})
|
6
|
+
@street_number = options[:street_number]
|
7
|
+
@street_name = options[:street_name]
|
8
|
+
@designation = options[:designation]
|
9
|
+
@suburb = options[:suburb]
|
10
|
+
@postcode = options[:postcode]
|
11
|
+
@state = options[:state]
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require "whittle"
|
2
|
+
|
3
|
+
module Perambulate
|
4
|
+
class Parser < Whittle::Parser
|
5
|
+
|
6
|
+
# Terminal Symbols -- ORDER MATTERS
|
7
|
+
rule(:wsp => /\s+/).skip!
|
8
|
+
rule(:number => /\d+/)
|
9
|
+
rule(:unit_symbol => /Unit|Num|Number|No/i)
|
10
|
+
rule(:unit_separator => /\/|-|,/)
|
11
|
+
rule(:street_separator => /,/)
|
12
|
+
rule(:designation => /Street/)
|
13
|
+
|
14
|
+
rule(:word => /[a-zA-Z]+/)
|
15
|
+
|
16
|
+
rule(:unit_prefix) do |r|
|
17
|
+
r[]
|
18
|
+
r[:unit_symbol]
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
rule(:unit_number) do |r|
|
23
|
+
r[:unit_prefix, :number, :unit_separator].as {|_, b, _| b}
|
24
|
+
r[:number, :unit_separator].as {|a, _| a}
|
25
|
+
end
|
26
|
+
|
27
|
+
rule(:street_number_block) do |r|
|
28
|
+
r[:unit_number, :number].as {|a,b| {:unit_number => a, :street_number => b}}
|
29
|
+
r[:number].as {|a| {:street_number => a}}
|
30
|
+
end
|
31
|
+
|
32
|
+
rule(:name) do |r|
|
33
|
+
r[:name, :word].as {|a,b| "#{a} #{b}"}
|
34
|
+
r[:word]
|
35
|
+
end
|
36
|
+
|
37
|
+
rule(:street_specification) do |r|
|
38
|
+
r[:name, :designation].as {|a,b| {:street_name => a, :designation => b}}
|
39
|
+
end
|
40
|
+
|
41
|
+
rule(:street_block) do |r|
|
42
|
+
r[:street_number_block, :street_specification].as {|a,b| a.merge(b)}
|
43
|
+
r[:street_specification]
|
44
|
+
end
|
45
|
+
|
46
|
+
rule(:addr) do |r|
|
47
|
+
r[:street_block, :optional_suburb_separator, :name].as {|a,_,b| a.merge({:suburb => b})}
|
48
|
+
r[:street_block, :name].as {|a,b| a.merge({:suburb => b})}
|
49
|
+
r[:street_block]
|
50
|
+
r[:name].as {|a| {:suburb => a}}
|
51
|
+
end
|
52
|
+
|
53
|
+
rule(:optional_suburb_separator) do |r|
|
54
|
+
r[:street_separator]
|
55
|
+
r[:unit_separator]
|
56
|
+
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
start(:addr)
|
61
|
+
end
|
62
|
+
end
|
data/lib/perambulate.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Require ALL THE THINGS
|
2
|
+
require "perambulate/address/address"
|
3
|
+
require "perambulate/lexer/aussie_lexer"
|
4
|
+
require "perambulate/parser/parser"
|
5
|
+
require "perambulate/designations"
|
6
|
+
|
7
|
+
|
8
|
+
module Perambulate
|
9
|
+
|
10
|
+
@@configuration = {:default_parser => "Australian"}
|
11
|
+
|
12
|
+
def self.config
|
13
|
+
return @@configuration
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.configure(&block)
|
17
|
+
yield @@configuration
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.create_address(address_string)
|
21
|
+
lexemes = AussieLexer.new(address_string)
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
data/perambulate.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "perambulate/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'perambulate'
|
6
|
+
spec.version = Perambulate::VERSION
|
7
|
+
spec.date = '2012-11-28'
|
8
|
+
spec.summary = "Take addresses as a string. Get back useful details."
|
9
|
+
spec.description = "Perambulate is an address parsing library for natural language addresses. It provides a broken-down
|
10
|
+
version of a passed address, allowing you to get one input value and do useful things on the chunks."
|
11
|
+
spec.authors = ["Dylan Lacey"]
|
12
|
+
spec.email = 'perambulate@dylanlacey.com'
|
13
|
+
spec.files = `git ls-files`.split("\n")
|
14
|
+
spec.homepage = "http://www.github.com/dylanlacey/Perambulate"
|
15
|
+
|
16
|
+
|
17
|
+
spec.add_runtime_dependency "lexr", '~> 0.3.1'
|
18
|
+
spec.add_runtime_dependency "rake", '~> 0.9.2.2'
|
19
|
+
spec.add_runtime_dependency "whittle", '~> 0.0.8'
|
20
|
+
|
21
|
+
spec.add_development_dependency "minitest", '~> 3.3.0'
|
22
|
+
spec.add_development_dependency "rspec", '~> 2.10.0'
|
23
|
+
spec.add_development_dependency "factory_girl", '~> 4.1.0'
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "rspec"
|
2
|
+
require "lib/perambulate"
|
3
|
+
require "factory_girl"
|
4
|
+
|
5
|
+
FactoryGirl.find_definitions
|
6
|
+
|
7
|
+
describe "Address Parsing Interface" do
|
8
|
+
|
9
|
+
describe "Given Australian addresses" do
|
10
|
+
it "Should deal with a compact Australia address" do
|
11
|
+
test_address = "75 Boston Avenue, Coorparoo QLD"
|
12
|
+
|
13
|
+
expected = FactoryGirl.build(:address, :street_number => "75",
|
14
|
+
:street_name => "Boston",
|
15
|
+
:designation => Perambulate::Designations::AVENUE,
|
16
|
+
:suburb => "Coorparoo",
|
17
|
+
:state => "Queensland"
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "Should deal with an expanded Australian address" do
|
22
|
+
test_address = "75 Boston Avenue, Coorparoo Queensland"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "Should deal with a unit number compact Australiam address" do
|
26
|
+
test_address = "Unit 1, 75 Boston Avenue, Coorparoo QLD"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "Should deal with a post code" do
|
30
|
+
test_address = "73 Boston Avenue, Coorparoo QLD 4234"
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "rspec"
|
2
|
+
require "lib/perambulate"
|
3
|
+
|
4
|
+
describe "A new address" do
|
5
|
+
describe "Passed an options hash" do
|
6
|
+
let(:address) {Perambulate::Address.new( :street_number => "75",
|
7
|
+
:street_name=>"Boston",
|
8
|
+
:designation => Perambulate::Designations::AVENUE,
|
9
|
+
:suburb => "Coorparoo",
|
10
|
+
:postcode => "4104",
|
11
|
+
:state => "QLD"
|
12
|
+
)}
|
13
|
+
|
14
|
+
it "should have instantiated with its values set" do
|
15
|
+
address.street_number.should == "75"
|
16
|
+
address.street_name.should == "Boston"
|
17
|
+
address.designation.should == Perambulate::Designations::AVENUE
|
18
|
+
address.suburb.should == "Coorparoo"
|
19
|
+
address.postcode.should == "4104"
|
20
|
+
address.state.should == "QLD"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "Not passed an options hash" do
|
26
|
+
let (:address) {Perambulate::Address.new()}
|
27
|
+
|
28
|
+
it "should have nils for all options" do
|
29
|
+
address.street_number.should be_nil
|
30
|
+
address.street_name.should be_nil
|
31
|
+
address.designation.should be_nil
|
32
|
+
address.suburb.should be_nil
|
33
|
+
address.postcode.should be_nil
|
34
|
+
address.state.should be_nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require "test/spec/spec_helper"
|
2
|
+
|
3
|
+
describe "AussieLexer" do
|
4
|
+
|
5
|
+
context "Single Words" do
|
6
|
+
|
7
|
+
it "should return separator" do
|
8
|
+
parsed = Perambulate::AussieLexer.new(",").next
|
9
|
+
|
10
|
+
parsed.type.should eql :separator
|
11
|
+
parsed.value.should eql ","
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return separator" do
|
15
|
+
parsed = Perambulate::AussieLexer.new("-").next
|
16
|
+
|
17
|
+
parsed.type.should eql :separator
|
18
|
+
parsed.value.should eql "-"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return separator" do
|
22
|
+
parsed = Perambulate::AussieLexer.new("/").next
|
23
|
+
|
24
|
+
parsed.type.should eql :separator
|
25
|
+
parsed.value.should eql "/"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "Normal Street Address" do
|
30
|
+
let(:lexer) {Perambulate::AussieLexer.new("775 London Road Chandler")}
|
31
|
+
|
32
|
+
it "should return four components" do
|
33
|
+
number = lexer.next
|
34
|
+
number.type.should eql :number
|
35
|
+
number.value.should eql "775"
|
36
|
+
|
37
|
+
street = lexer.next
|
38
|
+
street.type.should eql :place_word
|
39
|
+
street.value.should eql "London"
|
40
|
+
|
41
|
+
designation = lexer.next
|
42
|
+
designation.type.should eql :designation
|
43
|
+
designation.value.should eql "Road"
|
44
|
+
|
45
|
+
suburb = lexer.next
|
46
|
+
suburb.type.should eql :place_word
|
47
|
+
suburb.value.should eql "Chandler"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "Separated Street Address" do
|
52
|
+
let (:lexer) {Perambulate::AussieLexer.new("775 London Road, Chandler")}
|
53
|
+
|
54
|
+
it "should return all components" do
|
55
|
+
expected_results = [
|
56
|
+
[:number, "775"],
|
57
|
+
[:place_word, "London"],
|
58
|
+
[:designation, "Road"],
|
59
|
+
[:separator, ","],
|
60
|
+
[:place_word, "Chandler"]
|
61
|
+
]
|
62
|
+
expected_iterator = expected_results.each
|
63
|
+
actual = lexer.next
|
64
|
+
|
65
|
+
until lexer.end?
|
66
|
+
result = expected_iterator.next
|
67
|
+
|
68
|
+
puts "Actual: #{actual} expected #{result}"
|
69
|
+
actual.type.should eql result[0]
|
70
|
+
actual.value.should eql result[1]
|
71
|
+
|
72
|
+
actual = lexer.next
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require "test/spec/spec_helper"
|
2
|
+
|
3
|
+
describe "Parser" do
|
4
|
+
context "When short-circuited with single terminals" do
|
5
|
+
let(:parser){Perambulate::Parser.new()}
|
6
|
+
it "should return a digit for street number" do
|
7
|
+
parser.parse("48", :rule => :street_number_block).should eql({:street_number => "48"})
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return street for Zigzag" do
|
12
|
+
parser.parse("Zigzag", :rule => :name).should eql "Zigzag"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should not return anything" do
|
16
|
+
parser.parse("48a", :rule => :street_number_block).should raise_exception (Whittle::ParseError)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should correctly parse a designation" do
|
20
|
+
parser.parse("Street", :rule => :designation).should eql "Street"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "When short-circuited with street names" do
|
25
|
+
let(:parser){Perambulate::Parser.new()}
|
26
|
+
|
27
|
+
it "should return a hash with the name and number" do
|
28
|
+
parser.parse("48 Zigzag Street", :rule=>:street_block).should eql({:street_number => "48", :street_name => "Zigzag", :designation => "Street"})
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "When given unit numbers" do
|
33
|
+
let(:parser){Perambulate::Parser.new()}
|
34
|
+
|
35
|
+
it "should return a unit and street number for slashes" do
|
36
|
+
parser.parse("1/65", :rule => :street_number_block).should eql({:unit_number => "1", :street_number => "65"})
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should return a unit and street number for dashes" do
|
40
|
+
parser.parse("1-65", :rule => :street_number_block).should eql({:unit_number => "1", :street_number => "65"})
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should return a unit and street number for commas" do
|
44
|
+
parser.parse("1,65", :rule => :street_number_block).should eql({:unit_number => "1", :street_number => "65"})
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should return a unit and street number when surrounded by spaces" do
|
48
|
+
parser.parse("1 / 65", :rule => :street_number_block).should eql({:unit_number => "1", :street_number => "65"})
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should return a unit and street number when preceeded by unit" do
|
52
|
+
parser.parse("Unit 5 / 65", :rule => :street_number_block).should eql({:unit_number => "5", :street_number => "65"})
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
context "Parsing completely" do
|
57
|
+
let(:parser){Perambulate::Parser.new()}
|
58
|
+
|
59
|
+
it "should return a hash with just street details" do
|
60
|
+
parser.parse("Zigzag Street").should eql({:street_name => "Zigzag", :designation => "Street"})
|
61
|
+
end
|
62
|
+
|
63
|
+
its "should return a hash with just number, street details" do
|
64
|
+
parser.parse("48 Zigzag Street").should eql({:street_number => "48", :street_name => "Zigzag", :designation => "Street"})
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should return a hash with just a suburb" do
|
68
|
+
parser.parse("Red Hill").should eql({:suburb => "Red Hill"})
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should return a hash with street name and suburb" do
|
72
|
+
parser.parse("Zigzag Street, Red Hill").should eql({:street_name => "Zigzag", :designation => "Street", :suburb => "Red Hill"})
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should return a hash with street name and suburb without a comma" do
|
76
|
+
parser.parse("Zigzag Street Red Hill").should eql({:street_name => "Zigzag", :designation => "Street", :suburb => "Red Hill"})
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should return a hash with everything" do
|
80
|
+
parser.parse("48 Zigzag Street, Red Hill").should eql({:street_number => "48", :street_name => "Zigzag", :designation => "Street", :suburb=>"Red Hill"})
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should return a unit number for a street address" do
|
84
|
+
parser.parse("1/48 Zigzag Street, Red Hill").should eql({:unit_number => "1", :street_number=>"48", :street_name => "Zigzag", :designation=>"Street", :suburb=>"Red Hill"})
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should return a unit number for a street address starting with unit" do
|
88
|
+
parser.parse("Unit 1/48 Zigzag Street, Red Hill").should eql({:unit_number => "1", :street_number=>"48", :street_name => "Zigzag", :designation=>"Street", :suburb=>"Red Hill"})
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "test/spec/spec_helper"
|
2
|
+
|
3
|
+
describe "Perambulate" do
|
4
|
+
describe "As newly included" do
|
5
|
+
it "should have 'Australian' as the default parsing strategy" do
|
6
|
+
Perambulate.config[:default_parser].should eq "Australian"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should have a Config hash" do
|
11
|
+
Perambulate.config.class.to_s.should == "Hash"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should take a Config block" do
|
15
|
+
lambda {
|
16
|
+
Perambulate.configure do |config|
|
17
|
+
|
18
|
+
end
|
19
|
+
}.should_not raise_error
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "with a custom configuration" do
|
23
|
+
before(:each) do
|
24
|
+
Perambulate.configure do |config|
|
25
|
+
config[:default_parser] = "Finnish"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should persist configuration values" do
|
30
|
+
Perambulate.config[:default_parser].should eq "Finnish"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe ".create_address" do
|
35
|
+
|
36
|
+
context "Given a standard Australian Address with no postcode" do
|
37
|
+
let(:address) {Perambulate.create_address("75 London Road, Chandler")}
|
38
|
+
|
39
|
+
it "parses a street name, designation and suburb" do
|
40
|
+
address.street_name.should eql "London"
|
41
|
+
address.street_number.should eql "75"
|
42
|
+
address.designation.should eql "Road"
|
43
|
+
address.suburb.should eql "Chandler"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: perambulate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dylan Lacey
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: lexr
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.3.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.3.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.9.2.2
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.9.2.2
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: whittle
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.0.8
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.8
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: minitest
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 3.3.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 3.3.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.10.0
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.10.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: factory_girl
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 4.1.0
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 4.1.0
|
110
|
+
description: ! "Perambulate is an address parsing library for natural language addresses.
|
111
|
+
\ It provides a broken-down\n version of a passed address,
|
112
|
+
allowing you to get one input value and do useful things on the chunks."
|
113
|
+
email: perambulate@dylanlacey.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- CONTRIBUTING.md
|
119
|
+
- Gemfile
|
120
|
+
- Gemfile.lock
|
121
|
+
- README
|
122
|
+
- Rakefile
|
123
|
+
- lib/perambulate.rb
|
124
|
+
- lib/perambulate/address/address.rb
|
125
|
+
- lib/perambulate/designations.rb
|
126
|
+
- lib/perambulate/lexer/aussie_lexer.rb
|
127
|
+
- lib/perambulate/parser/parser.rb
|
128
|
+
- lib/perambulate/version.rb
|
129
|
+
- perambulate.gemspec
|
130
|
+
- test/factories/address_factory.rb
|
131
|
+
- test/spec/address_integration_spec.rb
|
132
|
+
- test/spec/address_model_spec.rb
|
133
|
+
- test/spec/aussie_lexer_spec.rb
|
134
|
+
- test/spec/parser_spec.rb
|
135
|
+
- test/spec/perambulate_spec.rb
|
136
|
+
- test/spec/spec_helper.rb
|
137
|
+
- test/test_helper.rb
|
138
|
+
homepage: http://www.github.com/dylanlacey/Perambulate
|
139
|
+
licenses: []
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options: []
|
142
|
+
require_paths:
|
143
|
+
- lib
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ! '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 1.8.24
|
159
|
+
signing_key:
|
160
|
+
specification_version: 3
|
161
|
+
summary: Take addresses as a string. Get back useful details.
|
162
|
+
test_files: []
|