{"id":22071767,"url":"https://github.com/mhutter/string-similarity","last_synced_at":"2025-04-07T05:13:14.933Z","repository":{"id":56896782,"uuid":"41887821","full_name":"mhutter/string-similarity","owner":"mhutter","description":"Calculate String Similarities","archived":false,"fork":false,"pushed_at":"2020-03-17T14:56:38.000Z","size":44,"stargazers_count":91,"open_issues_count":3,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T04:05:58.782Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mhutter.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":"2015-09-03T22:58:11.000Z","updated_at":"2024-12-20T16:17:49.000Z","dependencies_parsed_at":"2022-08-21T01:20:40.379Z","dependency_job_id":null,"html_url":"https://github.com/mhutter/string-similarity","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhutter%2Fstring-similarity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhutter%2Fstring-similarity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhutter%2Fstring-similarity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhutter%2Fstring-similarity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhutter","download_url":"https://codeload.github.com/mhutter/string-similarity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595335,"owners_count":20963943,"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-11-30T20:33:58.176Z","updated_at":"2025-04-07T05:13:14.908Z","avatar_url":"https://github.com/mhutter.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# String::Similarity\n\n[![Gem Version](https://badge.fury.io/rb/string-similarity.svg)](http://badge.fury.io/rb/string-similarity)\n[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://rubydoc.org/gems/string-similarity/frames)\n[![Build Status](https://travis-ci.org/mhutter/string-similarity.svg)](https://travis-ci.org/mhutter/string-similarity)\n[![Code Climate](https://codeclimate.com/github/mhutter/string-similarity/badges/gpa.svg)](https://codeclimate.com/github/mhutter/string-similarity)\n[![Test Coverage](https://codeclimate.com/github/mhutter/string-similarity/badges/coverage.svg)](https://codeclimate.com/github/mhutter/string-similarity/coverage)\n\nLibrary for calculating the similarity of two strings.\n\n## State\n\n- [x] Cosine\n- [ ] Hamming\n- [x] Levenshtein\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'string-similarity'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install string-similarity\n\n## Usage\n\n```ruby\nrequire 'string/similarity'\n\n# Call the methods on the module\nString::Similarity.cosine 'foo', 'bar'\n# =\u003e 0.0\nString::Similarity.cosine 'mine', 'thyne'\n# =\u003e 0.4472135954999579\nString::Similarity.cosine 'foo', 'foo'\n# =\u003e 1.0\n\n\n# Same for Levenshtein:\nString::Similarity.levenshtein_distance('kitten', 'sitting') # or ...\n# =\u003e 3\nString::Similarity.levenshtein('foo', 'far') # or ...\n# =\u003e 0.5\n```\n\nIf you want, you can use [Refinements](http://ruby-doc.org/core-2.3.0/doc/syntax/refinements_rdoc.html) to add the functionality to the `String` class:\n\n```ruby\nusing String::SimilarityRefinements\n\n'string'.cosine_similarity_to 'strong'\n# =\u003e 0.8333333333333335\n\n'kitten'.levenshtein_distance_to('sitting')\n# =\u003e 3\n\n'far'.levenshtein_similarity_to('foo')\n# =\u003e 0.5\n```\n\n(See this free [Ruby Tapas Episode](http://www.rubytapas.com/episodes/250-Refinements) if you don't know Refinements)\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\nThis Project uses [Semantic Versioning](http://semver.org/).\n\n## Contributing\n\n1. Fork it ( https://github.com/mhutter/string-similarity/fork )\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 a new Pull Request\n\n\nBug reports and pull requests are welcome on GitHub at https://github.com/mhutter/string-similarity.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhutter%2Fstring-similarity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhutter%2Fstring-similarity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhutter%2Fstring-similarity/lists"}