kiyoka / fuzzy-string-match

fuzzy string matching library for ruby
Apache License 2.0
285 stars 39 forks source link

What is fuzzy-string-match

Build Status

The reason why i developed fuzzy-string-match

Installing

gem install fuzzy-string-match

Features

Sample code

Native version

require 'fuzzystringmatch'
jarow = FuzzyStringMatch::JaroWinkler.create( :native )
p jarow.getDistance(  "jones",      "johnson" )

Pure ruby version

require 'fuzzystringmatch'
jarow = FuzzyStringMatch::JaroWinkler.create( :pure )
p jarow.getDistance(  "jones",      "johnson" )
p jarow.getDistance(  "ああ",        "あい"        )

Sample on irb

irb(main):001:0> require 'fuzzystringmatch'
require 'fuzzystringmatch'
=> true

irb(main):002:0> jarow = FuzzyStringMatch::JaroWinkler.create( :native )
jarow = FuzzyStringMatch::JaroWinkler.create( :native )
=> #<FuzzyStringMatch::JaroWinklerNative:0x000001011b0010>

irb(main):003:0> jarow.getDistance( "al",        "al"        )
jarow.getDistance( "al",        "al"        )
=> 1.0

irb(main):004:0> jarow.getDistance( "dixon",     "dicksonx"  )
jarow.getDistance( "dixon",     "dicksonx"  )
=> 0.8133333333333332

Benchmarks

$ rake bench
ruby ./benchmark/vs_amatch.rb
 --- 
 --- Each match functions will be called 1Mega times. --- 
 --- 
[Amatch]
      user     system      total        real
  1.160000   0.050000   1.210000 (  1.218259)
[this Module (pure)]
      user     system      total        real
 39.940000   0.160000  40.100000 ( 40.542448)
[this Module (native)]
      user     system      total        real
  0.480000   0.000000   0.480000 (  0.484187)

Requires

for CRuby

for JRuby

Author

See also

License

ChangeLog

1.0.1 / Jun 25, 2017

1.0.0 / Mar 10, 2017

0.9.9 / Mar 9, 2017

0.9.8 / Mar 9, 2017

0.9.7 / Oct 15, 2014

0.9.6 / Dec 21, 2013

0.9.5 / Mar 26, 2013

0.9.4 / July 10, 2012

0.9.3 / Feb 27, 2012

0.9.2 / Feb 17, 2012

0.9.1 / Jul 30, 2011

0.9.0 / Oct 12, 2010