Sha256: fef1afa1370ec1b5f9a9437fdb13629003c2f42ed4eb58d0380b868ebf54ae81

Contents?: true

Size: 882 Bytes

Versions: 3

Compression:

Stored size: 882 Bytes

Contents

# frozen_string_literal: true

require_relative '../phonetics'
require_relative 'c_levenshtein'

# Using the Damerau version of the Levenshtein algorithm, with phonetic feature
# count used instead of a binary edit distance calculation
#
# This implementation was dually inspired by the damerau-levenshtein gem
# (https://github.com/GlobalNamesArchitecture/damerau-levenshtein/tree/master/ext/damerau_levenshtein).
# and "Using Phonologically Weighted Levenshtein Distances for the Prediction
# of Microscopic Intelligibility" by Lionel Fontan, Isabelle Ferrané, Jérôme
# Farinas, Julien Pinquier, Xavier Aumont, 2016
# https://hal.archives-ouvertes.fr/hal-01474904/document
module Phonetics
  module Levenshtein
    extend ::PhoneticsLevenshteinCBinding

    def self.distance(str1, str2, verbose = false)
      internal_phonetic_distance(str1, str2, verbose)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phonetics-3.0.3 lib/phonetics/levenshtein.rb
phonetics-3.0.2 lib/phonetics/levenshtein.rb
phonetics-3.0.1 lib/phonetics/levenshtein.rb