https://github.com/ledermann/address_parser
https://github.com/ledermann/address_parser
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/ledermann/address_parser
- Owner: ledermann
- License: mit
- Created: 2011-12-05T09:05:41.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2020-04-19T07:37:38.000Z (about 6 years ago)
- Last Synced: 2025-05-06T23:39:50.663Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 14.6 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# AddressParser
[](http://travis-ci.org/ledermann/address_parser)
Ruby gem for parsing a (multiline) string containing an address and identifying its parts with Regex. It's useful to copy & paste contact or address informations from unformatted source (e.g. a website) into your schema based database.
**Beware:** This project is in early alpha state and needs a lot of work to be useful. So far it's just a project started on a rainy weekend. I'm not sure about its future.
## Installation
Add this to your Gemfile:
gem 'address_parser', :git => 'git://github.com/ledermann/address_parser.git'
(not released to rubygems.org, yet)
## Usage
address = AddressParser::Address.new <<-EOT
Peter Meier
Marienburger Straße 29
50374 Erftstadt
Fon (02235) 123456
Fax (02235) 654321
Web www.peter-meier.de
E-Mail mail@peter-meier.de
EOT
address.parts.should == {
:first_name => 'Peter',
:last_name => 'Meier',
:street => 'Marienburger Straße 29',
:zip => '50374',
:city => 'Erftstadt',
:country => 'DE',
:phone => '(02235) 123456',
:fax => '(02235) 654321',
:web => 'www.peter-meier.de',
:email => 'mail@peter-meier.de'
}
A lot of variants are recognized
## Limitations
* It uses **no** databases (e.g. for first names or cities), so it can't be perfect
* It recognizes only german addresses (yet)
* It does not format any phone numbers. If you need this, look at additional Ruby gems like [Phony](https://github.com/floere/phony) or [Dialy](https://github.com/ledermann/dialy)
## Note on Patches/Pull Requests
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. No discussion. No tests, no game. We use rspec for testing.
* Commit, do not mess with rakefile, version, or history. If you want to have your own version, thats fine. But bump your version in a seperate commit that can be ignored when pulling.
* Send me a pull request. Bonus points for topic branches.
## References
There is a commercial alternative named [RecogniContact](http://address-parser.com) which is **much more** powerful - but closed source.
## Copyright
Copyright © 2011,2012 [Georg Ledermann](http://georg-ledermann.de). See LICENSE for details.