levenshtein_ratio#
- minim.utility.levenshtein_ratio(reference: str, strings: str | list[str]) float | list[float] | ndarray[float] [source]#
Compute the Levenshtein ratios, a measure of similarity, for strings with respect to a reference string.
- Parameters:
- referencestr
Reference string.
- stringsstr or list
Strings to compare with reference.
- Returns:
- ratiosfloat, list, or numpy.ndarray
Levenshtein ratios. If strings is a str, a float is returned. If strings is a list, a numpy.ndarray is returned if NumPy is installed; otherwise, a list is returned.