Sha256: f2a6154b61ddd9a6685a797a505d1a838df898dcc440df7504dd08dfa9348a96

Contents?: true

Size: 583 Bytes

Versions: 1

Compression:

Stored size: 583 Bytes

Contents

module Picky

  # 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.intern unless codes.empty?
        end

      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picky-3.5.0 lib/picky/generators/similarity/double_metaphone.rb