No commit activity in last 3 years
No release in over 3 years
Levenshtein distance tool and Library. provide Levenshtein distance and did you mean keyword.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0
~> 3.1
~> 0.27
~> 0.9
~> 0.8
 Project Readme

DivergenceMeter

Gem Version Build Status Code Climate Test Coverage Inline docs

DivergenceMeter is Levenshtein distance(レーベンシュタイン距離) tool and Library.

algorithm : http://ja.wikipedia.org/wiki/%E3%83%AC%E3%83%BC%E3%83%99%E3%83%B3%E3%82%B7%E3%83%A5%E3%82%BF%E3%82%A4%E3%83%B3%E8%B7%9D%E9%9B%A2

Installation

Add this line to your application's Gemfile:

gem 'divergence_meter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install divergence_meter

Usage

use command line.

calculate Levenshtein distance.

$ divergence_meter retire tire
2
$ divergence_meter retire retare
1
$ divergence_meter retire hoge
5

did you mean?

retare is typo. tire retire hoge is dictionary words.

$ divergence_meter retare tire retire hoge
retare

use library

calculate Levenshtein distance.

require 'divergence_meter'

puts DivergenceMeter.distance('retire', 'tire')
# => 2

did you mean?

retare is typo. tire retire hoge is dictionary words.

require 'divergence_meter'

puts DivergenceMeter.did_you_mean('retare', %w(tire  retire hoge))
# => retire

Contributing

  1. Fork it ( https://github.com/[my-github-username]/divergence_meter/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request