Skip to main content

Commands recognition

Compute Levenshtein Similarity

Computes the Levenshtein similarity between two strings. This method is useful for recognizing spoken commands. It returns a float value between 0.0 and 1.0, where 0.0 is the least likely to be the base string, and 1.0 is the most likely to be the base string.

Notes

  • The method converts both strings to lowercase and trims whitespace from the start and end of each string before computing the Levenshtein distance.
  • A similarity value of 0.6 or higher is generally considered a good match for most applications, but this can vary depending on the specific use case.