{"id":16925657,"url":"https://github.com/colinsurprenant/hotwater","last_synced_at":"2025-03-17T07:31:42.248Z","repository":{"id":7110726,"uuid":"8403983","full_name":"colinsurprenant/hotwater","owner":"colinsurprenant","description":"Fast Ruby FFI string edit distance algorithms","archived":false,"fork":false,"pushed_at":"2013-02-26T05:46:37.000Z","size":141,"stargazers_count":80,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-27T19:58:39.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/colinsurprenant.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-25T06:55:38.000Z","updated_at":"2024-12-05T11:58:49.000Z","dependencies_parsed_at":"2022-08-20T22:00:47.432Z","dependency_job_id":null,"html_url":"https://github.com/colinsurprenant/hotwater","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinsurprenant%2Fhotwater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinsurprenant%2Fhotwater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinsurprenant%2Fhotwater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinsurprenant%2Fhotwater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colinsurprenant","download_url":"https://codeload.github.com/colinsurprenant/hotwater/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852428,"owners_count":20358267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T20:11:18.403Z","updated_at":"2025-03-17T07:31:41.870Z","avatar_url":"https://github.com/colinsurprenant.png","language":"Ruby","funding_links":[],"categories":["NLP Pipeline Subtasks"],"sub_categories":["Semantic Analysis"],"readme":"# Hotwater v0.1.2\n\n[![build status](https://secure.travis-ci.org/colinsurprenant/hotwater.png)](http://travis-ci.org/colinsurprenant/hotwater)\n\nRuby \u0026 JRuby gem with fast **string edit distance** algorithms C implementations with FFI bindings.\n\n### Algorithms\n\n- [Levenshtein](https://en.wikipedia.org/wiki/Levenshtein_distance) \u0026 [Damerau Levenshtein](https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance) distance\n- [Jaro \u0026 Jaro-Winkler](https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance) distance\n- [N-Gram](https://en.wikipedia.org/wiki/N-gram) distance\n\n## Installation\n\nTested on **OSX 10.8.2** and **Linux 12.10** with\n- MRI Ruby 1.9.3 p385\n- JRuby 1.7.2 (1.9.3 p327)\n\nAdd this line to your application's Gemfile:\n```ruby\ngem 'hotwater'\n```\nAnd then execute:\n```sh\n$ bundle\n```\nOr install it yourself as:\n```sh\n$ gem install hotwater\n```\n\n## Usage\n\n```ruby\nHotwater.levenshtein_distance(\"abc\", \"acb\") # =\u003e 2\nHotwater.damerau_levenshtein_distance(\"abc\", \"acb\") # =\u003e 1\n\n# normalization based on the string sizes\n# where an edit on a small string has more weight than on a longer string\nHotwater.normalized_levenshtein_distance(\"abc\", \"acb\").round(4) # =\u003e 0.3333\nHotwater.normalized_damerau_levenshtein_distance(\"abc\", \"acb\").round(4) # =\u003e 0.6667\n\nHotwater.jaro_distance(\"martha\", \"marhta\").round(4) # =\u003e 0.9444\nHotwater.jaro_winkler_distance(\"martha\", \"marhta\").round(4) # =\u003e 0.9611\n\n# default is bigram\nHotwater.ngram_distance(\"natural\", \"contrary\").round(4) # =\u003e 0.25\n\n# specify trigram\nHotwater.ngram_distance(\"natural\", \"contrary\", 3).round(4) # =\u003e 0.2083\n```\n\n## Developement\n\n1. Fort it\n2. Install gems `$ bundle install`\n3. Compile lib `$ rake compile`\n4. Run specs `$ rake spec`\n5. Clean compiler generated files `$ rake clean`\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## Credits\n\n- Some C code from the https://github.com/sunlightlabs/jellyfish project\n- N-Gram ported from Apache Lucene 4.0.0 NGramDistance.java \n\n## Why?\n\nWhy Hotwater? as stated in the credits section, some of the C code comes from the [jellyfish Python project](https://github.com/sunlightlabs/jellyfish). Jelly fish made me think right away about New Brunswick beaches where I have been a couple of times in the past years. There is this legend about New Brunswick having warm water beaches. I even saw a tourism promotion TV commercial selling NB as having warm water. This is a lie! :P I never experienced warm water (in the generaly accepted definition) in NB, only lots of jellyfish :D (that being said, I have enjoyed every bit of my visits in New Brunswick and I really do not care about warm water really ;)\n\n## Author\n\nColin Surprenant, [@colinsurprenant](http://twitter.com/colinsurprenant), [http://github.com/colinsurprenant](http://github.com/colinsurprenant), colin.surprenant@gmail.com\n\n## License\n\nHotwater is distributed under the Apache License, Version 2.0. \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinsurprenant%2Fhotwater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolinsurprenant%2Fhotwater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinsurprenant%2Fhotwater/lists"}