NLP Metrics ScorerRule-Based

LevenshteinSimilarityScorer

Computes similarity based on Levenshtein (edit) distance between prediction and ground truth. Measures the minimum number of single-character edits needed to transform one string into another.

Overview

Computes similarity based on Levenshtein (edit) distance between prediction and ground truth. Measures the minimum number of single-character edits needed to transform one string into another.

nlp-metricsaccuracyrule-basededit-distancesimilarity

Use Cases

  • Accuracy benchmarking and validation

How It Works

This scorer uses deterministic rule-based evaluation to validate outputs against specific criteria. It applies predefined rules and patterns to assess the response, providing consistent and reproducible results without requiring LLM inference.

Input Schema

ParameterTypeRequiredDescription
predictionstrYesText to compare
ground_truthstrYesReference text

Output Schema

FieldTypeDescription
scorefloatSimilarity score (0-10)
passedboolTrue if above threshold
reasoningstrEdit distance analysis
metadata.edit_distanceintRaw edit distance
metadata.similarity_ratiofloatNormalized similarity

Score Interpretation

Default threshold: 7/10

10Perfect MatchOutput exactly matches expected format/value
0No MatchOutput does not match expected format/value

Frequently Asked Questions

When should I use this scorer?

Use LevenshteinSimilarityScorer when you need to evaluate nlp-metrics and accuracy aspects of your AI outputs. It's particularly useful for accuracy benchmarking and validation.

Why does this scorer need expected output?

This scorer compares the generated output against a known expected result to calculate accuracy metrics.

Can I customize the threshold?

Yes, the default threshold of 7 can be customized when configuring the scorer.

Quick Info

CategoryNLP Metrics
Evaluation TypeRule-Based
Requires Expected OutputYes
Default Threshold7/10

Ready to try LevenshteinSimilarityScorer?

Start evaluating your AI agents with Noveum.ai's comprehensive scorer library.

Explore More Scorers

Discover 68+ LLM-as-Judge scorers for comprehensive AI evaluation