Sha256: 556779d95ac380f823251deff419585c66c609d665d0bbec42f7d4c9f41b2bbf

Contents?: true

Size: 557 Bytes

Versions: 4

Compression:

Stored size: 557 Bytes

Contents

module Picky

  # encoding: utf-8
  #
  module Generators

    module Similarity

      # It's actually a combination of metaphone
      # and Levenshtein.
      #
      # It uses the metaphone to get similar words
      # and ranks them using the levenshtein.
      #
      class Metaphone < Phonetic

        # Encodes the given string/symbol.
        #
        # Returns a symbol.
        #
        def encoded str_or_sym
          code = Text::Metaphone.metaphone str_or_sym.to_s
          code.intern if code
        end

      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
picky-3.5.4 lib/picky/generators/similarity/metaphone.rb
picky-3.5.3 lib/picky/generators/similarity/metaphone.rb
picky-3.5.2 lib/picky/generators/similarity/metaphone.rb
picky-3.5.1 lib/picky/generators/similarity/metaphone.rb