improve string distance documentation

This commit is contained in:
2026-01-10 15:12:36 +01:00
parent 54972c36b6
commit 87e6e65809

View File

@@ -3,7 +3,13 @@ package com.infendro.cli.util
internal const val threshold = 2
/**
* Damerau-Levenshtein string distance
* Calculates the Damerau-Levenshtein distance between two strings.
*
* The distance is the minimum number of operations (insertion, deletion, substitution, and transposition) required to transform one string into another.
*
* @param a The source string.
* @param b The target string.
* @return The minimum number of operations to transform [a] into [b].
*/
internal fun distance(a: String, b: String): Int {
if (a == b) return 0