Input
output
(str): The generated textexpectedOutput
(str): The reference text
Output
Result
(float): A score between 0 and 1.
Interpretation
- Higher scores (closer to 1): Stronger structural similarity and correct word order
- Lower scores (closer to 0): Weak structural similarity
Formula
Example Calculation
- Reference: “the cat sat on the mat” (m = 6)
- Candidate: “the cat lies on the rug” (n = 6)
- LCS(X,Y) = [the, cat, on, the] → length = 4
This is a Similarity Metric
Use Cases
- Evaluating abstractive summarization
- Assessing machine translation