Sha256: 8fdf5d87adb4e8a01e50c03418ee1d160646a2d90dc78607c4db5a206b2abc2b

Contents?: true

Size: 520 Bytes

Versions: 2

Compression:

Stored size: 520 Bytes

Contents

# encoding: utf-8
#
module Generators

  module Similarity

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

      # Encodes the given symbol.
      #
      # Returns a symbol.
      #
      def encoded sym
        codes = Text::Metaphone.double_metaphone sym.to_s
        codes.first.to_sym unless codes.empty?
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
picky-2.7.0 lib/picky/generators/similarity/double_metaphone.rb
picky-2.6.0 lib/picky/generators/similarity/double_metaphone.rb