rubylibpostal 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +80 -15
- data/lib/rubypostal/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d89bd77a96cfc81c18e51ebd222b36c612ca280d610b77f746951c1a3dc289d
|
4
|
+
data.tar.gz: 5a94ccf21bb54f5b501a946be8dcd7ebfaa3fcb7a1558dc95762a934080a473d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2ed6911692cfb79e53b94dcd1eb865b76e4cb2c0e480d1570e3a18da59e4643f0a36939ca7c0cf30d128f98878d831494279a986a918d8b5d6723dbada02bad
|
7
|
+
data.tar.gz: 406d8dce9a530f1861bb17957ea90b6824f01801c4a078b522e4a091cde31e061530131563a93a3d025b514361e648eb012e083449c1c87ba66ea681a37c9235
|
data/README.md
CHANGED
@@ -1,39 +1,104 @@
|
|
1
|
-
#
|
1
|
+
# rubypostal
|
2
2
|
|
3
|
-
|
3
|
+
`rubylibpostal` is a Ruby gem that provides seamless integration with the powerful [Libpostal](https://github.com/openvenues/libpostal) C library. It offers a clean and intuitive API for tasks related to address parsing and expansion.
|
4
4
|
|
5
|
-
|
5
|
+
## Features
|
6
|
+
|
7
|
+
- **Address Parsing:** Extracts components of an address, such as house number, road, city, state, etc.
|
8
|
+
- **Address Expansion:** Expands an address string into its possible variations (useful for normalizing addresses).
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
9
|
-
|
12
|
+
Ensure that you have [Libpostal](https://github.com/openvenues/libpostal) installed on your system. You can follow [Libpostal's installation guide](https://github.com/openvenues/libpostal#installation) to set it up.
|
13
|
+
|
14
|
+
Once Libpostal is installed, you can add this line to your Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'rubylibpostal'
|
18
|
+
```
|
10
19
|
|
11
|
-
|
20
|
+
And then execute:
|
12
21
|
|
13
|
-
|
22
|
+
```bash
|
23
|
+
$ bundle install
|
24
|
+
```
|
14
25
|
|
15
|
-
|
26
|
+
Alternatively, install the gem directly using:
|
16
27
|
|
17
|
-
|
28
|
+
```bash
|
29
|
+
$ gem install rubylibpostal
|
30
|
+
```
|
18
31
|
|
19
32
|
## Usage
|
20
33
|
|
21
|
-
|
34
|
+
### Address Parsing
|
35
|
+
|
36
|
+
To parse an address, simply call the `Rubypostal.parse_address` method:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
require 'rubypostal'
|
40
|
+
|
41
|
+
address = "781 Franklin Ave Crown Heights Brooklyn NYC NY 11216 USA"
|
42
|
+
parsed = rubylibpostal.parse_address(address)
|
43
|
+
|
44
|
+
puts parsed
|
45
|
+
# => {
|
46
|
+
# "house_number" => "781",
|
47
|
+
# "road" => "franklin ave",
|
48
|
+
# "suburb" => "crown heights",
|
49
|
+
# "city_district" => "brooklyn",
|
50
|
+
# "state" => "ny",
|
51
|
+
# "postcode" => "11216",
|
52
|
+
# "country" => "usa"
|
53
|
+
# }
|
54
|
+
```
|
55
|
+
|
56
|
+
### Address Expansion
|
57
|
+
|
58
|
+
To expand an address into its possible variations:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
require 'rubylibpostal'
|
62
|
+
|
63
|
+
address = "781 Franklin Ave, Brooklyn, NYC"
|
64
|
+
expanded = rubylibpostal.expand_address(address)
|
65
|
+
|
66
|
+
puts expanded
|
67
|
+
# => ["781 franklin avenue brooklyn new york city", "781 franklin avenue nyc"]
|
68
|
+
```
|
69
|
+
|
70
|
+
### Configuration
|
71
|
+
|
72
|
+
If you want to configure Libpostal initialization (e.g., deciding when `libpostal_setup` should run), you can set up custom configurations in your application as needed by modifying the gem's initialization block.
|
22
73
|
|
23
74
|
## Development
|
24
75
|
|
25
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
76
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `rake test` to run the tests.
|
77
|
+
|
78
|
+
To install this gem onto your local machine, run:
|
26
79
|
|
27
|
-
|
80
|
+
```bash
|
81
|
+
$ bundle exec rake install
|
82
|
+
```
|
83
|
+
|
84
|
+
To release a new version, update the version number in `lib/rubylibpostal/version.rb`, and then run:
|
85
|
+
|
86
|
+
```bash
|
87
|
+
$ bundle exec rake release
|
88
|
+
```
|
28
89
|
|
29
90
|
## Contributing
|
30
91
|
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
92
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/nijeesh4all/rubypostal](https://github.com/nijeesh4all/rubypostal). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/nijeesh4all/rubypostal/blob/main/CODE_OF_CONDUCT.md).
|
32
93
|
|
33
94
|
## License
|
34
95
|
|
35
|
-
The gem is available as open
|
96
|
+
The gem is available as open-source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
97
|
+
|
98
|
+
## Authors
|
99
|
+
|
100
|
+
- **Nijeesh Joshy** – nijeesh.k@rently.com
|
36
101
|
|
37
|
-
|
102
|
+
---
|
38
103
|
|
39
|
-
|
104
|
+
This README should provide a solid introduction for anyone using or contributing to your `rubylibpostal` gem.
|
data/lib/rubypostal/version.rb
CHANGED