getLevenshteinDistance

open fun getLevenshteinDistance(s: String, t: String, maxAllowedEditDistance: Int): Int

Efficient version of Levenshtein Distance Algorithm. It saves CPU by returning early if the distance goes over maxAllowedEditDistance. See examples in LevenshteinDistanceTest class.

Return

min(LD(s, t), maxAllowedEditDistance + 1)

Parameters

s

String

t

String

maxAllowedEditDistance

int