Levenshtein in Ruby 1.9

In Ruby 1.8, I would use the gem ‘levenshtein’… well that doesn’t work in 1.9. So you need to install the gem ‘text’.

Then the call is as simple as:

Text::Levenshtein.distance('hello', 'hell')

Are you a Git user? Let me help you make project management with Git simple. Checkout Gitpilot.

Follow me on Twitter: @jprichardson

-JP

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.