Input
output(str): The generated text to be evaluated.expectedOutput(str): The reference or ground truth text.
Output
Result(float): A distance score from 0 to infinity.
Interpretation
0: The embeddings are identical.- Higher scores: The texts are more semantically different.
The score is sensitive to vector magnitude.
Formula
Wherex_i and y_i are the components of the vectors at dimension i.
This is a distance metric. Lower scores indicate greater similarity.
How It Works
The evaluator computes embeddings for both the generated and reference texts, then calculates the straight-line distance between these two vector points in the embedding space.Use Cases
- Semantic distance measurement
- Cluster analysis and nearest neighbor search
- Quality threshold verification