| Class | Text::WhiteSimilarity |
| In: |
lib/text/white_similarity.rb
|
| Parent: | Object |
Ruby implementation of the string similarity described by Simon White at: www.catalysoft.com/articles/StrikeAMatch.html
2 * |pairs(s1) INTERSECT pairs(s2)|
similarity(s1, s2) = -----------------------------------
|pairs(s1)| + |pairs(s2)|
e.g.
2 * |{FR, NC}|
similarity(FRANCE, FRENCH) = ---------------------------------------
|{FR,RA,AN,NC,CE}| + |{FR,RE,EN,NC,CH}|
= (2 * 2) / (5 + 5)
= 0.4
WhiteSimilarity.new.similarity("FRANCE", "FRENCH")