Ruby gem to analyze a multiline string containing a (german) mailing address and identify its parts
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1 commit behind ledermann:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
CHANGELOG.md
Gemfile
LICENSE
README.md
Rakefile
address_parser.gemspec

README.md

AddressParser

Build Status

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 or 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 which is much more powerful - but closed source.

Copyright

Copyright © 2011,2012 Georg Ledermann. See LICENSE for details.