This is a fork of Junfeng Li (aka 'autozimu')'s StringMetric.swift
repo.
String metric functions implemented in Swift.
Currently, following functions are implemented,
similarity
: alias ofsimilarityJaroWinkler
similarityLevenshtein
: Levenshtein similaritysimilarityDamerauLevenshtein
: Damerau-Levenshtein similaritysimilarityHamming
: Hamming similaritysimilarityMostFreqK
: Most frequent k characterssimilarityNormalizedMostFrequentK
: Normalized most frequent k characterssimilarityJaroWinkler
: Jaro-Winkler similarity
For Swift Package Manager
users, add this module as dependency in Package.swift
:
.package(url: "https://github.com/sajjon/StringSimilarity", majorVersion: 0)
"kitten".similarity(with: "sitting") // => 0.746
"君子和而不同".similarity(with: "小人同而不和") // => 0.555