tonytonyjan / jaro_winkler

Ruby & C implementation of Jaro-Winkler distance algorithm which supports UTF-8 string.
MIT License
195 stars 29 forks source link

Distance works but not similarity #57

Open shideneyu opened 6 months ago

shideneyu commented 6 months ago
➜  ~ gem install jaro_winkler

irbBuilding native extensions. This could take a while...
Successfully installed jaro_winkler-1.5.6
Parsing documentation for jaro_winkler-1.5.6
Done installing documentation for jaro_winkler after 0 seconds
1 gem installed
➜  ~ irb
irb(main):001> require 'jaro_winkler'
true
irb(main):002> 
irb(main):003> JaroWinkler.similarity "MARTHA", "MARHTA"
Traceback (most recent call last):
    17: from /home/sidney/.rbenv/versions/2.7.3/bin/irb:23:in `<main>'
    16: from /home/sidney/.rbenv/versions/2.7.3/bin/irb:23:in `load'
    15: from /home/sidney/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/irb-1.10.0/exe/irb:9:in `<top (required)>'
(irb):3:in `<main>': undefined method `similarity' for JaroWinkler:Module (NoMethodError)
irb(main):004> 
irb(main):005> JaroWinkler.jaro_similarity "MARTHA", "MARHTA"
Traceback (most recent call last):
    17: from /home/sidney/.rbenv/versions/2.7.3/bin/irb:23:in `<main>'
    16: from /home/sidney/.rbenv/versions/2.7.3/bin/irb:23:in `load'
    15: from /home/sidney/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/irb-1.10.0/exe/irb:9:in `<top (required)>'
(irb):5:in `<main>': undefined method `jaro_similarity' for JaroWinkler:Module (NoMethodError)
irb(main):006> JaroWinkler.jaro_distance "MARTHA", "MARHTA"
0.9444444444444445

Anything I did wrong ? Thank you

tonytonyjan commented 6 months ago

hi @shideneyu

Sorry, I changed the README but forgot to push the v1.6.0 to rubygems.org.

λ gem install jaro_winkler
Fetching jaro_winkler-1.6.0.gem
Building native extensions. This could take a while...
Successfully installed jaro_winkler-1.6.0
1 gem installed
λ ruby -r jaro_winkler -e 'puts JaroWinkler.similarity "MARTHA", "MARHTA"'
0.9611111111111111

Thanks for the reporting. Can you retry with the version 1.6.0 and let me know if you have any issue? Thanks!