tonytonyjan / jaro_winkler

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

Option to install only pure version? #46

Closed pintergreg closed 2 years ago

pintergreg commented 2 years ago

From time to time, I have difficulties with building the native extension in CI environments. In this use case, I don't really care the performance, so the pure version could be more than enough.

I know, that there is a fallback mechanism (#29) but that only counts after the installation, so is it possible to install only the pure version without building the native extensions?

tonytonyjan commented 2 years ago

Hi, @pintergreg. Thanks for reaching out.

is it possible to install only the pure version without building the native extensions?

No, it's not possible. This gem aims to provide a C extension of the algorithm for Ruby. The fallback should only be used when the built binary is somehow corrupt. (That's why it is called fallback)

Alternatively, I think you can download those files to your code base and add some comments to credit the source.

https://raw.githubusercontent.com/tonytonyjan/jaro_winkler/master/lib/jaro_winkler/jaro_winkler_pure.rb https://raw.githubusercontent.com/tonytonyjan/jaro_winkler/master/lib/jaro_winkler/adjusting_table.rb

Or you can use the built-in gem did_you_mean:

λ ruby -r did_you_mean -e 'puts DidYouMean::JaroWinkler.distance *ARGV' hello hell
0.96

Note that did_you_mean doesn't support adjusting table, you would need to implement by yourself.

pintergreg commented 2 years ago

@tonytonyjan Thanks for the detailed reply. I was thinking about using those ruby files diectly, but I wanted to make sure I don't need to do so.

Anyway, I managed to fix my CI pipeline, so this issue may be closed.

tonytonyjan commented 2 years ago

@pintergreg Glad to hear you solved the problem.:D Let me know if you need further help!