caffeine_lang/string_distance

Values

pub fn closest_match(
  target: String,
  candidates: List(String),
) -> option.Option(String)

Returns the closest match from a list of candidates, if within threshold. Threshold: distance <= max(2, ceil(length(target) * 0.4)).

pub fn levenshtein(a: String, b: String) -> Int

Computes the Levenshtein edit distance between two strings.

Search Document