Sha256: 638868055b66fc450c40fe9cb24c151881ab6f2317d2d4cd38b6b474335c9b2c

Contents?: true

Size: 1.43 KB

Versions: 11

Compression:

Stored size: 1.43 KB

Contents

Vladlev
===========

An implementation of the levenshtein distance algorithm for ruby using FFI

## Installation

Add this line to your gemfile and then run `bundle` to install

    gem 'vladlev'

## Usage

Vladlev will calculate the levenshtein distance between two strings.  The levenshtein distance is the number of transforms necessary to transform one string to be idential to the other.  A transform is defined as an addition, deletion, or alteration of a single character in a string.

In order to calculate the distance

    Vladlev.distance("string1", "string2")
    >> 1

Vladlev also includes a 3 parameter version of the distance method.  The third parameter is "maximum distance", which tells Vladlev to stop calculation once the distance becomes greater than this parameter.

In order to use this optimization
  
    Vladlev.distance("string1234567890", "string1", 1)
    >> 16

    Vladlev.distance("string1234567890", "string1", 999)
    >> 9

When given a pair of strings such that the distance between the two strings is greater than the "maximum distance" paramter, Vladlev will return the length of the longest string rather than spend the effort of calculating the distance when you know that you are not interested in the result.

## Development

Vladlev uses rake-compiler for a build tool

    bundle exec rake compile

    bundle exec rake clean

For an agressive clean of compiled files, you can do this

    bundle exec rake clobber

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
vladlev-1.1.0-java README.md
vladlev-1.1.0 README.md
vladlev-1.0.4-java README.md
vladlev-1.0.4 README.md
vladlev-1.0.3 README.md
vladlev-1.0.3-java README.md
vladlev-1.0.2-java README.md
vladlev-1.0.2 README.md
vladlev-1.0.1 README.md
vladlev-1.0.1-java README.md
vladlev-1.0.0-java README.md