Evaluation Parameters
To compute the text_similarity metric, the following parameters must be provided:actual_output
: The generated text or summary from the model.expected_output
: The reference or ground truth text to compare against.
How Is It Calculated?
The metric uses a fuzzy string matching algorithm, which compares the characters in both strings and calculates how many edits (insertions, deletions, or substitutions) are needed to transform one into the other.Interpretation of Scores
- ≥ 0.8 – High textual similarity; close match.
- 0.5 – 0.8 – Moderate similarity; captures most content.
- < 0.5 – Low similarity; outputs may diverge significantly.
Suggested Test Case Types
Use Text Similarity when evaluating:- General text matching where loose phrasing is acceptable.
- Heuristic checks for paraphrasing or alternative wording.
- Lightweight similarity evaluations without requiring semantic understanding.