Project

rubyfish

0.03
No commit activity in last 3 years
No release in over 3 years
Port of http://github.com/sunlightlabs/jellyfish
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

RubyFish

RubyFish is a ruby port of python library jellyfish for doing approximate and phonetic matching of strings.


RubyFish is a project of AnjLab (c) 2010. All code is released under a BSD-style license, see LICENSE for details.

Originally written by Michael Stephens and James Turk.

Ported by Yury Korolev Source is available on GitHub

Included Algorithms

String comparison:

  • Levenshtein Distance
  • Damerau-Levenshtein Distance
  • Jaro Distance
  • Jaro-Winkler Distance
  • Hamming Distance
  • Longest Substring
  • Longest Subsequence

Phonetic encoding:

  • Double Metaphone

Example Usage

ruby-1.9.2-p0 > require 'rubyfish'
ruby-1.9.2-p0 > RubyFish::Levenshtein.distance("jellyfish", "rubyfish")
=> 4
ruby-1.9.2-p0 > RubyFish::Jaro.distance("jellyfish", "rubyfish")
=> 0.7268518518518519
ruby-1.9.2-p0 > RubyFish::DamerauLevenshtein.distance("rubyfish", "rubyfihs")
=> 1

ruby-1.9.2-p0 > RubyFish::DoubleMetaphone.phonetic_code "prived"
 => ["PRFT", nil] 
ruby-1.9.2-p0 > RubyFish::DoubleMetaphone.phonetic_code "privet"
 => ["PRFT", nil]