kiyoka / fuzzy-string-match Goto Github PK
View Code? Open in Web Editor NEWfuzzy string matching library for ruby
License: Apache License 2.0
fuzzy string matching library for ruby
License: Apache License 2.0
When installing this is what I get
~ $ rvm gemset create fuzzy
'fuzzy' gemset created (~/.rvm/gems/ruby-1.9.3-p0@fuzzy).
~ $ rvm gemset use fuzzy
Using ~/.rvm/gems/ruby-1.9.3-p0 with gemset fuzzy
~ $ gem install fuzzy-string-match
Fetching: ZenTest-4.7.0.gem (100%)
Fetching: RubyInline-3.11.2.gem (100%)
Fetching: fuzzy-string-match-0.9.3.gem (100%)
Successfully installed ZenTest-4.7.0
Successfully installed RubyInline-3.11.2
Successfully installed fuzzy-string-match-0.9.3
3 gems installed
~ $ irb
1.9.3p0 :001 > require 'fuzzy-string-match'
LoadError: cannot load such file -- fuzzy-string-match
from ~/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' from ~/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
require'
from (irb):1
from ~/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `
ZenTest 4.11.1 incompatiable with rubygems 3.0.1
But, ZenTest
4.11.2
is fixed
So, please update ZenTest
version to 4.11.2
Far from a C++ expert, but from what much smarter people tell me, using stack allocated memory like this isn't a great idea, especially with potentially untrusted user input.
For example if I run:
jarow = FuzzyStringMatch::JaroWinkler.create( :native )
jarow.getDistance("foo" * 1000000, "goo")
You'll likely crash the process (and that's just the start).
In my submission, this line is wrong. It should be 0.9667 instead of 0.9722.
I found this excellent gem! 💎
It seems like there are a few ruby gems for string matching:
Would it make sense to join forces? In other words, have several maintainers of one project.
String distance is a great functionality, but the API can be pretty static over time. So what's important is mostly to have several maintainers that can help each other with CI upgrades and similar.
ping @kiyoka @flori @dimus @tonytonyjan
I've opened issues in all three repos quoted above, with the same message
This doesn't seem to break anything, but it seemed a bit odd to be in a release...
ld: warning: directory not found for option '-L/Users/mpapis/.sm/pkg/active/lib'
From....
>> require 'fuzzystringmatch'
=> true
>> jarow = FuzzyStringMatch::JaroWinkler.create( :native )
ld: warning: directory not found for option '-L/Users/mpapis/.sm/pkg/active/lib'
=> #<FuzzyStringMatch::JaroWinklerInline:0x007f9e0c455e78>
>> p jarow.getDistance( "jones", "johnson" )
0.8323809523809523
=> 0.8323809523809523
This is with fuzzy-string-match 0.9.7
With this crash report:
/Users/gentz/.rvm/gems/ruby-1.9.3-p194@futuretap-backend/gems/RubyInline-3.11.2/lib/inline.rb:599:in `build': error executing "clang -dynamic -bundle -x c++ -lstdc++ -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -fno-common -pipe -L. -L/usr/local/lib -I /Users/gentz/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I /Users/gentz/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-darwin11.3.0 -I /Users/gentz/.rvm/rubies/ruby-1.9.3-p194/include -L/Users/gentz/.rvm/rubies/ruby-1.9.3-p194/lib -o \"/Users/gentz/.ruby_inline/ruby-1.9.1/Inline_FuzzyStringMatch__JaroWinklerInline_ba42422282336d6a540a3da727ca516f.bundle\" \"/Users/gentz/.ruby_inline/ruby-1.9.1/Inline_FuzzyStringMatch__JaroWinklerInline_ba42422282336d6a540a3da727ca516f.c\" 2> /dev/null": pid 57472 exit 1 (CompilationError)
Renamed /Users/gentz/.ruby_inline/ruby-1.9.1/Inline_FuzzyStringMatch__JaroWinklerInline_ba42422282336d6a540a3da727ca516f.c to /Users/gentz/.ruby_inline/ruby-1.9.1/Inline_FuzzyStringMatch__JaroWinklerInline_ba42422282336d6a540a3da727ca516f.c.bad
from /Users/gentz/.rvm/gems/ruby-1.9.3-p194@futuretap-backend/gems/RubyInline-3.11.2/lib/inline.rb:830:in `inline'
from /Users/gentz/.rvm/gems/ruby-1.9.3-p194@futuretap-backend/gems/fuzzy-string-match-0.9.3/lib/fuzzystringmatch/inline/jarowinkler.rb:25:in `<class:JaroWinklerInline>'
from /Users/gentz/.rvm/gems/ruby-1.9.3-p194@futuretap-backend/gems/fuzzy-string-match-0.9.3/lib/fuzzystringmatch/inline/jarowinkler.rb:20:in `<module:FuzzyStringMatch>'
from /Users/gentz/.rvm/gems/ruby-1.9.3-p194@futuretap-backend/gems/fuzzy-string-match-0.9.3/lib/fuzzystringmatch/inline/jarowinkler.rb:18:in `<top (required)>'
This is under Mac OS X 10.7.3 and ruby-1.9.3-p194. Under ruby-1.9.3-p125 everything works fine.
Hi,
It runs on my local dev machine and an dev ubuntu server, but on other machine (ubuntu too),
I've get this error:
1.9.2p290 :001 > require 'fuzzystringmatch'
=> true
1.9.2p290 :002 > jarow = FuzzyStringMatch::JaroWinkler.create(:native)
=> #FuzzyStringMatch::JaroWinklerInline:0x86a1028
1.9.2p290 :003 > jarow.getDistance("ad", "ad")
NoMethodError: undefined method getDistance' for #<FuzzyStringMatch::JaroWinklerInline:0x86a1028> from (irb):3 from /usr/local/rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in
pure is working.
It is a library which I need. But is it continue to be maintained ?
Your gem depends on rubyinline, and rubyinline's gem depends on zentest gem. Heroku can't bundle zentest because it requires a newer version of rake than what heroku supports. I'd love to use this gem, but can't since it doesn't work on heroku.
vagrant@ubuntu10:/vagrant$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
vagrant@ubuntu10:/vagrant$ sudo gem install fuzzy-string-match
ERROR: Error installing fuzzy-string-match:
fuzzy-string-match requires Ruby version >= 1.9.1.
When using the native version on Ruby 3.2 using a Mac with Apple Silicon, the following error is thrown:
[1] pry(main)> require "fuzzystringmatch"
=> true
[2] pry(main)> jarow = FuzzyStringMatch::JaroWinkler.create(:native)
# [Warnings from issue 24]
Undefined symbols for architecture arm64:
"_rb_cObject", referenced from:
_Init_Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695 in Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695-13a412.o
"_rb_const_get", referenced from:
_Init_Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695 in Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695-13a412.o
"_rb_define_method", referenced from:
_Init_Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695 in Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695-13a412.o
"_rb_float_new", referenced from:
getDistanceInternal(unsigned long, unsigned long, unsigned long) in Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695-13a412.o
"_rb_intern2", referenced from:
_Init_Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695 in Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695-13a412.o
"_rb_string_value_ptr", referenced from:
getDistanceInternal(unsigned long, unsigned long, unsigned long) in Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695-13a412.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
fuzzy-string-match Warning: fallback into pure version, because compile failed.
While the error references arm64, this error did not occur under Ruby 3.0.3 on Apple Silicon
When using the native version on Ruby 3.2, the following warning is thrown:
[1] pry(main)> require "fuzzystringmatch"
=> true
[2] pry(main)> jarow = FuzzyStringMatch::JaroWinkler.create(:native)
In file included from /Users/arice/.ruby_inline/ruby-3.2.0/Inline_FuzzyStringMatch__JaroWinklerInline_b28bdb41b9c5ed658e673cdd79216695.c:1:
In file included from /Users/arice/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h:38:
In file included from /Users/arice/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby/ruby.h:27:
In file included from /Users/arice/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby/internal/anyargs.h:83:
/Users/arice/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby/backward/cxxanyargs.hpp:540:6: warning: 'RUBY_API_VERSION_MAJOR' is not
defined, evaluates to 0 [-Wundef]
#if (RUBY_API_VERSION_MAJOR * 100 + RUBY_API_VERSION_MINOR) >= 301
^
/Users/arice/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby/backward/cxxanyargs.hpp:540:37: warning: 'RUBY_API_VERSION_MINOR' is
not defined, evaluates to 0 [-Wundef]
#if (RUBY_API_VERSION_MAJOR * 100 + RUBY_API_VERSION_MINOR) >= 301
^
2 warnings generated.
I'm trying to run the fuzzy-string-match gem on Heroku (i.e. using FuzzyStringMatch::JaroWinkler.create(:native)
), but getting this error:
2021-01-17T03:06:51.820943+00:00 app[web.1]: gcc: fatal error: cannot execute ‘cc1plus’: execvp: No such file or directory
2021-01-17T03:06:51.821010+00:00 app[web.1]: compilation terminated.
2021-01-17T03:06:51.822225+00:00 app[web.1]: fuzzy-string-match Warning: fallback into pure version, because compile failed.
I'm not running into this issue when running locally. Running with :pure
is not really an option since it's incredibly slow for what I'm doing. Has anyone been able to use :native on Heroku, and if so how?
We're running Delayed jobs using fuzzy-string-match and have been getting a bunch of these errors. It doesn't happen all the time, but more than seems "normal". We're running Rails 3.1.3 on Heroku Cedar stack.
Here is the stacktrace:
vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/core_ext/kernel/agnostics.rb:7:in ' vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/core_ext/kernel/agnostics.rb:7:in
'
vendor/bundle/ruby/1.9.1/gems/RubyInline-3.11.0/lib/inline.rb:590:in build' vendor/bundle/ruby/1.9.1/gems/RubyInline-3.11.0/lib/inline.rb:826:in
inline'
vendor/bundle/ruby/1.9.1/gems/fuzzy-string-match-0.9.1/lib/fuzzystringmatch.rb:112:in <class vendor/bundle/ruby/1.9.1/gems/fuzzy-string-match-0.9.1/lib/fuzzystringmatch.rb:111:in
<module
vendor/bundle/ruby/1.9.1/gems/fuzzy-string-match-0.9.1/lib/fuzzystringmatch.rb:18:in <top (required)>' vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in
require'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in block in require' vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:225:in
load_dependency'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
jarow = FuzzyStringMatch::JaroWinkler.create( :native )
cc1plus: warning: command line option '-Wdeclaration-after-statement' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wimplicit-function-declaration' is valid for C/ObjC but not for C++
=> #<FuzzyStringMatch::JaroWinklerInline:0x005611f1998618>
It seems to originate from https://github.com/kiyoka/fuzzy-string-match/blob/master/lib/fuzzystringmatch/inline/jarowinkler.rb#L44
gcc version 4.9.2 (Debian 4.9.2-10)
[5] pry(main)> p jarow.getDistance( "Egypt","Bosnia")
0.0
=> 0.0
Specs
uname -a
# Linux data 3.2.0-23-virtual #36-Ubuntu SMP Tue Apr 10 22:29:03 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/debian_version
# wheezy/sid
rvm -v
# rvm 1.19.1 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
ruby -v
# ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.