Sha256: 900c9b49a0ac5dc9eefbca6955eb0bc4c99106961b04a35ad0dbc5b8eaab3593

Contents?: true

Size: 684 Bytes

Versions: 3

Compression:

Stored size: 684 Bytes

Contents

# provide refinements for the String class
module String::SimilarityRefinements
  refine String do
    # Returns the cosine similarity to +other+
    # @see String::Similarity#cosine
    def cosine_similarity_to(other)
      String::Similarity.cosine(self, other)
    end

    # Returns the Levenshtein distance to +other+
    # @see String::Similarity.levenshtein_distance
    def levenshtein_distance_to(other)
      String::Similarity.levenshtein_distance(self, other)
    end

    # Returns the Levenshtein similarity to +other+
    # @see String::Similarity.levenshtein
    def levenshtein_similarity_to(other)
      String::Similarity.levenshtein(self, other)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
string-similarity-2.1.0 lib/string/similarity_refinements.rb
string-similarity-2.0.1 lib/string/similarity_refinements.rb
string-similarity-2.0.0 lib/string/similarity_refinements.rb