Sha256: 1c5486714e876ee3178360f8aeeb2352e5f7c00490b166cb8616a6738ebe057d
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
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 # rubocop:disable Style/OptionalBooleanParameter def self.distance(str1, str2, verbose = false) return if str1.nil? || str2.nil? internal_phonetic_distance(str1, str2, verbose) end # rubocop:enable Style/OptionalBooleanParameter end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
phonetics-3.2.0 | lib/phonetics/levenshtein.rb |
phonetics-3.0.9 | lib/phonetics/levenshtein.rb |
phonetics-3.0.8 | lib/phonetics/levenshtein.rb |