2 つの文字列の類似度を計算する Trigram という gem を作りました。
https://github.com/milk1000cc/trigram
Trigram.compare 'he is genius', 'he is genius' # => 1 Trigram.compare 'he is genius', 'he is very genius' # => 0.5625 Trigram.compare 'he is genius', 'she is cute' # => 0.26666666666666666 Trigram.compare 'he is genius', 'I can fly' # => 0
文字列を 3 文字ずつに分割して、重複率を出す感じです。
以下の記事を読んでもらうと、よくわかると思います。
livedoor Techブログ : String::Trigram でテキストの類似度を測る
最近は PONPON の作り直しをしていて、似ているクーポンをまとめる処理などで使っています。
acts_as_digested_on という gem も更新しているので、よかったらご利用ください。