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): Better bigram overlap (captures local word order and fluency)
- Lower scores (closer to 0): Poor bigram overlap
Formula
Example Calculation
- Reference bigrams: [the cat, cat sat, sat on, on the, the mat]
- Candidate bigrams: [the cat, cat sits, sits on, on the, the mat]
- Overlapping bigrams: [the cat, on the, the mat] = 3
- Total reference bigrams = 5
This is a Similarity Metric
Use Cases
- Evaluating text summarization where sentence structure matters
- Assessing machine translation quality