Case Sensitivity:
The function can optionally consider or ignore case sensitivity based on the case_sensitive
argument.
Whitespace Handling:
With ignore_whitespace
set to TRUE, the function removes all whitespaces before comparison. This can be useful for matching strings that may have inconsistent spacing.
Exact Character-by-Character Matching:
The function computes the percentage of matching characters in the same positions.
Substring Matching:
The function checks if one string is a substring of the other, awarding a full match if true.
Levenshtein Distance:
The function uses Levenshtein distance to calculate the similarity and integrates this into the overall match percentage.
Fragment Matching:
- A frag_size
argument is introduced that compares fragments (substrings) of a given size (default is 3) from both strings.
- The function creates unique fragments from each string and compares them to find common fragments.
- The percentage match is calculated based on the ratio of common fragments to the total number of unique fragments.
Combining Metrics:
The overall match percentage is computed as the average of exact match, substring match, Levenshtein match, and fragment match percentages.