Nous.Eval.Evaluators.FuzzyMatch (nous v0.13.3)
View SourceEvaluator that uses string similarity for matching.
Uses Levenshtein distance to calculate similarity between strings.
Configuration
:threshold- Minimum similarity (0.0 to 1.0, default: 0.8):normalize- Normalize strings before comparison (default: true):case_insensitive- Ignore case (default: true)
Examples
TestCase.new(
id: "fuzzy",
input: "What is the capital of France?",
expected: "Paris is the capital of France",
eval_type: :fuzzy_match,
eval_config: %{threshold: 0.7}
)
Summary
Functions
Calculate similarity between two strings using Levenshtein distance.
Calculate the Levenshtein distance between two strings.
Functions
Calculate similarity between two strings using Levenshtein distance.
Returns a value between 0.0 (completely different) and 1.0 (identical).
@spec levenshtein_distance(String.t(), String.t()) :: non_neg_integer()
Calculate the Levenshtein distance between two strings.