Skip to content

Instantly share code, notes, and snippets.

View SequentialDesign's full-sized avatar

Daniel Alejandro Tapia SequentialDesign

View GitHub Profile
@SequentialDesign
SequentialDesign / string_distance.rb
Last active September 19, 2025 20:32 — forked from hakunin/string_distance.rb
clean string_distance.rb with proper usage example
# String distance algorithms implementation
class StringDistance
# Calculates the Damerau-Levenshtein distance between two strings
# This includes insertion, deletion, substitution, and transposition operations
def self.damerau_levenshtein(str1, str2)
# Input validation
str1 = str1.to_s
str2 = str2.to_s
return str2.length if str1.empty?